types

package
v3.9.9 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalValue

func UnmarshalValue(data []byte) (interface{}, error)

UnmarshalValue unmarshals the value a mutation is meant to assign.

Types

type Anything

type Anything struct {
	Value interface{} `json:"-"`
}

Anything is a struct wrapper around a field of type `interface{}` that plays nicely with controller-gen +kubebuilder:object:generate=false +kubebuilder:validation:Type=""

func (*Anything) DeepCopy

func (in *Anything) DeepCopy() *Anything

func (*Anything) DeepCopyInto

func (in *Anything) DeepCopyInto(out *Anything)

func (*Anything) GetValue

func (in *Anything) GetValue() interface{}

func (Anything) MarshalJSON

func (in Anything) MarshalJSON() ([]byte, error)

MarshalJSON should be implemented against a value per http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go credit to K8s api machinery's RawExtension for finding this.

func (*Anything) UnmarshalJSON

func (in *Anything) UnmarshalJSON(val []byte) error

type ExternalDataFailurePolicy

type ExternalDataFailurePolicy string

ExternalDataFailurePolicy is the type of the failure policy to use for the external data. +kubebuilder:validation:Enum=UseDefault;Ignore;Fail

const (
	// UseDefault indicates that the default value of the external
	// data provider will be used.
	FailurePolicyUseDefault ExternalDataFailurePolicy = "UseDefault"

	// Ignore indicates that the mutation will be ignored if the external
	// data provider fails.
	FailurePolicyIgnore ExternalDataFailurePolicy = "Ignore"

	// Fail indicates that the mutation will be failed if the external
	// data provider fails.
	FailurePolicyFail ExternalDataFailurePolicy = "Fail"
)

type ExternalDataSource

type ExternalDataSource string

ExternalDataSource is the type of the data source to use for the external data. +kubebuilder:validation:Enum=ValueAtLocation;Username

const (
	// ValueAtLocation indicates that the value at spec.location of the mutation
	// spec will be extracted to the external data provider as the data source.
	DataSourceValueAtLocation ExternalDataSource = "ValueAtLocation"

	// Username indicates that the username of the admission request will
	// be extracted to the external data provider as the data source.
	DataSourceUsername ExternalDataSource = "Username"
)

type ID

type ID struct {
	Group     string
	Kind      string
	Namespace string
	Name      string
}

ID represent the identifier of a mutation object.

func MakeID

func MakeID(obj client.Object) ID

MakeID builds an ID object for the given object.

func (ID) String

func (id ID) String() string

type MetadataGetter

type MetadataGetter interface {
	GetNamespace() string
	GetName() string
}

MetadataGetter is an object that can retrieve the metadata fields that support `AssignField.FromMetadata`.

type Mutable

type Mutable struct {
	// Object is the object to be mutated.
	Object *unstructured.Unstructured

	// Namespace is the namespace of the mutable object.
	Namespace *corev1.Namespace

	// Username is the name of the user who initiates
	// admission request of the mutable object.
	Username string
}

Mutable represents a mutable object and its metadata.

type Mutator

type Mutator interface {
	// Matches tells if the given object is eligible for this mutation.
	Matches(mutable *Mutable) bool
	// Mutate applies the mutation to the given object
	Mutate(mutable *Mutable) (bool, error)
	// UsesExternalData returns true if the mutation uses external data.
	UsesExternalData() bool
	// ID returns the id of the current mutator.
	ID() ID
	// HasDiff tells if the mutator has meaningful differences
	// with the provided mutator
	HasDiff(mutator Mutator) bool
	// DeepCopy returns a copy of the current object
	DeepCopy() Mutator
	Path() parser.Path
	String() string
}

Mutator represent a mutation object.

Jump to

Keyboard shortcuts

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