Documentation ¶
Index ¶
- Constants
- func Add(mgr manager.Manager, args AddArgs) error
- func ApplyMachineResources(ctx context.Context, c client.Client) error
- func ApplyMachineResourcesForConfig(ctx context.Context, config *rest.Config) error
- func ClusterToWorkerMapper(predicates []predicate.Predicate) handler.Mapper
- func DefaultPredicates(ignoreOperationAnnotation bool) []predicate.Predicate
- func DiskSize(size string) (int, error)
- func DistributeOverZones(zoneIndex, size, zoneSize int32) int32
- func DistributePercentOverZones(zoneIndex int32, percent string, zoneSize, total int32) string
- func DistributePositiveIntOrPercent(zoneIndex int32, intOrPercent intstr.IntOrString, zoneSize, total int32) intstr.IntOrString
- func ErrorMachineImageNotFound(name, version string, opt ...string) error
- func MachineSetToWorkerMapper(predicates []predicate.Predicate) handler.Mapper
- func MachineStatusHasChanged() predicate.Predicate
- func MachineToWorkerMapper(predicates []predicate.Predicate) handler.Mapper
- func NewReconciler(mgr manager.Manager, actuator Actuator) reconcile.Reconciler
- func NewStateReconciler(mgr manager.Manager, actuator StateActuator) reconcile.Reconciler
- func WorkerPoolHash(pool extensionsv1alpha1.WorkerPool, cluster *extensionscontroller.Cluster, ...) (string, error)
- type Actuator
- type AddArgs
- type Config
- type MachineDeployment
- type MachineDeploymentState
- type MachineDeployments
- type Options
- type State
- type StateActuator
Constants ¶
const ( // FinalizerName is the worker controller finalizer. FinalizerName = "extensions.gardener.cloud/worker" // ControllerName is the name of the controller. ControllerName = "worker_controller" // StateUpdatingControllerName is the name of the controller responsible for updating the worker's state. StateUpdatingControllerName = "worker_state_controller" )
const ( // StartToSyncState is used as part of the Event 'reason' when a Worker state starts to synchronize StartToSyncState = "SynchronizingState" // SuccessSynced is used as part of the Event 'reason' when a Worker state is synced SuccessSynced = "StateSynced" // ErrorStateSync is used as part of the Event 'reason' when a Worker state fail to sync ErrorStateSync = "ErrorSynchronizingState" // StateSyncControllerName is the name of the controller which synchronize the Worker state StateSyncControllerName = "worker-state-controller" )
const ( // DeployCRDsFlag is the name of the command line flag to specify whether the worker CRDs // should be deployed or not. DeployCRDsFlag = "deploy-crds" )
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add creates a new Worker Controller and adds it to the Manager. and Start it when the Manager is Started.
func ApplyMachineResources ¶
ApplyMachineResources ensures that all well-known machine CRDs are created or updated.
func ApplyMachineResourcesForConfig ¶
ApplyMachineResourcesForConfig ensures that all well-known machine CRDs are created or updated.
func ClusterToWorkerMapper ¶
ClusterToWorkerMapper returns a mapper that returns requests for Worker whose referenced clusters have been modified.
func DefaultPredicates ¶
DefaultPredicates returns the default predicates for a Worker reconciler.
func DiskSize ¶
DiskSize extracts the numerical component of DiskSize strings, i.e. strings like "10Gi" and returns it as string, i.e. "10" will be returned.
func DistributeOverZones ¶
DistributeOverZones is a function which is used to determine how many nodes should be used for each availability zone. It takes the number of availability zones (<zoneSize>), the index of the current zone (<zoneIndex>) and the number of nodes which must be distributed over the zones (<size>) and returns the number of nodes which should be placed in the zone of index <zoneIndex>. The distribution happens equally. In case of an uneven number <size>, the last zone will have one more node than the others.
func DistributePercentOverZones ¶
DistributePercentOverZones distributes a given percentage value over zones in relation to the given total value. In case the total value is evenly divisible over the zones, this always just returns the initial percentage. Otherwise, the total value is used to determine the weight of a specific zone in relation to the other zones and adapt the given percentage accordingly.
func DistributePositiveIntOrPercent ¶
func DistributePositiveIntOrPercent(zoneIndex int32, intOrPercent intstr.IntOrString, zoneSize, total int32) intstr.IntOrString
DistributePositiveIntOrPercent distributes a given int or percentage value over zones in relation to the given total value. In case the total value is evenly divisible over the zones, this always just returns the initial percentage. Otherwise, the total value is used to determine the weight of a specific zone in relation to the other zones and adapt the given percentage accordingly.
func ErrorMachineImageNotFound ¶
ErrorMachineImageNotFound returns an appropriate error message for an unknown name/version image pair.
func MachineSetToWorkerMapper ¶
MachineSetToWorkerMapper returns a mapper that returns requests for Worker whose referenced MachineSets have been modified.
func MachineStatusHasChanged ¶
MachineStatusHasChanged is a predicate deciding wether the status of a MCM's Machine has been changed.
func MachineToWorkerMapper ¶
MachineToWorkerMapper returns a mapper that returns requests for Worker whose referenced Machines have been modified.
func NewReconciler ¶
func NewReconciler(mgr manager.Manager, actuator Actuator) reconcile.Reconciler
NewReconciler creates a new reconcile.Reconciler that reconciles Worker resources of Gardener's `extensions.gardener.cloud` API group.
func NewStateReconciler ¶
func NewStateReconciler(mgr manager.Manager, actuator StateActuator) reconcile.Reconciler
NewStateReconciler creates a new reconcile.Reconciler that reconciles Worker's State resources of Gardener's `extensions.gardener.cloud` API group.
func WorkerPoolHash ¶
func WorkerPoolHash(pool extensionsv1alpha1.WorkerPool, cluster *extensionscontroller.Cluster, additionalData ...string) (string, error)
WorkerPoolHash returns a hash value for a given worker pool and a given cluster resource.
Types ¶
type Actuator ¶
type Actuator interface { // Reconcile reconciles the Worker. Reconcile(context.Context, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error // Delete deletes the Worker. Delete(context.Context, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error // Restore reads from the worker.status.state field and deploys the machines and machineSet Restore(context.Context, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error // Migrate deletes the MCM, machineDeployments, machineClasses, machineClassSecrets, // machineSets and the machines. The underlying VMs representing the Shoot nodes are not deleted Migrate(context.Context, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error }
Actuator acts upon Worker resources.
type AddArgs ¶
type AddArgs struct { // Actuator is an worker actuator. Actuator Actuator // ControllerOptions are the controller options used for creating a controller. // The options.Reconciler is always overridden with a reconciler created from the // given actuator. ControllerOptions controller.Options // Predicates are the predicates to use. // If unset, GenerationChangedPredicate will be used. Predicates []predicate.Predicate // Type is the type of the resource considered for reconciliation. Type string // IgnoreOperationAnnotation specifies whether to ignore the operation annotation or not. // If the annotation is not ignored, the extension controller will only reconcile // with a present operation annotation typically set during a reconcile (e.g in the maintenance time) by the Gardenlet IgnoreOperationAnnotation bool }
AddArgs are arguments for adding an worker controller to a manager.
type Config ¶
type Config struct { // DeployCRDs defines whether to ignore the operation annotation or not. DeployCRDs bool }
Config is a completed controller configuration.
type MachineDeployment ¶
type MachineDeployment struct { Name string ClassName string SecretName string Minimum int32 Maximum int32 MaxSurge intstr.IntOrString Labels map[string]string Annotations map[string]string Taints []corev1.Taint State *MachineDeploymentState }
MachineDeployment holds information about the name, class, replicas of a MachineDeployment managed by the machine-controller-manager.
type MachineDeploymentState ¶
type MachineDeploymentState struct { Replicas int32 `json:"replicas,omitempty"` MachineSets []machinev1alpha1.MachineSet `json:"machineSets,omitempty"` Machines []machinev1alpha1.Machine `json:"machines,omitempty"` }
MachineDeploymentState stores the last versions of the machine sets and machine which the machine deployment corresponds
type MachineDeployments ¶
type MachineDeployments []MachineDeployment
MachineDeployments is a list of machine deployments.
func (MachineDeployments) HasClass ¶
func (m MachineDeployments) HasClass(className string) bool
HasClass checks whether the <className> is part of the <machineDeployments> list, i.e. whether there is an entry whose 'ClassName' attribute matches <name>. It returns true or false.
func (MachineDeployments) HasDeployment ¶
func (m MachineDeployments) HasDeployment(name string) bool
HasDeployment checks whether the <name> is part of the <machineDeployments> list, i.e. whether there is an entry whose 'Name' attribute matches <name>. It returns true or false.
func (MachineDeployments) HasSecret ¶
func (m MachineDeployments) HasSecret(secretName string) bool
HasSecret checks whether the <secretName> is part of the <machineDeployments> list, i.e. whether there is an entry whose 'SecretName' attribute matches <name>. It returns true or false.
type Options ¶
type Options struct { // DeployCRDs defines whether to ignore the operation annotation or not. DeployCRDs bool // contains filtered or unexported fields }
Options are command line options that can be set for controller.Options.
type State ¶
type State struct {
MachineDeployments map[string]*MachineDeploymentState `json:"machineDeployments,omitempty"`
}
State represent the last known state of a Worker
type StateActuator ¶
type StateActuator interface { // Reconcile reconciles the Worker State. Reconcile(context.Context, *extensionsv1alpha1.Worker) error }
StateActuator acts upon Worker's State resources.
func NewStateActuator ¶
func NewStateActuator(logger logr.Logger) StateActuator
NewStateActuator creates a new Actuator that reconciles Worker's State subresource It provides a default implementation that allows easier integration of providers.