Documentation
¶
Index ¶
- Constants
- func Add(mgr manager.Manager, args AddArgs) error
- func ClusterToInfrastructureMapper(reader client.Reader, predicates []predicate.Predicate) handler.MapFunc
- func DefaultPredicates(ctx context.Context, mgr manager.Manager, ignoreOperationAnnotation bool) []predicate.Predicate
- func NewReconciler(mgr manager.Manager, actuator Actuator, configValidator ConfigValidator, ...) reconcile.Reconciler
- type Actuator
- type AddArgs
- type ConfigValidator
Constants ¶
const ( // FinalizerName is the infrastructure controller finalizer. FinalizerName = "extensions.gardener.cloud/infrastructure" // ControllerName is the name of the controller. ControllerName = "infrastructure" )
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add creates a new Infrastructure Controller and adds it to the Manager. and Start it when the Manager is Started.
func ClusterToInfrastructureMapper ¶
func ClusterToInfrastructureMapper(reader client.Reader, predicates []predicate.Predicate) handler.MapFunc
ClusterToInfrastructureMapper returns a mapper that returns requests for Infrastructures 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 an infrastructure reconciler.
func NewReconciler ¶
func NewReconciler(mgr manager.Manager, actuator Actuator, configValidator ConfigValidator, knownCodes map[gardencorev1beta1.ErrorCode]func(string) bool) reconcile.Reconciler
NewReconciler creates a new reconcile.Reconciler that reconciles infrastructure resources of Gardener's `extensions.gardener.cloud` API group.
Types ¶
type Actuator ¶
type Actuator interface {
// Reconcile reconciles the [extensionsv1alpha1.Infrastructure] resource.
//
// Implementations should ensure that required infrastructure resources
// are created or updated to reach the desired state.
Reconcile(context.Context, logr.Logger, *extensionsv1alpha1.Infrastructure, *extensionscontroller.Cluster) error
// Delete is invoked when the [extensionsv1alpha1.Infrastructure]
// resource is deleted.
//
// Implementations should take care of cleaning up any infrastructure
// related resources (e.g. subnets, routers, 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.Infrastructure, *extensionscontroller.Cluster) error
// ForceDelete is invoked when the shoot cluster associated with the
// [extensionsv1alpha1.Infrastructure] 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 (e.g. subnets, routers, etc.), 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.Infrastructure, *extensionscontroller.Cluster) error
// Restore restores the [extensionsv1alpha1.Infrastructure] from a
// previously saved state.
//
// This method is invoked when the shoot cluster associated with the
// [extensionsv1alpha1.Infrastructure] resource is being restored on the
// target seed cluster.
//
// Implementations may use the persisted data in the .status.state field
// for restoring the state, when the shoot is being migrated to a
// different seed cluster.
Restore(context.Context, logr.Logger, *extensionsv1alpha1.Infrastructure, *extensionscontroller.Cluster) error
// Migrate prepares the [extensionsv1alpha1.Infrastructure] resource for
// migration.
//
// This method is invoked when the shoot cluster associated with the
// [extensionsv1alpha1.Infrastructure] resource is being migrated to
// another seed cluster.
//
// Implementations should take care of storing any required state in the
// .status.state field, so that it can later be restored from this
// state.
Migrate(context.Context, logr.Logger, *extensionsv1alpha1.Infrastructure, *extensionscontroller.Cluster) error
}
Actuator acts upon extensionsv1alpha1.Infrastructure resources.
type AddArgs ¶
type AddArgs struct {
// Actuator is an Infrastructure actuator.
Actuator Actuator
// ConfigValidator is an Infrastructure config validator.
ConfigValidator ConfigValidator
// 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
// WatchBuilder defines additional watches on controllers that should be set up.
WatchBuilder extensionscontroller.WatchBuilder
// 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
// KnownCodes is a map of known error codes and their respective error check functions.
KnownCodes map[gardencorev1beta1.ErrorCode]func(string) bool
}
AddArgs are arguments for adding an Infrastructure controller to a manager.
type ConfigValidator ¶ added in v1.31.0
type ConfigValidator interface {
// Validate validates the provider config of the given infrastructure resource with the cloud provider.
// If the returned error list is non-empty, the reconciliation will fail with an error.
// This error will have the error code ERR_CONFIGURATION_PROBLEM, unless there is at least one error in the list
// that has its ErrorType field set to field.ErrorTypeInternal.
Validate(ctx context.Context, infra *extensionsv1alpha1.Infrastructure) field.ErrorList
}
ConfigValidator validates the provider config of infrastructures resource with the cloud provider.