managedresources

package
v1.63.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 27 Imported by: 27

Documentation

Index

Constants

View Source
const (
	// SecretPrefix is the prefix that can be used for secrets referenced by managed resources.
	SecretPrefix = "managedresource-"
	// LabelKeyOrigin is a key for a label on a managed resource with the value 'origin'.
	LabelKeyOrigin = "origin"
	// LabelValueGardener is a value for a label on a managed resource with the value 'gardener'.
	LabelValueGardener = "gardener"
)

Variables

View Source
var (
	// DeleteForSeed is a function alias for deleteWithSecretNamePrefix.
	DeleteForSeed = deleteWithSecretNamePrefix
	// DeleteForShoot is a function alias for deleteWithSecretNamePrefix.
	DeleteForShoot = deleteWithSecretNamePrefix
)
View Source
var IntervalWait = 2 * time.Second

IntervalWait is the interval when waiting for managed resources.

Functions

func CheckIfManagedResourcesExist added in v1.61.0

func CheckIfManagedResourcesExist(ctx context.Context, c client.Client, class *string) (bool, error)

CheckIfManagedResourcesExist checks if some ManagedResources of the given class still exist. If yes it returns true.

func Create added in v1.21.0

func Create(
	ctx context.Context,
	client client.Client,
	namespace, name string,
	labels map[string]string,
	secretNameWithPrefix bool,
	class string,
	data map[string][]byte,
	keepObjects *bool,
	injectedLabels map[string]string,
	forceOverwriteAnnotations *bool,
) error

Create creates a managed resource and its secret with the given name, class, key, and data in the given namespace.

func CreateForSeed added in v1.21.0

func CreateForSeed(ctx context.Context, client client.Client, namespace, name string, keepObjects bool, data map[string][]byte) error

CreateForSeed deploys a ManagedResource CR for the seed's gardener-resource-manager.

func CreateForShoot added in v1.21.0

func CreateForShoot(ctx context.Context, client client.Client, namespace, name, origin string, keepObjects bool, data map[string][]byte) error

CreateForShoot deploys a ManagedResource CR for the shoot's gardener-resource-manager. The origin is used to identify the creator of the managed resource. Gardener acts on resources with "origin=gardener" label. External callers (extension controllers or other components) of this function should provide their own unique origin value.

func CreateFromUnstructured added in v1.21.0

func CreateFromUnstructured(
	ctx context.Context,
	client client.Client,
	namespace, name string,
	secretNameWithPrefix bool,
	class string,
	objs []*unstructured.Unstructured,
	keepObjects bool,
	injectedLabels map[string]string,
) error

CreateFromUnstructured creates a managed resource and its secret with the given name, class, and objects in the given namespace.

func Delete added in v1.21.0

func Delete(ctx context.Context, client client.Client, namespace string, name string, secretNameWithPrefix bool) error

Delete deletes the managed resource and its secret with the given name in the given namespace.

func New added in v1.21.0

func New(client client.Client, namespace, name, class string, keepObjects *bool, labels, injectedLabels map[string]string, forceOverwriteAnnotations *bool) *builder.ManagedResource

New initiates a new ManagedResource object which can be reconciled.

func NewForSeed added in v1.21.0

func NewForSeed(c client.Client, namespace, name string, keepObjects bool) *builder.ManagedResource

NewForSeed constructs a new ManagedResource object for the seed's gardener-resource-manager.

func NewForShoot added in v1.21.0

func NewForShoot(c client.Client, namespace, name, origin string, keepObjects bool) *builder.ManagedResource

NewForShoot constructs a new ManagedResource object for the shoot's gardener-resource-manager. The origin is used to identify the creator of the managed resource. Gardener acts on resources with "origin=gardener" label. External callers (extension controllers or other components) of this function should provide their own unique origin value.

func NewSecret added in v1.21.0

func NewSecret(client client.Client, namespace, name string, data map[string][]byte, secretNameWithPrefix bool) (string, *builder.Secret)

NewSecret initiates a new Secret object which can be reconciled.

func RenderChartAndCreate added in v1.21.0

func RenderChartAndCreate(ctx context.Context, namespace string, name string, secretNameWithPrefix bool, client client.Client, chartRenderer chartrenderer.Interface, chart chart.Interface, values map[string]interface{}, imageVector imagevector.ImageVector, chartNamespace string, version string, withNoCleanupLabel bool, forceOverwriteAnnotations bool) error

RenderChartAndCreate renders a chart and creates a ManagedResource for the gardener-resource-manager out of the results.

func SecretName added in v1.21.0

func SecretName(name string, withPrefix bool) string

SecretName returns the name of a corev1.Secret for the given name of a resourcesv1alpha1.ManagedResource. If <withPrefix> is set then the name will be prefixed with 'managedresource-'.

func SetKeepObjects added in v1.21.0

func SetKeepObjects(ctx context.Context, c client.Writer, namespace, name string, keepObjects bool) error

SetKeepObjects updates the keepObjects field of the managed resource with the given name in the given namespace.

func WaitUntilDeleted added in v1.21.0

func WaitUntilDeleted(ctx context.Context, client client.Client, namespace, name string) error

WaitUntilDeleted waits until the given managed resource is deleted.

func WaitUntilHealthy added in v1.21.0

func WaitUntilHealthy(ctx context.Context, client client.Client, namespace, name string) error

WaitUntilHealthy waits until the given managed resource is healthy.

func WaitUntilListDeleted added in v1.38.0

func WaitUntilListDeleted(ctx context.Context, client client.Client, mrList *resourcesv1alpha1.ManagedResourceList, listOps ...client.ListOption) error

WaitUntilListDeleted waits until the given managed resources are deleted.

Types

type Registry added in v1.13.0

type Registry struct {
	// contains filtered or unexported fields
}

Registry stores objects and their serialized form. It allows to compute a map of all registered objects that can be used as part of a Secret's data which is referenced by a ManagedResource.

func NewRegistry added in v1.13.0

func NewRegistry(scheme *runtime.Scheme, codec serializer.CodecFactory, serializer *json.Serializer) *Registry

NewRegistry returns a new registry for resources. The given scheme, codec, and serializer must know all the resource types that will later be added to the registry.

func (*Registry) Add added in v1.13.0

func (r *Registry) Add(objs ...client.Object) error

Add adds the given object to the registry. It computes a filename based on its type, namespace, and name. It serializes the object to YAML and stores both representations (object and serialization) in the registry.

func (*Registry) AddAllAndSerialize added in v1.13.0

func (r *Registry) AddAllAndSerialize(objects ...client.Object) (map[string][]byte, error)

AddAllAndSerialize calls Add() for all the given objects before calling SerializedObjects().

func (*Registry) AddSerialized added in v1.44.0

func (r *Registry) AddSerialized(filename string, serializationYAML []byte)

AddSerialized adds the provided serialized YAML for the registry. The provided filename will be used as key.

func (*Registry) RegisteredObjects added in v1.13.0

func (r *Registry) RegisteredObjects() map[string]client.Object

RegisteredObjects returns a map whose keys are filenames and whose values are objects.

func (*Registry) SerializedObjects added in v1.13.0

func (r *Registry) SerializedObjects() map[string][]byte

SerializedObjects returns a map whose keys are filenames and whose values are serialized objects.

func (*Registry) String added in v1.13.0

func (r *Registry) String() string

String returns the string representation of the registry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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