Documentation ¶
Index ¶
- Constants
- Variables
- func CheckIfManagedResourcesExist(ctx context.Context, c client.Client, class *string) (bool, error)
- func Create(ctx context.Context, client client.Client, namespace, name string, ...) error
- func CreateForSeed(ctx context.Context, client client.Client, namespace, name string, ...) error
- func CreateForSeedWithLabels(ctx context.Context, client client.Client, namespace, name string, ...) error
- func CreateForShoot(ctx context.Context, client client.Client, namespace, name, origin string, ...) error
- func CreateForShootWithLabels(ctx context.Context, client client.Client, namespace, name, origin string, ...) error
- func CreateFromUnstructured(ctx context.Context, client client.Client, namespace, name string, ...) error
- func Delete(ctx context.Context, c client.Client, namespace string, name string, ...) error
- func New(client client.Client, namespace, name, class string, keepObjects *bool, ...) *builder.ManagedResource
- func NewForSeed(c client.Client, namespace, name string, keepObjects bool) *builder.ManagedResource
- func NewForShoot(c client.Client, namespace, name, origin string, keepObjects bool) *builder.ManagedResource
- func NewSecret(client client.Client, namespace, name string, data map[string][]byte, ...) (string, *builder.Secret)
- func RenderChartAndCreate(ctx context.Context, namespace string, name string, secretNameWithPrefix bool, ...) error
- func SetKeepObjects(ctx context.Context, c client.Writer, namespace, name string, keepObjects bool) error
- func Update(ctx context.Context, client client.Client, namespace, name string, ...) error
- func WaitUntilDeleted(ctx context.Context, client client.Client, namespace, name string) error
- func WaitUntilHealthy(ctx context.Context, client client.Client, namespace, name string) error
- func WaitUntilHealthyAndNotProgressing(ctx context.Context, client client.Client, namespace, name string) error
- func WaitUntilListDeleted(ctx context.Context, client client.Client, ...) error
- type Registry
- func (r *Registry) Add(objs ...client.Object) error
- func (r *Registry) AddAllAndSerialize(objects ...client.Object) (map[string][]byte, error)
- func (r *Registry) AddSerialized(filename string, serializationYAML []byte)
- func (r *Registry) RegisteredObjects() map[string]client.Object
- func (r *Registry) SerializedObjects() map[string][]byte
- func (r *Registry) String() string
Constants ¶
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 ¶
var ( // DeleteForSeed is a function alias for deleteWithSecretNamePrefix. DeleteForSeed = deleteWithSecretNamePrefix // DeleteForShoot is a function alias for deleteWithSecretNamePrefix. DeleteForShoot = deleteWithSecretNamePrefix )
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 CreateForSeedWithLabels ¶ added in v1.91.0
func CreateForSeedWithLabels(ctx context.Context, client client.Client, namespace, name string, keepObjects bool, labels map[string]string, data map[string][]byte) error
CreateForSeedWithLabels deploys a ManagedResource CR for the seed's gardener-resource-manager and allows providing additional labels.
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 CreateForShootWithLabels ¶ added in v1.91.0
func CreateForShootWithLabels(ctx context.Context, client client.Client, namespace, name, origin string, keepObjects bool, labels map[string]string, data map[string][]byte) error
CreateForShootWithLabels 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. This function allows providing additional labels.
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, c client.Client, namespace string, name string, secretNameWithPrefix bool) error
Delete deletes the managed resource and its secrets 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
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 immutable 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 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 Update ¶ added in v1.90.0
func Update( 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
Update updates a managed resource and its secret with the given name, class, key, and data in the given namespace.
func WaitUntilDeleted ¶ added in v1.21.0
WaitUntilDeleted waits until the given managed resource is deleted.
func WaitUntilHealthy ¶ added in v1.21.0
WaitUntilHealthy waits until the given managed resource is healthy.
func WaitUntilHealthyAndNotProgressing ¶ added in v1.80.0
func WaitUntilHealthyAndNotProgressing(ctx context.Context, client client.Client, namespace, name string) error
WaitUntilHealthyAndNotProgressing waits until the given managed resource is healthy and not progressing.
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 *jsonserializer.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
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
AddAllAndSerialize calls Add() for all the given objects before calling SerializedObjects().
func (*Registry) AddSerialized ¶ added in v1.44.0
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
RegisteredObjects returns a map whose keys are filenames and whose values are objects.
func (*Registry) SerializedObjects ¶ added in v1.13.0
SerializedObjects returns a map whose keys are filenames and whose values are serialized objects.