nodes

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: Apache-2.0 Imports: 22 Imported by: 37

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, error)

GetControlPlaneEndpoint returns the control plane endpoint in case the cluster has an external load balancer in front of the control-plane nodes, otherwise return an empty string.

func ListByCluster

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

ListByCluster returns a list of nodes by the kind cluster name

func NeedProxy added in v0.2.0

func NeedProxy() bool

NeedProxy returns true if the host environment appears to have proxy settings

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) (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) (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) FixMounts

func (n *Node) FixMounts() error

FixMounts will correct mounts in the node container to meet the right sharing and permissions for systemd and Docker / Kubernetes

func (*Node) IP added in v0.1.0

func (n *Node) IP() (ip string, err error)

IP returns the IP address of the node

func (*Node) KubeVersion

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

KubeVersion returns the Kubernetes version installed on the node

func (*Node) LoadImages

func (n *Node) LoadImages()

LoadImages loads image tarballs stored on the node into docker on the node

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

func (n *Node) SetProxy() error

SetProxy configures proxy settings for the node

Currently it only creates systemd drop-in for Docker daemon as described in Docker documentation: https://docs.docker.com/config/daemon/systemd/#http-proxy

See also: NeedProxy and getProxyDetails

func (*Node) SignalStart

func (n *Node) SignalStart() error

SignalStart sends SIGUSR1 to the node, which signals our entrypoint to boot see images/node/entrypoint

func (*Node) String

func (n *Node) String() string

func (*Node) WaitForDocker

func (n *Node) WaitForDocker(until time.Time) bool

WaitForDocker waits for Docker to be ready on the node it returns true on success, and false on a timeout

func (*Node) WriteFile added in v0.2.0

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

WriteFile writes temporary file on the host and copies it to the node

func (*Node) WriteKubeConfig

func (n *Node) WriteKubeConfig(dest string, hostPort int32) error

WriteKubeConfig writes a fixed KUBECONFIG to dest this should only be called on a control plane node While copyng to the host machine the control plane address is replaced with local host and the control plane port with a randomly generated port reserved during node creation.

Jump to

Keyboard shortcuts

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