controllers

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 60 Imported by: 0

Documentation

Index

Constants

View Source
const MachineEtcdReadyLabelName = "cluster.x-k8s.io/etcd-ready"

TODO(g-gaston): remove this once we have a stable CAPI repo that contains this, MachineEtcdReadyLabelName is the label set on machines that have succesfully joined the etcd cluster.

Variables

This section is empty.

Functions

func EtcdClusterMachines

func EtcdClusterMachines(clusterName, etcdClusterName string) func(machine *clusterv1.Machine) bool

EtcdClusterMachines returns a filter to find all etcd machines for a cluster, regardless of ownership.

func EtcdLabelsForCluster

func EtcdLabelsForCluster(clusterName string, etcdClusterName string) map[string]string

ControlPlaneLabelsForCluster returns a set of labels to add to a control plane machine for this specific cluster.

func EtcdMachinesSelectorForCluster

func EtcdMachinesSelectorForCluster(clusterName, etcdClusterName string) labels.Selector

EtcdMachinesSelectorForCluster returns the label selector necessary to get etcd machines for a given cluster.

func MatchesEtcdadmClusterConfiguration

func MatchesEtcdadmClusterConfiguration(infraConfigs map[string]*unstructured.Unstructured, machineConfigs map[string]*etcdbootstrapv1.EtcdadmConfig, ec *etcdv1.EtcdadmCluster) func(machine *clusterv1.Machine) bool

MatchesEtcdadmClusterConfiguration returns a filter to find all machines that matches with EtcdadmCluster config and do not require any rollout. Etcd version and extra params, and infrastructure template need to be equivalent.

func MatchesEtcdadmConfig

func MatchesEtcdadmConfig(machineConfigs map[string]*etcdbootstrapv1.EtcdadmConfig, ec *etcdv1.EtcdadmCluster) collections.Func

MatchesEtcdadmConfig checks if machine's EtcdadmConfigSpec is equivalent with EtcdadmCluster's spec

func MatchesTemplateClonedFrom

func MatchesTemplateClonedFrom(infraConfigs map[string]*unstructured.Unstructured, ec *etcdv1.EtcdadmCluster) collections.Func

MatchesTemplateClonedFrom returns a filter to find all machines that match a given EtcdadmCluster's infra template.

Types

type EtcdClient added in v1.0.13

type EtcdClient interface {
	// MemberList lists the current cluster membership.
	MemberList(ctx context.Context) (*clientv3.MemberListResponse, error)
	// MemberRemove removes an existing member from the cluster.
	MemberRemove(ctx context.Context, id uint64) (*clientv3.MemberRemoveResponse, error)
	// Close closes the EtcdClient session and cancels all watch requests.
	Close() error
}

EtcdClient is an interface used for making ETCD v3 API calls. This interface is needed to so the ETCD API calls can be mocked for unit tests.

type EtcdPlane

type EtcdPlane struct {
	EC       *etcdv1.EtcdadmCluster
	Cluster  *clusterv1.Cluster
	Machines collections.Machines
	// contains filtered or unexported fields
}

func NewEtcdPlane

func NewEtcdPlane(ctx context.Context, client client.Client, cluster *clusterv1.Cluster, ec *etcdv1.EtcdadmCluster, ownedMachines collections.Machines) (*EtcdPlane, error)

func (*EtcdPlane) FailureDomainWithMostMachines

func (ep *EtcdPlane) FailureDomainWithMostMachines(machines collections.Machines) *string

All functions related to failureDomains follow the same logic as KCP's failureDomain implementation, to leverage existing methods FailureDomainWithMostMachines returns a fd which has the most machines on it.

func (*EtcdPlane) FailureDomains

func (ep *EtcdPlane) FailureDomains() clusterv1.FailureDomains

FailureDomains returns a slice of failure domain objects synced from the infrastructure provider into Cluster.Status.

func (*EtcdPlane) MachineInFailureDomainWithMostMachines

func (ep *EtcdPlane) MachineInFailureDomainWithMostMachines(machines collections.Machines) (*clusterv1.Machine, error)

MachineInFailureDomainWithMostMachines returns the first matching failure domain with machines that has the most control-plane machines on it.

func (*EtcdPlane) MachineWithDeleteAnnotation

func (ep *EtcdPlane) MachineWithDeleteAnnotation(machines collections.Machines) collections.Machines

MachineWithDeleteAnnotation returns a machine that has been annotated with DeleteMachineAnnotation key.

func (*EtcdPlane) MachinesNeedingRollout

func (ep *EtcdPlane) MachinesNeedingRollout() collections.Machines

MachinesNeedingRollout return a list of machines that need to be rolled out.

func (*EtcdPlane) NewestUpToDateMachine

func (ep *EtcdPlane) NewestUpToDateMachine() *clusterv1.Machine

func (*EtcdPlane) NextFailureDomainForScaleUp

func (ep *EtcdPlane) NextFailureDomainForScaleUp() *string

NextFailureDomainForScaleUp returns the failure domain with the fewest number of up-to-date machines.

func (*EtcdPlane) OutOfDateMachines added in v1.0.17

func (ep *EtcdPlane) OutOfDateMachines() collections.Machines

OutOfDateMachines return a list of all machines with an out of date config.

func (*EtcdPlane) UpToDateMachines

func (ep *EtcdPlane) UpToDateMachines() collections.Machines

UpToDateMachines returns the machines that are up to date with the control plane's configuration and therefore do not require rollout.

type EtcdadmClusterReconciler

type EtcdadmClusterReconciler struct {
	client.Client

	Log    logr.Logger
	Scheme *runtime.Scheme

	MaxConcurrentReconciles int
	HealthCheckInterval     time.Duration
	GetEtcdClient           func(ctx context.Context, cluster *clusterv1.Cluster, endpoints string) (EtcdClient, error)
	// contains filtered or unexported fields
}

EtcdadmClusterReconciler reconciles a EtcdadmCluster object

func (*EtcdadmClusterReconciler) ClusterToEtcdadmCluster

func (r *EtcdadmClusterReconciler) ClusterToEtcdadmCluster(ctx context.Context, o client.Object) []ctrl.Request

ClusterToEtcdadmCluster is a handler.ToRequestsFunc to be used to enqueue requests for reconciliation for EtcdadmCluster based on updates to a Cluster.

func (*EtcdadmClusterReconciler) Reconcile

func (r *EtcdadmClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, reterr error)

func (*EtcdadmClusterReconciler) SetIsPortOpen added in v1.0.13

func (r *EtcdadmClusterReconciler) SetIsPortOpen(s func(ctx context.Context, endpoint string) bool)

func (*EtcdadmClusterReconciler) SetupWithManager

func (r *EtcdadmClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, done <-chan struct{}) error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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