Documentation
¶
Index ¶
- Constants
- func Add(ctx context.Context, mgr manager.Manager, args AddArgs) error
- func ClusterToWorkerMapper(reader client.Reader, predicates []predicate.Predicate) handler.MapFunc
- func DefaultPredicates(ctx context.Context, mgr manager.Manager, 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 FetchUserData(ctx context.Context, c client.Client, namespace string, ...) ([]byte, error)
- func FindBestImageFlavor[T CapabilitiesAccessor](providerImageFlavors []T, machineCapabilities v1beta1.Capabilities, ...) (T, error)
- func GetMachineCondition(machine *machinev1alpha1.Machine, conditionType corev1.NodeConditionType) *corev1.NodeCondition
- func MachineConditionChangedPredicate(ctx context.Context, log logr.Logger, c client.Client) predicate.Funcs
- func MachineNodeInfoHasChanged() predicate.Predicate
- func MachineToWorkerMapper() handler.MapFunc
- func NewReconciler(mgr manager.Manager, actuator Actuator) reconcile.Reconciler
- func WorkerPoolHash(pool extensionsv1alpha1.WorkerPool, cluster *extensionscontroller.Cluster, ...) (string, error)
- func WorkerPoolHashInPlace(pool extensionsv1alpha1.WorkerPool, cluster *extensionscontroller.Cluster, ...) (string, error)
- func WorkerPoolHashV1(pool extensionsv1alpha1.WorkerPool, cluster *extensionscontroller.Cluster, ...) (string, error)
- func WorkerPoolHashV2(nodeAgentSecretName string, additionalData ...string) (string, error)
- type Actuator
- type AddArgs
- type CapabilitiesAccessor
- type MachineDeployment
- type MachineDeployments
Constants ¶
const ( // FinalizerName is the worker controller finalizer. FinalizerName = "extensions.gardener.cloud/worker" // ControllerName is the name of the controller. ControllerName = "worker" )
const LabelKeyMachineDeploymentName = "name"
LabelKeyMachineDeploymentName is the label key for the name of the MachineDeployment.
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 ClusterToWorkerMapper ¶
ClusterToWorkerMapper returns a mapper that returns requests for Worker whose referenced clusters have been modified.
func DefaultPredicates ¶
func DefaultPredicates(ctx context.Context, mgr manager.Manager, ignoreOperationAnnotation bool) []predicate.Predicate
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 FetchUserData ¶ added in v1.95.0
func FetchUserData(ctx context.Context, c client.Client, namespace string, pool extensionsv1alpha1.WorkerPool) ([]byte, error)
FetchUserData fetches the user data for a worker pool.
func FindBestImageFlavor ¶ added in v1.128.0
func FindBestImageFlavor[T CapabilitiesAccessor]( providerImageFlavors []T, machineCapabilities v1beta1.Capabilities, capabilityDefinitions []v1beta1.CapabilityDefinition, ) (T, error)
FindBestImageFlavor finds the most appropriate image version flavor based on the requested machine capabilities. The provided capability definitions are used for applying defaults.
func GetMachineCondition ¶ added in v1.118.0
func GetMachineCondition(machine *machinev1alpha1.Machine, conditionType corev1.NodeConditionType) *corev1.NodeCondition
GetMachineCondition returns a condition matching the type from the machines's status
func MachineConditionChangedPredicate ¶ added in v1.118.0
func MachineConditionChangedPredicate(ctx context.Context, log logr.Logger, c client.Client) predicate.Funcs
MachineConditionChangedPredicate returns a predicate function that returns - true for Create events if the MachineDeployment strategy is InPlaceUpdate and OrchestrationType is Manual - true for Update events if the MachineDeployment strategy is InPlaceUpdate and OrchestrationType is Manual and machine condition transitioned from UpdateCandidate to SelectedForUpdate - false for Delete and Generic events
func MachineNodeInfoHasChanged ¶ added in v1.67.0
MachineNodeInfoHasChanged is a predicate deciding whether the information about the backing node of a Machine has been changed.
func MachineToWorkerMapper ¶
MachineToWorkerMapper returns a mapper that returns requests for the Worker referenced by the machine.
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 WorkerPoolHash ¶
func WorkerPoolHash(pool extensionsv1alpha1.WorkerPool, cluster *extensionscontroller.Cluster, additionalDataV1, additionalDataV2, additionalDataInPlace []string) (string, error)
WorkerPoolHash returns a hash value for a given worker pool and a given cluster resource.
func WorkerPoolHashInPlace ¶ added in v1.120.0
func WorkerPoolHashInPlace(pool extensionsv1alpha1.WorkerPool, cluster *extensionscontroller.Cluster, additionalData ...string) (string, error)
WorkerPoolHashInPlace returns the hash value for a worker pool with an in-place update strategy.
func WorkerPoolHashV1 ¶ added in v1.98.0
func WorkerPoolHashV1(pool extensionsv1alpha1.WorkerPool, cluster *extensionscontroller.Cluster, additionalData ...string) (string, error)
WorkerPoolHashV1 returns a hash value for a given worker pool and a given cluster resource.
Types ¶
type Actuator ¶
type Actuator interface {
// Reconcile reconciles the [extensionsv1alpha1.Worker] resource.
//
// Implementations should ensure that any resources
// (e.g. MachineClasses, MachineDeployments, Secrets, etc.) are created
// or updated in order to reach their desired state.
Reconcile(context.Context, logr.Logger, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error
// Delete is invoked when the [extensionsv1alpha1.Worker] resource is
// deleted.
//
// Implementations should take care of cleaning up any resources
// (e.g. MachineClasses, MachineDeployments, Secrets, etc.), which were
// created by the Extension.
//
// Implementations must wait until all resources managed by the
// extension have been gracefully cleaned up.
Delete(context.Context, logr.Logger, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error
// ForceDelete is invoked when the shoot cluster associated with the
// [extensionsv1alpha1.Worker] resource is being deleted in a forceful
// manner.
//
// Implementations should take care of unblocking the deletion flow by
// attempting to cleanup any resources created by the extension, remove
// any finalizers created for custom resources, etc., and also skip
// waiting for external resources, if they cannot be deleted gracefully.
//
// If some resources managed by the extension implementation cannot be
// deleted gracefully, this method should still succeed, even if some
// resources are orphaned.
ForceDelete(context.Context, logr.Logger, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error
// Restore restores the [extensionsv1alpha1.Worker] from a previously
// saved state.
//
// For more details please refer to the following documentation.
//
// https://gardener.cloud/docs/gardener/extensions/migration/#implementation-details
Restore(context.Context, logr.Logger, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error
// Migrate prepares the [extensionsv1alpha1.Worker] resource for
// migration.
//
// This method is invoked when the shoot cluster associated with the
// [extensionsv1alpha1.Extension] resource is being migrated to another
// seed cluster.
//
// For more details, please refer to the following documentation.
//
// https://gardener.cloud/docs/gardener/extensions/migration/#implementation-details
Migrate(context.Context, logr.Logger, *extensionsv1alpha1.Worker, *extensionscontroller.Cluster) error
}
Actuator acts upon extensionsv1alpha1.Worker resources.
type AddArgs ¶
type AddArgs struct {
// Actuator is a 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
// ExtensionClasses defines the extension classes this controller is responsible for.
ExtensionClasses []extensionsv1alpha1.ExtensionClass
// SelfHostedShootCluster indicates whether the extension runs in a self-hosted shoot cluster.
SelfHostedShootCluster bool
}
AddArgs are arguments for adding a Worker controller to a manager.
type CapabilitiesAccessor ¶ added in v1.128.0
type CapabilitiesAccessor interface {
GetCapabilities() v1beta1.Capabilities
}
CapabilitiesAccessor defines an interface for retrieving Capabilities.
type MachineDeployment ¶
type MachineDeployment struct {
Name string
PoolName string
ClassName string
SecretName string
Minimum int32
Maximum int32
Priority *int32
Strategy machinev1alpha1.MachineDeploymentStrategy
Labels map[string]string
Annotations map[string]string
Taints []corev1.Taint
State *shootstate.MachineDeploymentState
MachineConfiguration *machinev1alpha1.MachineConfiguration
ClusterAutoscalerAnnotations map[string]string
}
MachineDeployment holds information about the name, class, replicas of a MachineDeployment managed by the machine-controller-manager.
type MachineDeployments ¶
type MachineDeployments []MachineDeployment
MachineDeployments is a list of machine deployments.
func (MachineDeployments) FindByName ¶ added in v1.8.0
func (m MachineDeployments) FindByName(name string) *MachineDeployment
FindByName finds the deployment with the <name> from the <machineDeployments> returns the machine deployment or nil
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.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |