Documentation
¶
Index ¶
- Constants
- Variables
- func AddAllRunnables(mgr manager.Manager, runnables ...manager.Runnable) error
- func AddFinalizers(ctx context.Context, writer client.Writer, obj client.Object, ...) error
- func AddTasks(annotations map[string]string, tasksToAdd ...string)
- func CreateOrGetAndMergePatch(ctx context.Context, c client.Client, obj client.Object, ...) (controllerutil.OperationResult, error)
- func CreateOrGetAndStrategicMergePatch(ctx context.Context, c client.Client, obj client.Object, ...) (controllerutil.OperationResult, error)
- func DetermineBackupBucketAssociations(ctx context.Context, c client.Client, seedName string) ([]string, error)
- func DetermineControllerInstallationAssociations(ctx context.Context, c client.Client, seedName string) ([]string, error)
- func DetermineCredentialsBindingAssociations(ctx context.Context, c client.Client, quota *gardencorev1beta1.Quota) ([]string, error)
- func DetermineSecretBindingAssociations(ctx context.Context, c client.Client, quota *gardencorev1beta1.Quota) ([]string, error)
- func DetermineShootsAssociatedTo(ctx context.Context, gardenClient client.Reader, obj any) ([]string, error)
- func GetAndCreateOrMergePatch(ctx context.Context, c client.Client, obj client.Object, ...) (controllerutil.OperationResult, error)
- func GetAndCreateOrStrategicMergePatch(ctx context.Context, c client.Client, obj client.Object, ...) (controllerutil.OperationResult, error)
- func GetChildReconciliationContext(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)
- func GetControllerInstallationNames(controllerInstallations []gardencorev1beta1.ControllerInstallation) []string
- func GetMainReconciliationContext(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)
- func GetTasks(annotations map[string]string) []string
- func HasTask(annotations map[string]string, task string) bool
- func RemoveAllFinalizers(ctx context.Context, writer client.Writer, obj client.Object) error
- func RemoveAllTasks(annotations map[string]string)
- func RemoveFinalizers(ctx context.Context, writer client.Writer, obj client.Object, ...) error
- func RemoveTasks(annotations map[string]string, tasksToRemove ...string)
- func TypedCreateOrUpdate(ctx context.Context, c client.Client, scheme *runtime.Scheme, ...) (controllerutil.OperationResult, error)
- type ControlledRunner
- type MergeFromOption
- type PatchOption
- type PatchOptions
- type SkipEmptyPatch
Constants ¶
const DefaultReconciliationTimeout = 3 * time.Minute
DefaultReconciliationTimeout is the default timeout for the context of reconciliation functions.
Variables ¶
var EnqueueAnonymously = handler.EnqueueRequestsFromMapFunc(func(_ context.Context, _ client.Object) []reconcile.Request { return []reconcile.Request{{}} })
EnqueueAnonymously is a handler.EventHandler which enqueues a reconcile.Request without any namespace/name data.
var EnqueueOnce = source.Func(func(_ context.Context, _ handler.EventHandler, q workqueue.RateLimitingInterface, _ ...predicate.Predicate) error { q.Add(reconcile.Request{}) return nil })
EnqueueOnce is a source.Source that simply triggers the reconciler once by directly enqueueing an empty reconcile.Request.
var HandleOnce = source.Func(func(ctx context.Context, handler handler.EventHandler, queue workqueue.RateLimitingInterface, _ ...predicate.Predicate) error { handler.Create(ctx, event.CreateEvent{}, queue) return nil })
HandleOnce is a source.Source that simply triggers the reconciler once by calling 'Create' at the event handler with an empty event.CreateEvent.
Functions ¶
func AddAllRunnables ¶ added in v1.57.0
AddAllRunnables loops over the provided runnables and adds them to the manager. It returns an error immediately if adding fails.
func AddFinalizers ¶ added in v1.52.0
func AddFinalizers(ctx context.Context, writer client.Writer, obj client.Object, finalizers ...string) error
AddFinalizers ensures that the given finalizer is present in the given object and optimistic locking. If it is not set, it adds it and issues a patch. Note that this is done with a regular merge-patch since strategic merge-patches do not work with custom resources, see https://github.com/kubernetes/kubernetes/issues/105146.
func CreateOrGetAndMergePatch ¶ added in v1.25.0
func CreateOrGetAndMergePatch(ctx context.Context, c client.Client, obj client.Object, f controllerutil.MutateFn, opts ...PatchOption) (controllerutil.OperationResult, error)
CreateOrGetAndMergePatch creates or gets and patches (using a merge patch) the given object in the Kubernetes cluster.
The MutateFn is called regardless of creating or patching an object.
It returns the executed operation and an error.
func CreateOrGetAndStrategicMergePatch ¶ added in v1.25.0
func CreateOrGetAndStrategicMergePatch(ctx context.Context, c client.Client, obj client.Object, f controllerutil.MutateFn, opts ...PatchOption) (controllerutil.OperationResult, error)
CreateOrGetAndStrategicMergePatch creates or gets and patches (using a strategic merge patch) the given object in the Kubernetes cluster.
The MutateFn is called regardless of creating or patching an object.
It returns the executed operation and an error.
func DetermineBackupBucketAssociations ¶
func DetermineBackupBucketAssociations(ctx context.Context, c client.Client, seedName string) ([]string, error)
DetermineBackupBucketAssociations determine the BackupBucket resources which are associated to seed with name <seedName>
func DetermineControllerInstallationAssociations ¶
func DetermineControllerInstallationAssociations(ctx context.Context, c client.Client, seedName string) ([]string, error)
DetermineControllerInstallationAssociations determine the ControllerInstallation resources which are associated to seed with name <seedName>
func DetermineCredentialsBindingAssociations ¶ added in v1.98.0
func DetermineCredentialsBindingAssociations(ctx context.Context, c client.Client, quota *gardencorev1beta1.Quota) ([]string, error)
DetermineCredentialsBindingAssociations determines the CredentialsBinding resources which are associated to given Quota <obj>.
func DetermineSecretBindingAssociations ¶
func DetermineSecretBindingAssociations(ctx context.Context, c client.Client, quota *gardencorev1beta1.Quota) ([]string, error)
DetermineSecretBindingAssociations determines the SecretBinding resources which are associated to given Quota <obj>.
func DetermineShootsAssociatedTo ¶
func DetermineShootsAssociatedTo(ctx context.Context, gardenClient client.Reader, obj any) ([]string, error)
DetermineShootsAssociatedTo gets a <shootLister> to determine the Shoots resources which are associated to given <obj> (either a CloudProfile, Seed, Secretbinding, CredentialsBinding or a ExposureClass object).
func GetAndCreateOrMergePatch ¶ added in v1.23.0
func GetAndCreateOrMergePatch(ctx context.Context, c client.Client, obj client.Object, f controllerutil.MutateFn, opts ...PatchOption) (controllerutil.OperationResult, error)
GetAndCreateOrMergePatch is similar to controllerutil.CreateOrPatch, but does not care about the object's status section. It reads the object from the client, reconciles the desired state with the existing state using the given MutateFn and creates or patches the object (using a merge patch) accordingly.
The MutateFn is called regardless of creating or updating an object.
It returns the executed operation and an error.
func GetAndCreateOrStrategicMergePatch ¶ added in v1.23.0
func GetAndCreateOrStrategicMergePatch(ctx context.Context, c client.Client, obj client.Object, f controllerutil.MutateFn, opts ...PatchOption) (controllerutil.OperationResult, error)
GetAndCreateOrStrategicMergePatch is similar to controllerutil.CreateOrPatch, but does not care about the object's status section. It reads the object from the client, reconciles the desired state with the existing state using the given MutateFn and creates or patches the object (using a strategic merge patch) accordingly.
The MutateFn is called regardless of creating or updating an object.
It returns the executed operation and an error.
func GetChildReconciliationContext ¶ added in v1.68.0
func GetChildReconciliationContext(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)
GetChildReconciliationContext returns context with timeout for the controller's secondary client. The resulting context has a timeout equal to half of the timeout for the controller's main client.
func GetControllerInstallationNames ¶ added in v1.78.0
func GetControllerInstallationNames(controllerInstallations []gardencorev1beta1.ControllerInstallation) []string
GetControllerInstallationNames returns a list of the names of the controllerinstallations passed.
func GetMainReconciliationContext ¶ added in v1.68.0
func GetMainReconciliationContext(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)
GetMainReconciliationContext returns a context with timeout for the controller's main client. The resulting context has a timeout equal to the timeout passed in the argument but not more than DefaultReconciliationTimeout.
func RemoveAllFinalizers ¶ added in v1.27.0
RemoveAllFinalizers ensures that the given object has no finalizers with exponential backoff. If any finalizers are set, it removes them and issues a patch.
func RemoveAllTasks ¶
RemoveAllTasks removes the ShootTasks annotation from the passed map.
func RemoveFinalizers ¶ added in v1.52.0
func RemoveFinalizers(ctx context.Context, writer client.Writer, obj client.Object, finalizers ...string) error
RemoveFinalizers ensures that the given finalizer is not present anymore in the given object and optimistic locking. If it is set, it removes it and issues a patch. Note that this is done with a regular merge-patch since strategic merge-patches do not work with custom resources, see https://github.com/kubernetes/kubernetes/issues/105146.
func RemoveTasks ¶ added in v1.3.1
RemoveTasks removes tasks from the ShootTasks annotation of the passed map.
func TypedCreateOrUpdate ¶ added in v1.34.0
func TypedCreateOrUpdate(ctx context.Context, c client.Client, scheme *runtime.Scheme, obj *unstructured.Unstructured, alwaysUpdate bool, mutate func() error) (controllerutil.OperationResult, error)
TypedCreateOrUpdate is like controllerutil.CreateOrUpdate, it retrieves the current state of the object from the API server, applies the given mutate func and creates or updates it afterwards. In contrast to controllerutil.CreateOrUpdate it tries to create a new typed object of obj's kind (using the provided scheme) to make typed Get requests in order to leverage the client's cache.
Types ¶
type ControlledRunner ¶ added in v1.57.0
type ControlledRunner struct { // Manager is the controller-runtime manager. Manager manager.Manager // BootstrapRunnables are the runnables that are responsible for bootstrapping tasks. They will be started // sequentially in the provided order. BootstrapRunnables []manager.Runnable // ActualRunnables are the runnables that are responsible for the actual tasks of the controller. They will be added // sequentially in the provided order, however they will be started immediately if the manager is already started. ActualRunnables []manager.Runnable }
ControlledRunner is a Runnable for the controller-runtime manager which can be used to control complex start-up sequences of controllers. It allows to first run a set of bootstrap runnables before adding the actual runnables to the manager. When the manager is started, this runner first runs all bootstrapping runnables before adding the actual runnables to the manager.
type MergeFromOption ¶ added in v1.73.0
type MergeFromOption struct {
client.MergeFromOption
}
MergeFromOption is a patch option that allows to use a `client.MergeFromOption`.
func (MergeFromOption) ApplyToPatchOptions ¶ added in v1.73.0
func (m MergeFromOption) ApplyToPatchOptions(in *PatchOptions)
ApplyToPatchOptions applies the `MergeFromOption`s to the given PatchOption.
type PatchOption ¶ added in v1.73.0
type PatchOption interface { // ApplyToPatchOptions applies this configuration to the given patch options. ApplyToPatchOptions(*PatchOptions) }
PatchOption can be used to define options used for calculating and sending patch requests.
type PatchOptions ¶ added in v1.73.0
type PatchOptions struct {
// contains filtered or unexported fields
}
PatchOptions contains several options used for calculating and sending patch requests.
type SkipEmptyPatch ¶ added in v1.73.0
type SkipEmptyPatch struct{}
SkipEmptyPatch is a patch option that causes empty patches not being sent.
func (SkipEmptyPatch) ApplyToPatchOptions ¶ added in v1.73.0
func (SkipEmptyPatch) ApplyToPatchOptions(in *PatchOptions)
ApplyToPatchOptions applies the skipEmptyPatch option to the given PatchOption.