util

package
v2.14.12+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

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.EnqueueRequestsFromMapFunc

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.EnqueueRequestsFromMapFunc

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.EnqueueRequestsFromMapFunc

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.EnqueueRequestsFromMapFunc

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 IsCacheNotStarted

func IsCacheNotStarted(err error) bool

IsCacheNotStarted returns true if the given error is not nil and an instance of cache.ErrCacheNotStarted.

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