util

package
v2.23.18 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 13 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.

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