nodes

package
v0.0.0-...-152418c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package nodes contains functionality for Kubernetes-in-Docker nodes It mostly exists to break up functionality from github.com/shaneutt/kind/pkg/cluster

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(nodes ...Node) error

Delete deletes nodes by name / ID (see Node.String())

func GetControlPlaneEndpoint

func GetControlPlaneEndpoint(allNodes []Node) (string, string, error)

GetControlPlaneEndpoint returns the control plane endpoints for IPv4 and IPv6 in case the cluster has an external load balancer in front of the control-plane nodes, otherwise return the bootstrap node IPs

func ListByCluster

func ListByCluster(filters ...string) (map[string][]Node, error)

ListByCluster returns a list of nodes by the kind cluster name

func WaitForReady

func WaitForReady(node *Node, until time.Time) bool

WaitForReady uses kubectl inside the "node" container to check if the control plane nodes are "Ready".

Types

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node represents a handle to a kind node This struct must be created by one of: CreateControlPlane It should not be manually instantiated Node impleemnts exec.Cmder

func BootstrapControlPlaneNode

func BootstrapControlPlaneNode(allNodes []Node) (*Node, error)

BootstrapControlPlaneNode returns a handle to the bootstrap control plane node

func ControlPlaneNodes

func ControlPlaneNodes(allNodes []Node) ([]Node, error)

ControlPlaneNodes returns all control plane nodes such that the first entry is the bootstrap control plane node

func CreateControlPlaneNode

func CreateControlPlaneNode(name, image, clusterLabel, listenAddress string, port int32, mounts []cri.Mount, portMappings []cri.PortMapping) (node *Node, err error)

CreateControlPlaneNode creates a control-plane node and gets ready for exposing the API server

func CreateExternalLoadBalancerNode

func CreateExternalLoadBalancerNode(name, image, clusterLabel, listenAddress string, port int32) (node *Node, err error)

CreateExternalLoadBalancerNode creates an external load balancer node and gets ready for exposing the API server and the load balancer admin console

func CreateWorkerNode

func CreateWorkerNode(name, image, clusterLabel string, mounts []cri.Mount, portMappings []cri.PortMapping) (node *Node, err error)

CreateWorkerNode creates a worker node

func ExternalLoadBalancerNode

func ExternalLoadBalancerNode(allNodes []Node) (*Node, error)

ExternalLoadBalancerNode returns a node handle for the external control plane loadbalancer node or nil if there isn't one

func FromName

func FromName(name string) *Node

FromName creates a node handle from the node' Name

func List

func List(filters ...string) ([]Node, error)

List returns the list of container IDs for the kind "nodes", optionally filtered by docker ps filters https://docs.docker.com/engine/reference/commandline/ps/#filtering

func SecondaryControlPlaneNodes

func SecondaryControlPlaneNodes(allNodes []Node) ([]Node, error)

SecondaryControlPlaneNodes returns handles to the secondary control plane nodes and NOT the bootstrap control plane node

func SelectNodesByRole

func SelectNodesByRole(allNodes []Node, role string) ([]Node, error)

SelectNodesByRole returns a list of nodes with the matching role

func (*Node) Cmder

func (n *Node) Cmder() exec.Cmder

Cmder returns an exec.Cmder that runs on the node via docker exec

func (*Node) Command

func (n *Node) Command(command string, args ...string) exec.Cmd

Command returns a new exec.Cmd that will run on the node

func (*Node) CopyFrom

func (n *Node) CopyFrom(source, dest string) error

CopyFrom copies the source file on the node to dest on the host TODO(fabrizio pandini): note that this does have limitations around symlinks

but this should go away when kubeadm automatic copy certs lands,
otherwise it should be refactored in something more robust in the long term

func (*Node) CopyTo

func (n *Node) CopyTo(source, dest string) error

CopyTo copies the source file on the host to dest on the node

func (*Node) EnableIPv6

func (n *Node) EnableIPv6() error

EnableIPv6 enables IPv6 inside the node container and in the inner docker daemon

func (*Node) IP

func (n *Node) IP() (ipv4 string, ipv6 string, err error)

IP returns the IP address of the node

func (*Node) ImageID

func (n *Node) ImageID(image string) (string, error)

ImageID returns the ID for a given image if it is present on the node

func (*Node) KubeVersion

func (n *Node) KubeVersion() (version string, err error)

KubeVersion returns the Kubernetes version installed on the node

func (*Node) LoadImageArchive

func (n *Node) LoadImageArchive(image io.Reader) error

LoadImageArchive will load the image contents in the image reader to the k8s.io namespace on the node such that the image can be used from a Kubernetes pod

func (*Node) Name

func (n *Node) Name() string

Name returns the node's name

func (*Node) Ports

func (n *Node) Ports(containerPort int32) (hostPort int32, err error)

Ports returns a specific port mapping for the node Node by convention use well known ports internally, while random port are used for making the `kind` cluster accessible from the host machine

func (*Node) Role

func (n *Node) Role() (role string, err error)

Role returns the role of the node

func (*Node) String

func (n *Node) String() string

func (*Node) WriteFile

func (n *Node) WriteFile(dest, content string) error

WriteFile writes content to dest on the node

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL