joinclient

package
v2.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

JoinClient

The JoinClient is one of the two main components of the bootstrapper. It is responsible for for the initial setup of a node, and joining an existing Kubernetes cluster.

The JoinClient is started on each node, it then continuously checks for an existing cluster to join, or for the InitServer to bootstrap a new cluster.

If the JoinClient finds an existing cluster, it will attempt to join it as either a control-plane or a worker node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterJoiner

type ClusterJoiner interface {
	// JoinCluster joins a new node to an existing cluster.
	JoinCluster(
		ctx context.Context,
		args *kubeadm.BootstrapTokenDiscovery,
		peerRole role.Role,
		k8sComponents components.Components,
		log *slog.Logger,
	) error
}

ClusterJoiner has the ability to join a new node to an existing cluster.

type JoinClient

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

JoinClient is a client for requesting the needed information and joining an existing Kubernetes cluster.

func New

func New(lock locker, dial grpcDialer, joiner ClusterJoiner, meta MetadataAPI, log *slog.Logger) *JoinClient

New creates a new JoinClient.

func (*JoinClient) Start

func (c *JoinClient) Start(cleaner cleaner)

Start starts the client routine. The client will make the needed API calls to join the cluster with the role it receives from the metadata API. After receiving the needed information, the node will join the cluster. Multiple calls of start on the same client won't start a second routine if there is already a routine running.

func (*JoinClient) Stop

func (c *JoinClient) Stop()

Stop stops the client and blocks until the client's routine is stopped.

type MetadataAPI

type MetadataAPI interface {
	// List retrieves all instances belonging to the current constellation.
	List(ctx context.Context) ([]metadata.InstanceMetadata, error)
	// Self retrieves the current instance.
	Self(ctx context.Context) (metadata.InstanceMetadata, error)
	// GetLoadBalancerEndpoint retrieves the load balancer endpoint.
	GetLoadBalancerEndpoint(ctx context.Context) (host, port string, err error)
}

MetadataAPI provides information about the instances.

Jump to

Keyboard shortcuts

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