controller

package
v1.33.3 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 30 Imported by: 207

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NewGardenDecoder returns a new Garden API decoder.
	NewGardenDecoder = extensions.NewGardenDecoder
	// GetCluster tries to read Gardener's Cluster extension resource in the given namespace.
	GetCluster = extensions.GetCluster
	// CloudProfileFromCluster returns the CloudProfile resource inside the Cluster resource.
	CloudProfileFromCluster = extensions.CloudProfileFromCluster
	// SeedFromCluster returns the Seed resource inside the Cluster resource.
	SeedFromCluster = extensions.SeedFromCluster
	// ShootFromCluster returns the Shoot resource inside the Cluster resource.
	ShootFromCluster = extensions.ShootFromCluster
	// GetShoot tries to read Gardener's Cluster extension resource in the given namespace and return the embedded Shoot resource.
	GetShoot = extensions.GetShoot
	// GetOwnerNameAndID reads the owner DNS name and ID from the owner DNSRecord extension resource in the given namespace.
	GetOwnerNameAndID = extensions.GetOwnerNameAndID
)
View Source
var (

	// AddToScheme adds the Kubernetes and extension scheme to the given scheme.
	AddToScheme = localSchemeBuilder.AddToScheme

	// ExtensionsScheme is the default scheme for extensions, consisting of all Kubernetes built-in
	// schemes (client-go/kubernetes/scheme) and the extensions/v1alpha1 scheme.
	ExtensionsScheme = runtime.NewScheme()
)
View Source
var GetSecretByReference = kutil.GetSecretByReference

GetSecretByReference returns the Secret object matching the given SecretReference.

Functions

func CreateEventLogValues

func CreateEventLogValues(event event.CreateEvent) []interface{}

CreateEventLogValues extracts the log values from the given CreateEvent.

func CreateEventLogger

func CreateEventLogger(log logr.Logger, event event.CreateEvent) logr.Logger

CreateEventLogger creates a Logger with keys and values from the given CreateEvent.

func DeleteAllFinalizers

func DeleteAllFinalizers(ctx context.Context, client client.Client, obj client.Object) error

DeleteAllFinalizers removes all finalizers from the object and issues an update.

func DeleteEventLogValues

func DeleteEventLogValues(event event.DeleteEvent) []interface{}

DeleteEventLogValues extracts the log values from the given DeleteEvent.

func DeleteEventLogger

func DeleteEventLogger(log logr.Logger, event event.DeleteEvent) logr.Logger

DeleteEventLogger creates a Logger with keys and values from the given DeleteEvent.

func GenericEventLogValues

func GenericEventLogValues(event event.GenericEvent) []interface{}

GenericEventLogValues extracts the log values from the given GenericEvent.

func GenericEventLogger

func GenericEventLogger(log logr.Logger, event event.GenericEvent) logr.Logger

GenericEventLogger creates a Logger with keys and values from the given GenericEvent.

func GetControlPlaneReplicas

func GetControlPlaneReplicas(cluster *Cluster, scaledDown bool, wokenUp int) int

GetControlPlaneReplicas returns the woken up replicas for controlplane components of the given Shoot that should only be scaled down at the end of the flow.

func GetObjectByReference added in v1.6.0

func GetObjectByReference(ctx context.Context, c client.Client, ref *autoscalingv1.CrossVersionObjectReference, namespace string, obj client.Object) error

GetObjectByReference gets an object by the given reference, in the given namespace. If the object kind doesn't match the given reference kind this will result in an error.

func GetPodNetwork

func GetPodNetwork(cluster *Cluster) string

GetPodNetwork returns the pod network CIDR of the given Shoot.

func GetReplicas

func GetReplicas(cluster *Cluster, wokenUp int) int

GetReplicas returns the woken up replicas of the given Shoot.

func GetServiceNetwork

func GetServiceNetwork(cluster *Cluster) string

GetServiceNetwork returns the service network CIDR of the given Shoot.

func GetVerticalPodAutoscalerObject

func GetVerticalPodAutoscalerObject() *unstructured.Unstructured

GetVerticalPodAutoscalerObject returns unstructured.Unstructured representing autoscalingv1beta2.VerticalPodAutoscaler

func IsFailed added in v1.5.0

func IsFailed(cluster *Cluster) bool

IsFailed returns true if the embedded shoot is failed, or false otherwise.

func IsHibernated

func IsHibernated(cluster *Cluster) bool

IsHibernated returns true if the shoot is hibernated, or false otherwise.

func IsMigrated added in v1.4.0

func IsMigrated(obj extensionsv1alpha1.Object) bool

IsMigrated checks if an extension object has been migrated

func IsShootFailed added in v1.5.0

func IsShootFailed(shoot *gardencorev1beta1.Shoot) bool

IsShootFailed returns true if the shoot is failed, or false otherwise.

func IsUnmanagedDNSProvider

func IsUnmanagedDNSProvider(cluster *Cluster) bool

IsUnmanagedDNSProvider returns true if the shoot uses an unmanaged DNS provider.

func LastError

func LastError(description string, codes ...gardencorev1beta1.ErrorCode) *gardencorev1beta1.LastError

LastError creates a new LastError from the given parameters.

func LastOperation

LastOperation creates a new LastOperation from the given parameters.

func NewStatusUpdater added in v1.21.0

func NewStatusUpdater(logger logr.Logger) *statusUpdater

NewStatusUpdater returns a new status updater.

func ObjectLogValues added in v1.16.0

func ObjectLogValues(obj client.Object) []interface{}

ObjectLogValues extracts the log values from the given client.Object.

func OperationAnnotationWrapper

func OperationAnnotationWrapper(newObjFunc func() client.Object, reconciler reconcile.Reconciler) reconcile.Reconciler

OperationAnnotationWrapper is a wrapper for an reconciler that removes the Gardener operation annotation before `Reconcile` is called.

This is useful in conjunction with the HasOperationAnnotationPredicate.

func PrefixLogValues

func PrefixLogValues(prefix string, logValues []interface{}) []interface{}

PrefixLogValues prefixes the keys of the given logValues with the given prefix.

func ReconcileErr

func ReconcileErr(err error) (reconcile.Result, error)

ReconcileErr returns a reconcile.Result or an error, depending on whether the error is a RequeueAfterError or not.

func ReconcileErrCause

func ReconcileErrCause(err error) error

ReconcileErrCause returns the cause in case the error is an RequeueAfterError. Otherwise, it returns the input error.

func ReconcileErrCauseOrErr

func ReconcileErrCauseOrErr(err error) error

ReconcileErrCauseOrErr returns the cause of the error or the error if the cause is nil.

func ReconcileError

ReconcileError returns a LastOperation with state error and a LastError with the given description and codes.

func ReconcileSucceeded

ReconcileSucceeded returns a LastOperation with state succeeded at 100 percent and a nil LastError.

func RemoveAnnotation added in v1.4.0

func RemoveAnnotation(ctx context.Context, c client.Client, obj client.Object, annotation string) error

RemoveAnnotation removes an annotation key passed as annotation

func ShouldSkipOperation added in v1.31.4

func ShouldSkipOperation(operationType gardencorev1beta1.LastOperationType, obj extensionsv1alpha1.Object) bool

ShouldSkipOperation checks if the current operation should be skipped depending on the lastOperation of the extension object.

func TryPatch added in v1.12.0

func TryPatch(ctx context.Context, backoff wait.Backoff, c client.Client, obj client.Object, transform func() error) error

TryPatch tries to apply the given transformation function onto the given object, and to patch it afterwards with optimistic locking. It retries the patch with an exponential backoff.

func TryPatchStatus added in v1.12.0

func TryPatchStatus(ctx context.Context, backoff wait.Backoff, c client.Client, obj client.Object, transform func() error) error

TryPatchStatus tries to apply the given transformation function onto the given object, and to patch its status afterwards with optimistic locking. It retries the status patch with an exponential backoff.

func TryUpdate

func TryUpdate(ctx context.Context, backoff wait.Backoff, c client.Client, obj client.Object, transform func() error) error

TryUpdate tries to apply the given transformation function onto the given object, and to update it afterwards. It retries the update with an exponential backoff.

func TryUpdateStatus

func TryUpdateStatus(ctx context.Context, backoff wait.Backoff, c client.Client, obj client.Object, transform func() error) error

TryUpdateStatus tries to apply the given transformation function onto the given object, and to update its status afterwards. It retries the status update with an exponential backoff.

func UnsafeGuessKind

func UnsafeGuessKind(obj runtime.Object) string

UnsafeGuessKind makes an unsafe guess what is the kind of the given object.

The argument to this method _has_ to be a pointer, otherwise it panics.

func UpdateEventLogValues

func UpdateEventLogValues(event event.UpdateEvent) []interface{}

UpdateEventLogValues extracts the log values from the given UpdateEvent.

func UpdateEventLogger

func UpdateEventLogger(log logr.Logger, event event.UpdateEvent) logr.Logger

UpdateEventLogger creates a Logger with keys and values from the given UpdateEvent.

Types

type AddToManagerBuilder

type AddToManagerBuilder []func(manager.Manager) error

AddToManagerBuilder aggregates various AddToManager functions.

func NewAddToManagerBuilder

func NewAddToManagerBuilder(funcs ...func(manager.Manager) error) AddToManagerBuilder

NewAddToManagerBuilder creates a new AddToManagerBuilder and registers the given functions.

func (*AddToManagerBuilder) AddToManager

func (a *AddToManagerBuilder) AddToManager(m manager.Manager) error

AddToManager traverses over all AddToManager-functions of this builder, sequentially applying them. It exits on the first error and returns it.

func (*AddToManagerBuilder) Register

func (a *AddToManagerBuilder) Register(funcs ...func(manager.Manager) error)

Register registers the given functions in this builder.

type ChartRendererFactory

type ChartRendererFactory interface {
	// NewChartRendererForShoot creates a new chartrenderer.Interface for the shoot cluster.
	NewChartRendererForShoot(string) (chartrenderer.Interface, error)
}

ChartRendererFactory creates chartrenderer.Interface to be used by this actuator.

type ChartRendererFactoryFunc

type ChartRendererFactoryFunc func(string) (chartrenderer.Interface, error)

ChartRendererFactoryFunc is a function that satisfies ChartRendererFactory.

func (ChartRendererFactoryFunc) NewChartRendererForShoot

func (f ChartRendererFactoryFunc) NewChartRendererForShoot(version string) (chartrenderer.Interface, error)

NewChartRendererForShoot creates a new chartrenderer.Interface for the shoot cluster.

type Cluster

type Cluster = extensions.Cluster

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

type StatusUpdater added in v1.21.0

type StatusUpdater interface {
	//  InjectClient injects the client into the status updater.
	InjectClient(client.Client)
	// Processing updates the last operation of an extension resource when an operation is started.
	Processing(context.Context, extensionsv1alpha1.Object, gardencorev1beta1.LastOperationType, string) error
	// Error updates the last operation of an extension resource when an operation was erroneous.
	Error(context.Context, extensionsv1alpha1.Object, error, gardencorev1beta1.LastOperationType, string) error
	// Success updates the last operation of an extension resource when an operation was successful.
	Success(context.Context, extensionsv1alpha1.Object, gardencorev1beta1.LastOperationType, string) error
}

StatusUpdater contains functions for updating statuses of extension resources after a controller operation.

type WatchBuilder

type WatchBuilder []func(controller.Controller) error

WatchBuilder holds various functions which add watch controls to the passed Controller.

func NewWatchBuilder

func NewWatchBuilder(funcs ...func(controller.Controller) error) WatchBuilder

NewWatchBuilder creates a new WatchBuilder and registers the given functions.

func (*WatchBuilder) AddToController

func (w *WatchBuilder) AddToController(ctrl controller.Controller) error

AddToController adds the registered watches to the passed controller.

func (*WatchBuilder) Register

func (w *WatchBuilder) Register(funcs ...func(controller.Controller) error)

Register adds a function which add watch controls to the passed Controller to the WatchBuilder.

Directories

Path Synopsis
genericactuator/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
cmd
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
genericactuator/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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