helper

package
v2.20.16 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CCMMigrationCompleted

func CCMMigrationCompleted(cluster *kubermaticv1.Cluster) bool

func ClusterReconcileWrapper

func ClusterReconcileWrapper(
	ctx context.Context,
	client ctrlruntimeclient.Client,
	workerName string,
	cluster *kubermaticv1.Cluster,
	versions kubermatic.Versions,
	conditionType kubermaticv1.ClusterConditionType,
	reconcile func() (*reconcile.Result, error),
) (*reconcile.Result, error)

ClusterReconcileWrapper is a wrapper that should be used around any cluster reconciliaton. It:

  • Checks if the cluster is paused
  • Checks if the worker-name matches
  • Sets the ReconcileSuccess condition for the controller by fetching the current Cluster object and patching its status.

func ClusterReconciliationSuccessful

func ClusterReconciliationSuccessful(cluster *kubermaticv1.Cluster, versions kubermatic.Versions, ignoreKubermaticVersion bool) (missingConditions []kubermaticv1.ClusterConditionType, success bool)

ClusterReconciliationSuccessful checks if cluster has all conditions that are required for it to be healthy. ignoreKubermaticVersion should only be set in tests.

func GetHealthStatus

func GetHealthStatus(status kubermaticv1.HealthStatus, cluster *kubermaticv1.Cluster, versions kubermatic.Versions) kubermaticv1.HealthStatus

We assume that the cluster is still provisioning if it was not initialized fully at least once.

func HasProvider

func HasProvider(p *kubermaticv1.Preset, providerType kubermaticv1.ProviderType) (bool, reflect.Value)

func IsClusterInitialized

func IsClusterInitialized(cluster *kubermaticv1.Cluster, versions kubermatic.Versions) bool

func IsProviderEnabled

func IsProviderEnabled(p *kubermaticv1.Preset, provider kubermaticv1.ProviderType) bool

func NeedCCMMigration

func NeedCCMMigration(cluster *kubermaticv1.Cluster) bool

func OverrideProvider

func OverrideProvider(p *kubermaticv1.Preset, providerType kubermaticv1.ProviderType, newPreset *kubermaticv1.Preset) *kubermaticv1.Preset

func RemoveProvider

func RemoveProvider(p *kubermaticv1.Preset, providerType kubermaticv1.ProviderType) *kubermaticv1.Preset

func SetClusterCondition

func SetClusterCondition(
	c *kubermaticv1.Cluster,
	v kubermatic.Versions,
	conditionType kubermaticv1.ClusterConditionType,
	status corev1.ConditionStatus,
	reason string,
	message string,
)

SetClusterCondition sets a condition on the given cluster using the provided type, status, reason and message. It also adds the Kubermatic version and timestamps.

func SetProviderEnabled

func SetProviderEnabled(p *kubermaticv1.Preset, providerType kubermaticv1.ProviderType, enabled bool)

func UpdateClusterStatus added in v2.20.0

func UpdateClusterStatus(ctx context.Context, client ctrlruntimeclient.Client, cluster *kubermaticv1.Cluster, patch ClusterPatchFunc) error

UpdateClusterStatus will attempt to patch the cluster status of the given cluster.

func Validate

func Validate(p *kubermaticv1.Preset, providerType kubermaticv1.ProviderType) error

Types

type ClusterPatchFunc added in v2.20.0

type ClusterPatchFunc func(cluster *kubermaticv1.Cluster)

Jump to

Keyboard shortcuts

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