object

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanErr added in v0.10.0

func CleanErr(err error) error

CleanErr masks pointers in err when printing the message. errors.As and errors.Is can still find the original error. If err is nil, CleanErr returns nil.

func IndexByProviderGVK added in v0.14.0

func IndexByProviderGVK(o client.Object) []string

IndexByProviderGVK assumes the passed object is an Object. It returns keys with "ProviderConfig + GVK" for every resource referenced or managed by the Object.

func IndexByProviderNamespacedNameGVK added in v0.14.0

func IndexByProviderNamespacedNameGVK(o client.Object) []string

IndexByProviderNamespacedNameGVK assumes the passed object is an Object. It returns keys with "ProviderConfig + NamespacedName + GVK" for every resource referenced or managed by the Object.

func Setup

func Setup(mgr ctrl.Manager, o controller.Options, sanitizeSecrets bool, pollJitterPercentage uint) error

Setup adds a controller that reconciles Object managed resources.

Types

type KindObserver added in v0.14.0

type KindObserver interface {
	// WatchResources starts a watch of the given kinds to trigger reconciles
	// when a referenced or managed objects of those kinds changes.
	WatchResources(rc *rest.Config, providerConfig string, gvks ...schema.GroupVersionKind)
}

KindObserver tracks kinds of referenced composed resources in order to start watches for them for realtime events.

type PatchingResourceSyncer added in v0.15.0

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

PatchingResourceSyncer is a ResourceSyncer that syncs objects by patching them in the Kubernetes API server and storing the last applied configuration in an annotation.

func (*PatchingResourceSyncer) GetDesiredState added in v0.15.0

GetDesiredState returns the object's desired state by parsing its manifest.

func (*PatchingResourceSyncer) GetObservedState added in v0.15.0

GetObservedState returns the last applied configuration of the supplied object, if it exists.

func (*PatchingResourceSyncer) SyncResource added in v0.15.0

SyncResource syncs the supplied object by storing the last applied configuration in an annotation and patching the object in the Kubernetes API server.

type ResourceSyncer added in v0.15.0

type ResourceSyncer interface {
	// GetObservedState extracts the observed state of the current object that
	// should be compared with the desired state of the object manifest to
	// decide whether the object is up-to-date or not.
	// Without server-side apply, the observed state is extracted from the last
	// applied annotation, otherwise it is extracted from the current object
	// using the server-side apply extractor.
	GetObservedState(ctx context.Context, obj *v1alpha2.Object, current *unstructured.Unstructured) (*unstructured.Unstructured, error)
	// GetDesiredState calculates the desired state of the object manifest that
	// we would like to see at the Kube API so that we can compare it with the
	// observed state to decide whether the object is up-to-date or not.
	// Without server-side apply, the desired state is the object manifest
	// itself, however, with server-side apply, the desired state is extracted
	// with a dry-run apply of the object manifest. This is mostly a workaround
	// for a limitation/bug in the server-side apply implementation due to poor
	// handling of defaulting in certain cases.
	// https://github.com/kubernetes/kubernetes/issues/115563
	// https://github.com/kubernetes/kubernetes/issues/124605
	GetDesiredState(ctx context.Context, obj *v1alpha2.Object, manifest *unstructured.Unstructured) (*unstructured.Unstructured, error)
	// SyncResource syncs the desired state of the object manifest to the Kube API.
	SyncResource(ctx context.Context, obj *v1alpha2.Object, desired *unstructured.Unstructured) (*unstructured.Unstructured, error)
}

ResourceSyncer contains the methods required to decide whether an object is up-to-date or not, and to sync the object to the Kube API.

type SSAResourceSyncer added in v0.15.0

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

SSAResourceSyncer is a ResourceSyncer that syncs objects by using server-side apply to apply the object's manifest to the Kubernetes API server.

func (*SSAResourceSyncer) GetDesiredState added in v0.15.0

GetDesiredState returns the object's desired state by running a dry run of server-side apply on the object's manifest to see what the object would look like if it were applied and extracting the managed fields from that.

func (*SSAResourceSyncer) GetObservedState added in v0.15.0

GetObservedState returns the object's observed state by extracting the managed fields from the current object.

func (*SSAResourceSyncer) SyncResource added in v0.15.0

SyncResource syncs the supplied object by using server-side apply to apply.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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