mutator

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyTimeMutator

type ApplyTimeMutator struct {
	Client        dynamic.Interface
	Mapper        meta.RESTMapper
	ResourceCache cache.ResourceCache
}

ApplyTimeMutator mutates an object by injecting values specified by the apply-time-mutation annotation. The optional ResourceCache will be used to speed up source object lookups, if specified. Implements the Mutator interface

func (*ApplyTimeMutator) Mutate

Mutate parses the apply-time-mutation annotation and loops through the substitutions, applying each of them to the supplied target object. Returns true with a reason, if mutation was performed.

func (*ApplyTimeMutator) Name

func (atm *ApplyTimeMutator) Name() string

Name returns a mutator identifier for logging.

type Interface

type Interface interface {
	// Name returns a filter name (usually for logging).
	Name() string
	// Mutate returns true if the object was mutated.
	// This allows the mutator to decide if mutation is needed.
	// If mutated, a reason string is returned.
	// If an error happens during mutation, it is returned.
	Mutate(ctx context.Context, obj *unstructured.Unstructured) (bool, string, error)
}

Interface decouples apply-time-mutation from the concrete structs used for applying.

Jump to

Keyboard shortcuts

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