extensions

package
v1.24.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 28 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 AnnotateExtensionObjectWithOperation added in v1.21.0

func AnnotateExtensionObjectWithOperation(ctx context.Context, w client.Writer, extensionObj extensionsv1alpha1.Object, operation string) error

AnnotateExtensionObjectWithOperation annotates the extension resource 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 DeleteExtensionCR added in v1.21.0

func DeleteExtensionCR(
	ctx context.Context,
	c client.Client,
	newObjFunc func() extensionsv1alpha1.Object,
	namespace string,
	name string,
	deleteOpts ...client.DeleteOption,
) error

DeleteExtensionCR deletes an extension resource.

func DeleteExtensionCRs added in v1.21.0

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

DeleteExtensionCRs lists all extension resources and loops over them. It executes the given <predicateFunc> for each of them, and if it evaluates to true then the resource will be deleted.

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 MigrateExtensionCR added in v1.21.0

func MigrateExtensionCR(
	ctx context.Context,
	c client.Client,
	newObjFunc func() extensionsv1alpha1.Object,
	namespace string,
	name string,
) error

MigrateExtensionCR adds the migrate operation annotation to the extension CR.

func MigrateExtensionCRs added in v1.21.0

func MigrateExtensionCRs(
	ctx context.Context,
	c client.Client,
	listObj client.ObjectList,
	newObjFunc func() extensionsv1alpha1.Object,
	namespace string,
) error

MigrateExtensionCRs lists all extension resources 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,
	namespace string,
	extensionObj extensionsv1alpha1.Object,
	resourceKind string,
) error

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

func RestoreExtensionWithDeployFunction added in v1.21.0

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

RestoreExtensionWithDeployFunction deploys the extension resource with the passed in deployFunc and sets its operation annotation to wait-for-state. It then restores the state of the extension resource from the ShootState, creates any required state resources 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 WaitUntilExtensionCRDeleted added in v1.21.0

func WaitUntilExtensionCRDeleted(
	ctx context.Context,
	c client.Client,
	logger logrus.FieldLogger,
	newObjFunc func() extensionsv1alpha1.Object,
	kind string,
	namespace string,
	name string,
	interval time.Duration,
	timeout time.Duration,
) error

WaitUntilExtensionCRDeleted waits until an extension resource is deleted from the system.

func WaitUntilExtensionCRMigrated added in v1.21.0

func WaitUntilExtensionCRMigrated(
	ctx context.Context,
	c client.Client,
	newObjFunc func() extensionsv1alpha1.Object,
	namespace string,
	name string,
	interval time.Duration,
	timeout time.Duration,
) error

WaitUntilExtensionCRMigrated waits until the migrate operation for the extension resource is successful.

func WaitUntilExtensionCRReady added in v1.21.0

func WaitUntilExtensionCRReady(
	ctx context.Context,
	c client.Client,
	logger logrus.FieldLogger,
	newObjFunc func() client.Object,
	kind string,
	namespace string,
	name string,
	interval time.Duration,
	severeThreshold time.Duration,
	timeout time.Duration,
	postReadyFunc func(client.Object) error,
) error

WaitUntilExtensionCRReady waits until the given extension resource has become ready.

func WaitUntilExtensionCRsDeleted added in v1.21.0

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

WaitUntilExtensionCRsDeleted lists all extension resources and loops over them. It executes the given <predicateFunc> for each of them, and if it evaluates to true then it waits for the resource to be deleted.

func WaitUntilExtensionCRsMigrated added in v1.21.0

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

WaitUntilExtensionCRsMigrated lists all extension resources 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,
	newObjFunc func() client.Object,
	kind string,
	namespace string,
	name string,
	interval time.Duration,
	severeThreshold time.Duration,
	timeout time.Duration,
	postReadyFunc func(client.Object) error,
) error

WaitUntilObjectReadyWithHealthFunction waits until the given resource has become ready. It takes the health check function that should be executed.

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