apply

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 27 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilObject  = errors.New("can't reference a nil object")
	ErrNoSelfLink = errors.New("selfLink was empty, can't make reference")
)

Errors that could be returned by Apply.

View Source
var (
	// ErrNoPreviousConfig is returned when no previous configuration is found in the annotations
	ErrNoPreviousConfig = errors.New("last applied configuration not found")
)

Functions

func GetGVK

GetGVK returns group version kind of a runtime object

func GetOriginalConfig

func GetOriginalConfig(o runtime.Object) ([]byte, error)

GetOriginalConfig returns previous config of the object

func NewPatch

func NewPatch(current client.Object) client.Patch

NewPatch prepres patch for current runtime Object

func NewStatus

func NewStatus(original client.Object, statusObj interface{}) client.Patch

NewStatus returns new path for status objects

Types

type Applier

type Applier interface {
	Apply(ctx context.Context, obj ctrlclient.Object, opts ...Option) error
	ApplyStatus(ctx context.Context, obj ctrlclient.Object, statusObj interface{}) error
	ctrlclient.Client
}

Applier is the interface for applying patch to runtime objects

func NewApplier

func NewApplier(client ctrlclient.Client) Applier

NewApplier returns new applier

func NewDynamicApplier

func NewDynamicApplier() (Applier, error)

NewDynamicApplier returns a new applier whose client is dynamically refreshed when new CRDs are installed

type Option

type Option func(*Options)

Option is the functional apply options

func WithDontCreate

func WithDontCreate() Option

WithDontCreate sets DontCreate flag

func WithForceUseUpdate

func WithForceUseUpdate() Option

WithForceUseUpdate sets if update should be used instead of patch for apply operation, irrespective of whether the object is of paralus domain or not

func WithUseUpdate

func WithUseUpdate(o runtime.Object) Option

WithUseUpdate sets if update should be used instead of patch for apply operation

type Options

type Options struct {
	// if UseUpdate is set, then update is used instead of patch
	UseUpdate bool
	// if DontCreate is set, then object is not created if it is not present;
	// it is only updated/patched when present
	DontCreate bool
}

Options are the options for apply operation

Jump to

Keyboard shortcuts

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