nodes

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 17 Imported by: 33

Documentation

Overview

Package nodes contains functionality for Kubernetes-in-Docker nodes It mostly exists to break up functionality from sigs.k8s.io/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 added in v0.2.0

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 added in v0.1.0

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 added in v0.2.0

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

BootstrapControlPlaneNode returns a handle to the bootstrap control plane node

func ControlPlaneNodes added in v0.2.0

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 contol-plane node and gets ready for exposing the the API server

func CreateExternalLoadBalancerNode added in v0.2.0

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

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

func CreateWorkerNode added in v0.1.0

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

CreateWorkerNode creates a worker node

func ExternalLoadBalancerNode added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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

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

func SelectNodesByRole added in v0.2.0

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 added in v0.2.0

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 added in v0.4.0

func (n *Node) EnableIPv6() error

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

func (*Node) IP added in v0.1.0

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

IP returns the IP address of the node

func (*Node) ImageInspect added in v0.4.0

func (n *Node) ImageInspect(containerNameOrID string) ([]string, error)

ImageInspect return low-level information on containers images inside a node

func (*Node) KubeVersion

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

KubeVersion returns the Kubernetes version installed on the node

func (*Node) LoadImageArchive added in v0.3.0

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 added in v0.2.0

func (n *Node) Name() string

Name returns the node's name

func (*Node) Ports added in v0.1.0

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 added in v0.2.0

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 added in v0.2.0

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