Documentation ¶
Index ¶
Constants ¶
const ( SourceTypeOriginal = SourceType("Original") SourceTypeGenerated = SourceType("Generated") SourceTypeAll = SourceType("All") SourceTypeDefault = SourceTypeAll )
Variables ¶
This section is empty.
Functions ¶
func IsValidSource ¶
func IsValidSource(src SourceType) bool
func UnmarshalValue ¶
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) DeepCopyInto ¶
func (Anything) MarshalJSON ¶
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 ¶
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 MetadataGetter ¶
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 // Source specifies which types of resources the mutator should be applied to Source SourceType }
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, error) // Mutate applies the mutation to the given object Mutate(mutable *Mutable) (bool, error) // MustTerminate returns true if the mutator requires its path to terminate MustTerminate() 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.
type SourceType ¶
type SourceType string
SourceType specifies which types resource a matcher should be applied to.