apply

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIApplicator

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

APIApplicator implements Applicator

func NewAPIApplicator

func NewAPIApplicator(c client.Client, log logging.Logger) *APIApplicator

NewAPIApplicator creates an Applicator that applies state to an object or creates the object if not exist.

func (*APIApplicator) Apply

func (a *APIApplicator) Apply(ctx context.Context, desired runtime.Object, ao ...ApplyOption) error

Apply applies new state to an object or create it if not exist

type Applicator

type Applicator interface {
	Apply(context.Context, runtime.Object, ...ApplyOption) error
}

Applicator applies new state to an object or create it if not exist. It uses the same mechanism as `kubectl apply`, that is, for each resource being applied, computing a three-way diff merge in client side based on its current state, modified stated, and last-applied-state which is tracked through an specific annotation. If the resource doesn't exist before, Apply will create it.

type ApplyOption

type ApplyOption func(ctx context.Context, existing, desired runtime.Object) error

ApplyOption is called before applying state to the object. ApplyOption is still called even if the object does NOT exist. If the object does not exist, `existing` will be assigned as `nil`. nolint: golint

func MustBeControllableBy

func MustBeControllableBy(u types.UID) ApplyOption

MustBeControllableBy requires that the existing object is controllable by an object with the supplied UID. An object is controllable if its controller reference matches the supplied UID, or it has no controller reference. An error will be returned if the current object cannot be controlled by the supplied UID. ACKNOWLEDGMENTS: The code was based in part on the source code of - github.com/crossplane/crossplane-runtime/pkg/resource/resource.go#L274

Jump to

Keyboard shortcuts

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