apply

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, c client.Client, obj client.Object, force bool) error

func CreateApplyAnnotation

func CreateApplyAnnotation(obj runtime.Object, codec runtime.Encoder) error

CreateApplyAnnotation gets the modified configuration of the object, without embedding it again, and then sets it on the object as the annotation.

func CreateOrUpdateAnnotation

func CreateOrUpdateAnnotation(createAnnotation bool, obj runtime.Object, codec runtime.Encoder) error

CreateOrUpdateAnnotation creates the annotation used by kubectl apply only when createAnnotation is true Otherwise, only update the annotation when it already exists

func GVKFrom

func GVKFrom(obj runtime.Object, scheme *runtime.Scheme) (schema.GroupVersionKind, error)

func GetModifiedConfiguration

func GetModifiedConfiguration(obj runtime.Object, annotate bool, codec runtime.Encoder) ([]byte, error)

GetModifiedConfiguration retrieves the modified configuration of the object. If annotate is true, it embeds the result as an annotation in the modified configuration. If an object was read from the command input, it will use that version of the object. Otherwise, it will use the version from the server.

func GetOriginalConfiguration

func GetOriginalConfiguration(obj runtime.Object) ([]byte, error)

GetOriginalConfiguration retrieves the original configuration of the object from the annotation, or nil if no annotation was found.

func NewObjectFromExisting

func NewObjectFromExisting(newObj client.Object, scheme *runtime.Scheme) (client.Object, error)

Types

type Patcher

type Patcher struct {
	Client    client.Client
	Overwrite bool
	BackOff   clockwork.Clock

	Force   bool
	Timeout time.Duration

	// Number of retries to make if the patch fails with conflict
	Retries int
}

Patcher defines options to patch OpenAPI objects.

func (*Patcher) Patch

func (p *Patcher) Patch(ctx context.Context, current client.Object, modified []byte) ([]byte, runtime.Object, error)

Patch tries to patch an OpenAPI resource. On success, returns the merge patch as well the final patched object. On failure, returns an error.

Jump to

Keyboard shortcuts

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