util

package
v2.21.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package util contains helpers for building controllers. It does not contain any controllers by itself.

Index

Constants

View Source
const (
	CreateOperation = "create"
	UpdateOperation = "update"
	DeleteOperation = "delete"
)

Variables

This section is empty.

Functions

func ClusterAvailableForReconciling

func ClusterAvailableForReconciling(ctx context.Context, client ctrlruntimeclient.Client, cluster *kubermaticv1.Cluster, concurrencyLimit int) (bool, error)

ClusterAvailableForReconciling returns true if the given cluster can be reconciled. This is true if the cluster does not yet have the SeedResourcesUpToDate condition or if the concurrency limit of the controller is not yet reached. This ensures that not too many cluster updates are running at the same time, but also makes sure that un-UpToDate clusters will continue to be reconciled.

func ConcurrencyLimitReached

func ConcurrencyLimitReached(ctx context.Context, client ctrlruntimeclient.Client, limit int) (bool, error)

ConcurrencyLimitReached checks all the clusters inside the seed cluster and checks for the SeedResourcesUpToDate condition. Returns true if the number of clusters without this condition is equal or larger than the given limit.

func EnqueueClusterForNamespacedObject

func EnqueueClusterForNamespacedObject(client ctrlruntimeclient.Client) handler.EventHandler

EnqueueClusterForNamespacedObject enqueues the cluster that owns a namespaced object, if any It is used by various controllers to react to changes in the resources in the cluster namespace.

func EnqueueClusterForNamespacedObjectWithSeedName

func EnqueueClusterForNamespacedObjectWithSeedName(client ctrlruntimeclient.Client, seedName string, clusterSelector labels.Selector) handler.EventHandler

EnqueueClusterForNamespacedObjectWithSeedName enqueues the cluster that owns a namespaced object, if any. The seedName is put into the namespace field It is used by various controllers to react to changes in the resources in the cluster namespace.

func EnqueueClusterScopedObjectWithSeedName

func EnqueueClusterScopedObjectWithSeedName(seedName string) handler.EventHandler

EnqueueClusterScopedObjectWithSeedName enqueues a cluster-scoped object with the seedName as namespace. If it gets an object with a non-empty name, it will log an error and not enqueue anything.

func EnqueueConst

func EnqueueConst(queueKey string) handler.EventHandler

EnqueueConst enqueues a constant. It is meant for controllers that don't have a parent object they could enc and instead reconcile everything at once. The queueKey will be defaulted if empty.

func EnqueueObjectWithOperation added in v2.20.0

func EnqueueObjectWithOperation() handler.EventHandler

EnqueueObjectWithOperation enqueues a the namespaced name for any resource. It puts the current operation (create, update, delete) as the namespace and "namespace/name" of the object into the name of the reconcile request.

func EnqueueProjectForCluster added in v2.21.0

func EnqueueProjectForCluster() handler.EventHandler

EnqueueProjectForCluster returns an event handler that creates a reconcile request for the project of a cluster, based on the ProjectIDLabelKey label.

func RemoveOldApplicationInstallationCRD added in v2.21.0

func RemoveOldApplicationInstallationCRD(ctx context.Context, client ctrlruntimeclient.Client) error

RemoveOldApplicationInstallationCRD handles deletion of ApplicationInstallations CRD if the existing CRD has scope set to `Cluster`. This action is super safe since at the time of writing this method this feature has not been rolled out. We can just delete the CRD and install the new one. TODO: This should be removed after KKP 2.21 release.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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