extensions

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 26 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TimeNow = time.Now

TimeNow returns the current time. Exposed for testing.

Functions

func AnnotateObjectWithOperation added in v1.25.0

func AnnotateObjectWithOperation(ctx context.Context, w client.Writer, obj client.Object, operation string) error

AnnotateObjectWithOperation annotates the object with the provided operation annotation value.

func CloudProfileFromCluster

func CloudProfileFromCluster(decoder runtime.Decoder, cluster *extensionsv1alpha1.Cluster) (*gardencorev1beta1.CloudProfile, error)

CloudProfileFromCluster returns the CloudProfile resource inside the Cluster resource.

func DeleteExtensionObject added in v1.25.0

func DeleteExtensionObject(
	ctx context.Context,
	c client.Writer,
	obj extensionsv1alpha1.Object,
	deleteOpts ...client.DeleteOption,
) error

DeleteExtensionObject deletes a given extension object. Passed objects are expected to be filled with the latest state the controller/component observed/retrieved, but at least namespace and name.

func DeleteExtensionObjects added in v1.25.0

func DeleteExtensionObjects(
	ctx context.Context,
	c client.Client,
	listObj client.ObjectList,
	namespace string,
	predicateFunc func(obj extensionsv1alpha1.Object) bool,
	deleteOpts ...client.DeleteOption,
) error

DeleteExtensionObjects lists all extension objects and loops over them. It executes the given predicateFunc for each of them, and if it evaluates to true then the object will be deleted.

func GetOwnerNameAndID added in v1.33.0

func GetOwnerNameAndID(ctx context.Context, c client.Client, namespace, shootName string) (string, string, error)

GetOwnerNameAndID reads the owner domain name and ID from the owner DNSRecord extension resource in the given namespace. If the owner DNSRecord resource is not found, it returns empty strings.

func GetShoot

func GetShoot(ctx context.Context, c client.Client, namespace string) (*gardencorev1beta1.Shoot, error)

GetShoot tries to read Gardener's Cluster extension resource in the given namespace and return the embedded Shoot resource.

func Id added in v1.21.0

func Id(extensionKind, extensionType string) string

Id returns an identifier for the given extension kind/type.

func MigrateExtensionObject added in v1.25.0

func MigrateExtensionObject(
	ctx context.Context,
	c client.Writer,
	obj extensionsv1alpha1.Object,
) error

MigrateExtensionObject adds the migrate operation annotation to the extension object. Passed objects are expected to be filled with the latest state the controller/component observed/retrieved, but at least namespace and name.

func MigrateExtensionObjects added in v1.25.0

func MigrateExtensionObjects(
	ctx context.Context,
	c client.Client,
	listObj client.ObjectList,
	namespace string,
) error

MigrateExtensionObjects lists all extension objects of a given kind and annotates them with the Migrate operation.

func NewGardenDecoder

func NewGardenDecoder() runtime.Decoder

NewGardenDecoder returns a new Garden API decoder.

func RestoreExtensionObjectState added in v1.21.0

func RestoreExtensionObjectState(
	ctx context.Context,
	c client.Client,
	shootState *gardencorev1alpha1.ShootState,
	extensionObj extensionsv1alpha1.Object,
	kind string,
) error

RestoreExtensionObjectState restores the status.state field of the extension objects and deploys any required objects from the provided shoot state

func RestoreExtensionWithDeployFunction added in v1.21.0

func RestoreExtensionWithDeployFunction(
	ctx context.Context,
	c client.Client,
	shootState *gardencorev1alpha1.ShootState,
	kind string,
	deployFunc func(ctx context.Context, operationAnnotation string) (extensionsv1alpha1.Object, error),
) error

RestoreExtensionWithDeployFunction deploys the extension object with the passed in deployFunc and sets its operation annotation to wait-for-state. It then restores the state of the extension object from the ShootState, creates any required state object and sets the operation annotation to restore.

func SeedFromCluster

func SeedFromCluster(decoder runtime.Decoder, cluster *extensionsv1alpha1.Cluster) (*gardencorev1beta1.Seed, error)

SeedFromCluster returns the Seed resource inside the Cluster resource.

func ShootFromCluster

func ShootFromCluster(decoder runtime.Decoder, cluster *extensionsv1alpha1.Cluster) (*gardencorev1beta1.Shoot, error)

ShootFromCluster returns the Shoot resource inside the Cluster resource.

func SyncClusterResourceToSeed added in v1.21.0

func SyncClusterResourceToSeed(
	ctx context.Context,
	c client.Client,
	clusterName string,
	shoot *gardencorev1beta1.Shoot,
	cloudProfile *gardencorev1beta1.CloudProfile,
	seed *gardencorev1beta1.Seed,
) error

SyncClusterResourceToSeed creates or updates the `extensions.gardener.cloud/v1alpha1.Cluster` resource in the seed cluster by adding the shoot, seed, and cloudprofile specification.

func WaitUntilExtensionObjectDeleted added in v1.25.0

func WaitUntilExtensionObjectDeleted(
	ctx context.Context,
	c client.Client,
	logger logrus.FieldLogger,
	obj extensionsv1alpha1.Object,
	kind string,
	interval time.Duration,
	timeout time.Duration,
) error

WaitUntilExtensionObjectDeleted waits until an extension oject is deleted from the system. Passed objects are expected to be filled with the latest state the controller/component observed/retrieved, but at least namespace and name.

func WaitUntilExtensionObjectMigrated added in v1.25.0

func WaitUntilExtensionObjectMigrated(
	ctx context.Context,
	c client.Client,
	obj extensionsv1alpha1.Object,
	interval time.Duration,
	timeout time.Duration,
) error

WaitUntilExtensionObjectMigrated waits until the migrate operation for the extension object is successful. Passed objects are expected to be filled with the latest state the controller/component observed/retrieved, but at least namespace and name.

func WaitUntilExtensionObjectReady added in v1.25.0

func WaitUntilExtensionObjectReady(
	ctx context.Context,
	c client.Client,
	logger logrus.FieldLogger,
	obj extensionsv1alpha1.Object,
	kind string,
	interval time.Duration,
	severeThreshold time.Duration,
	timeout time.Duration,
	postReadyFunc func() error,
) error

WaitUntilExtensionObjectReady waits until the given extension object has become ready. Passed objects are expected to be filled with the latest state the controller/component applied/observed/retrieved, but at least namespace and name.

func WaitUntilExtensionObjectsDeleted added in v1.25.0

func WaitUntilExtensionObjectsDeleted(
	ctx context.Context,
	c client.Client,
	logger logrus.FieldLogger,
	listObj client.ObjectList,
	kind string,
	namespace string,
	interval time.Duration,
	timeout time.Duration,
	predicateFunc func(obj extensionsv1alpha1.Object) bool,
) error

WaitUntilExtensionObjectsDeleted lists all extension objects and loops over them. It executes the given predicateFunc for each of them, and if it evaluates to true, then it waits for the object to be deleted. If the component needs to wait for a given subset of all extension objects to be deleted (e.g. after deleting unwanted objects), it should pass a predicateFunc that filters objects to wait for by name.

func WaitUntilExtensionObjectsMigrated added in v1.25.0

func WaitUntilExtensionObjectsMigrated(
	ctx context.Context,
	c client.Client,
	listObj client.ObjectList,
	namespace string,
	interval time.Duration,
	timeout time.Duration,
) error

WaitUntilExtensionObjectsMigrated lists all extension objects of a given kind and waits until they are migrated.

func WaitUntilObjectReadyWithHealthFunction added in v1.21.0

func WaitUntilObjectReadyWithHealthFunction(
	ctx context.Context,
	c client.Client,
	logger logrus.FieldLogger,
	healthFunc health.Func,
	obj client.Object,
	kind string,
	interval time.Duration,
	severeThreshold time.Duration,
	timeout time.Duration,
	postReadyFunc func() error,
) error

WaitUntilObjectReadyWithHealthFunction waits until the given object has become ready. It takes the health check function that should be executed. Passed objects are expected to be filled with the latest state the controller/component observed/retrieved, but at least namespace and name.

Types

type Cluster

type Cluster struct {
	ObjectMeta   metav1.ObjectMeta
	CloudProfile *gardencorev1beta1.CloudProfile
	Seed         *gardencorev1beta1.Seed
	Shoot        *gardencorev1beta1.Shoot
}

Cluster contains the decoded resources of Gardener's extension Cluster resource.

func GetCluster

func GetCluster(ctx context.Context, c client.Client, namespace string) (*Cluster, error)

GetCluster tries to read Gardener's Cluster extension resource in the given namespace.

Jump to

Keyboard shortcuts

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