Documentation ¶
Overview ¶
Package docker implements docker functionality.
Index ¶
- Constants
- func FailureDomainLabel(failureDomain *string) map[string]string
- func List(ctx context.Context, filters container.FilterBuilder) ([]*types.Node, error)
- func MachineContainerName(cluster, machine string) string
- type ContainerNotRunningError
- type LoadBalancer
- func (s *LoadBalancer) Create(ctx context.Context) error
- func (s *LoadBalancer) Delete(ctx context.Context) error
- func (s *LoadBalancer) IP(ctx context.Context) (string, error)
- func (s *LoadBalancer) UpdateConfiguration(ctx context.Context, weights map[string]int, unsafeLoadBalancerConfig string) error
- type Machine
- func (m *Machine) Address(ctx context.Context) ([]string, error)
- func (m *Machine) CheckForBootstrapSuccess(ctx context.Context, logResult bool) error
- func (m *Machine) CloudProviderNodePatch(ctx context.Context, c client.Client, dockerMachine *infrav1.DockerMachine) error
- func (m *Machine) ContainerImage() string
- func (m *Machine) ContainerName() string
- func (m *Machine) Create(ctx context.Context, image string, role string, version *string, ...) error
- func (m *Machine) Delete(ctx context.Context) error
- func (m *Machine) ExecBootstrap(ctx context.Context, data string, format bootstrapv1.Format, version *string, ...) error
- func (m *Machine) Exists() bool
- func (m *Machine) IsControlPlane() bool
- func (m *Machine) Name() string
- func (m *Machine) PreloadLoadImages(ctx context.Context, images []string) error
- func (m *Machine) ProviderID() string
- func (m *Machine) SetNodeProviderID(ctx context.Context, c client.Client) error
- type Manager
- func (m *Manager) CreateControlPlaneNode(ctx context.Context, name, clusterName, listenAddress string, port int32, ...) (*types.Node, error)
- func (m *Manager) CreateExternalLoadBalancerNode(ctx context.Context, name, image, clusterName, listenAddress string, ...) (*types.Node, error)
- func (m *Manager) CreateWorkerNode(ctx context.Context, name, clusterName string, mounts []v1alpha4.Mount, ...) (*types.Node, error)
Constants ¶
const ControlPlanePort = 6443
ControlPlanePort is the port for accessing the control plane API in the container.
const DefaultNetwork = "kind"
DefaultNetwork is the default network name to use in kind.
const HAProxyPort = 8404
HAProxyPort is the port for accessing HA proxy stats.
const KubeadmContainerPort = 6443
KubeadmContainerPort is the port that kubeadm listens on in the container.
Variables ¶
This section is empty.
Functions ¶
func FailureDomainLabel ¶ added in v1.2.0
FailureDomainLabel returns a map with the docker label for the given failure domain.
func List ¶
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 MachineContainerName ¶ added in v1.9.0
MachineContainerName computes the name of a container for a given machine.
Types ¶
type ContainerNotRunningError ¶
type ContainerNotRunningError struct {
Name string
}
ContainerNotRunningError is returned when trying to patch a container that is not running.
func (ContainerNotRunningError) Error ¶
func (cse ContainerNotRunningError) Error() string
Error returns the error string.
type LoadBalancer ¶
type LoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer manages the load balancer for a specific docker cluster.
func NewLoadBalancer ¶
func NewLoadBalancer(ctx context.Context, cluster *clusterv1.Cluster, dockerCluster *infrav1.DockerCluster) (*LoadBalancer, error)
NewLoadBalancer returns a new helper for managing a docker loadbalancer with a given name.
func (*LoadBalancer) Create ¶
func (s *LoadBalancer) Create(ctx context.Context) error
Create creates a docker container hosting a load balancer for the cluster.
func (*LoadBalancer) Delete ¶
func (s *LoadBalancer) Delete(ctx context.Context) error
Delete the docker container hosting the cluster load balancer.
func (*LoadBalancer) IP ¶
func (s *LoadBalancer) IP(ctx context.Context) (string, error)
IP returns the load balancer IP address.
func (*LoadBalancer) UpdateConfiguration ¶
func (s *LoadBalancer) UpdateConfiguration(ctx context.Context, weights map[string]int, unsafeLoadBalancerConfig string) error
UpdateConfiguration updates the external load balancer configuration with new control plane nodes.
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
Machine implement a service for managing the docker containers hosting a kubernetes nodes.
func ListMachinesByCluster ¶
func ListMachinesByCluster(ctx context.Context, cluster *clusterv1.Cluster, labels map[string]string) ([]*Machine, error)
ListMachinesByCluster will retrieve a list of all machines that are part of the given cluster.
func NewMachine ¶
func NewMachine(ctx context.Context, cluster *clusterv1.Cluster, machine string, filterLabels map[string]string) (*Machine, error)
NewMachine returns a new Machine service for the given Cluster/DockerCluster pair.
func (*Machine) Address ¶
Address will get the IP address of the machine. It can return a single IPv4 address, a single IPv6 address or one of each depending on the machine.ipFamily.
func (*Machine) CheckForBootstrapSuccess ¶
CheckForBootstrapSuccess checks if bootstrap was successful by checking for existence of the sentinel file.
func (*Machine) CloudProviderNodePatch ¶ added in v1.5.0
func (m *Machine) CloudProviderNodePatch(ctx context.Context, c client.Client, dockerMachine *infrav1.DockerMachine) error
CloudProviderNodePatch performs the tasks that would normally be down by an external cloud provider. 1) For all CAPD Nodes it sets the ProviderID on the Kubernetes Node. 2) If the cloudProviderTaint is set it updates the addresses in the Kubernetes Node `.status.addresses`. 3) If the cloudProviderTaint is set it removes it to inform Kubernetes that this Node is now initialized.
func (*Machine) ContainerImage ¶ added in v1.2.0
ContainerImage return the image of the container for this machine or empty string if the container does not exist yet.
func (*Machine) ContainerName ¶
ContainerName return the name of the container for this machine.
func (*Machine) Create ¶
func (m *Machine) Create(ctx context.Context, image string, role string, version *string, labels map[string]string, mounts []infrav1.Mount) error
Create creates a docker container hosting a Kubernetes node.
func (*Machine) ExecBootstrap ¶
func (m *Machine) ExecBootstrap(ctx context.Context, data string, format bootstrapv1.Format, version *string, image string) error
ExecBootstrap runs bootstrap on a node, this is generally `kubeadm <init|join>`.
func (*Machine) IsControlPlane ¶
IsControlPlane returns true if the container for this machine is a control plane node.
func (*Machine) PreloadLoadImages ¶
PreloadLoadImages takes a list of container images and imports them into a machine.
func (*Machine) ProviderID ¶
ProviderID return the provider identifier for this machine.
type Manager ¶
type Manager struct{}
Manager is the kind manager type.
func (*Manager) CreateControlPlaneNode ¶
func (m *Manager) CreateControlPlaneNode(ctx context.Context, name, clusterName, listenAddress string, port int32, mounts []v1alpha4.Mount, portMappings []v1alpha4.PortMapping, labels map[string]string, ipFamily clusterv1.ClusterIPFamily, kindMapping kind.Mapping) (*types.Node, error)
CreateControlPlaneNode will create a new control plane container. NOTE: If port is 0 picking a host port for the control plane is delegated to the container runtime and is not stable across container restarts. This means that connection to a control plane node may take some time to recover if the underlying container is restarted.
func (*Manager) CreateExternalLoadBalancerNode ¶
func (m *Manager) CreateExternalLoadBalancerNode(ctx context.Context, name, image, clusterName, listenAddress string, port int32, _ clusterv1.ClusterIPFamily) (*types.Node, error)
CreateExternalLoadBalancerNode will create a new container to act as the load balancer for external access. NOTE: If port is 0 picking a host port for the load balancer is delegated to the container runtime and is not stable across container restarts. This can break the Kubeconfig in kind, i.e. the file resulting from `kind get kubeconfig -n $CLUSTER_NAME' if the load balancer container is restarted.
func (*Manager) CreateWorkerNode ¶
func (m *Manager) CreateWorkerNode(ctx context.Context, name, clusterName string, mounts []v1alpha4.Mount, portMappings []v1alpha4.PortMapping, labels map[string]string, ipFamily clusterv1.ClusterIPFamily, kindMapping kind.Mapping) (*types.Node, error)
CreateWorkerNode will create a new worker container.