v1alpha1

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSONPatchBlank = (&JSONPatchDie{}).DieFeed(admissionregistrationv1alpha1.JSONPatch{})
View Source
var MutationBlank = (&MutationDie{}).DieFeed(admissionregistrationv1alpha1.Mutation{})
View Source
var ParamKindBlank = (&ParamKindDie{}).DieFeed(admissionregistrationv1alpha1.ParamKind{})
View Source
var VariableBlank = (&VariableDie{}).DieFeed(admissionregistrationv1alpha1.Variable{})

Functions

This section is empty.

Types

type ApplyConfigurationDie

type ApplyConfigurationDie struct {
	// contains filtered or unexported fields
}

func (*ApplyConfigurationDie) DeepCopy

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*ApplyConfigurationDie) DieDiff

func (d *ApplyConfigurationDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*ApplyConfigurationDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*ApplyConfigurationDie) DieFeedJSON

func (d *ApplyConfigurationDie) DieFeedJSON(j []byte) *ApplyConfigurationDie

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*ApplyConfigurationDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*ApplyConfigurationDie) DieFeedRawExtension

func (d *ApplyConfigurationDie) DieFeedRawExtension(raw runtime.RawExtension) *ApplyConfigurationDie

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*ApplyConfigurationDie) DieFeedYAML

func (d *ApplyConfigurationDie) DieFeedYAML(y []byte) *ApplyConfigurationDie

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*ApplyConfigurationDie) DieFeedYAMLFile

func (d *ApplyConfigurationDie) DieFeedYAMLFile(name string) *ApplyConfigurationDie

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*ApplyConfigurationDie) DieImmutable

func (d *ApplyConfigurationDie) DieImmutable(immutable bool) *ApplyConfigurationDie

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*ApplyConfigurationDie) DiePatch

func (d *ApplyConfigurationDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*ApplyConfigurationDie) DieRelease

DieRelease returns the resource managed by the die.

func (*ApplyConfigurationDie) DieReleaseJSON

func (d *ApplyConfigurationDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*ApplyConfigurationDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*ApplyConfigurationDie) DieReleaseRawExtension

func (d *ApplyConfigurationDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*ApplyConfigurationDie) DieReleaseYAML

func (d *ApplyConfigurationDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*ApplyConfigurationDie) DieSeal

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*ApplyConfigurationDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*ApplyConfigurationDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*ApplyConfigurationDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*ApplyConfigurationDie) DieSealReleasePtr

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*ApplyConfigurationDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*ApplyConfigurationDie) DieStampAt

func (d *ApplyConfigurationDie) DieStampAt(jp string, fn interface{}) *ApplyConfigurationDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*ApplyConfigurationDie) DieWith

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*ApplyConfigurationDie) Expression

expression will be evaluated by CEL to create an apply configuration.

ref: https://github.com/google/cel-spec

Apply configurations are declared in CEL using object initialization. For example, this CEL expression

returns an apply configuration to set a single field:

Object{

spec: Object.spec{

serviceAccountName: "example"

}

}

Apply configurations may not modify atomic structs, maps or arrays due to the risk of accidental deletion of

values not included in the apply configuration.

CEL expressions have access to the object types needed to create apply configurations:

- 'Object' - CEL type of the resource object.

- 'Object.<fieldName>' - CEL type of object field (such as 'Object.spec')

- 'Object.<fieldName1>.<fieldName2>...<fieldNameN>` - CEL type of nested field (such as 'Object.spec.containers')

CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables:

- 'object' - The object from the incoming request. The value is null for DELETE requests.

- 'oldObject' - The existing object. The value is null for CREATE requests.

- 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)).

- 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind.

- 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources.

- 'variables' - Map of composited variables, from its name to its lazily evaluated value.

For example, a variable named 'foo' can be accessed as 'variables.foo'.

- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.

See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz

- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the

request resource.

The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the

object. No other metadata properties are accessible.

Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.

Required.

type JSONPatchDie

type JSONPatchDie struct {
	// contains filtered or unexported fields
}

func (*JSONPatchDie) DeepCopy

func (d *JSONPatchDie) DeepCopy() *JSONPatchDie

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*JSONPatchDie) DieDiff

func (d *JSONPatchDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*JSONPatchDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*JSONPatchDie) DieFeedJSON

func (d *JSONPatchDie) DieFeedJSON(j []byte) *JSONPatchDie

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*JSONPatchDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*JSONPatchDie) DieFeedRawExtension

func (d *JSONPatchDie) DieFeedRawExtension(raw runtime.RawExtension) *JSONPatchDie

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*JSONPatchDie) DieFeedYAML

func (d *JSONPatchDie) DieFeedYAML(y []byte) *JSONPatchDie

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*JSONPatchDie) DieFeedYAMLFile

func (d *JSONPatchDie) DieFeedYAMLFile(name string) *JSONPatchDie

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*JSONPatchDie) DieImmutable

func (d *JSONPatchDie) DieImmutable(immutable bool) *JSONPatchDie

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*JSONPatchDie) DiePatch

func (d *JSONPatchDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*JSONPatchDie) DieRelease

DieRelease returns the resource managed by the die.

func (*JSONPatchDie) DieReleaseJSON

func (d *JSONPatchDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*JSONPatchDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*JSONPatchDie) DieReleaseRawExtension

func (d *JSONPatchDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*JSONPatchDie) DieReleaseYAML

func (d *JSONPatchDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*JSONPatchDie) DieSeal

func (d *JSONPatchDie) DieSeal() *JSONPatchDie

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*JSONPatchDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*JSONPatchDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*JSONPatchDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*JSONPatchDie) DieSealReleasePtr

func (d *JSONPatchDie) DieSealReleasePtr() *admissionregistrationv1alpha1.JSONPatch

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*JSONPatchDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*JSONPatchDie) DieStampAt

func (d *JSONPatchDie) DieStampAt(jp string, fn interface{}) *JSONPatchDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*JSONPatchDie) DieWith

func (d *JSONPatchDie) DieWith(fns ...func(d *JSONPatchDie)) *JSONPatchDie

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*JSONPatchDie) Expression

func (d *JSONPatchDie) Expression(v string) *JSONPatchDie

expression will be evaluated by CEL to create a [JSON patch](https://jsonpatch.com/).

ref: https://github.com/google/cel-spec

expression must return an array of JSONPatch values.

For example, this CEL expression returns a JSON patch to conditionally modify a value:

[

JSONPatch{op: "test", path: "/spec/example", value: "Red"},

JSONPatch{op: "replace", path: "/spec/example", value: "Green"}

]

To define an object for the patch value, use Object types. For example:

[

JSONPatch{

op: "add",

path: "/spec/selector",

value: Object.spec.selector{matchLabels: {"environment": "test"}}

}

]

To use strings containing '/' and '~' as JSONPatch path keys, use "jsonpatch.escapeKey". For example:

[

JSONPatch{

op: "add",

path: "/metadata/labels/" + jsonpatch.escapeKey("example.com/environment"),

value: "test"

},

]

CEL expressions have access to the types needed to create JSON patches and objects:

- 'JSONPatch' - CEL type of JSON Patch operations. JSONPatch has the fields 'op', 'from', 'path' and 'value'.

See [JSON patch](https://jsonpatch.com/) for more details. The 'value' field may be set to any of: string,

integer, array, map or object. If set, the 'path' and 'from' fields must be set to a

[JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901/) string, where the 'jsonpatch.escapeKey()' CEL

function may be used to escape path keys containing '/' and '~'.

- 'Object' - CEL type of the resource object.

- 'Object.<fieldName>' - CEL type of object field (such as 'Object.spec')

- 'Object.<fieldName1>.<fieldName2>...<fieldNameN>` - CEL type of nested field (such as 'Object.spec.containers')

CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables:

- 'object' - The object from the incoming request. The value is null for DELETE requests.

- 'oldObject' - The existing object. The value is null for CREATE requests.

- 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)).

- 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind.

- 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources.

- 'variables' - Map of composited variables, from its name to its lazily evaluated value.

For example, a variable named 'foo' can be accessed as 'variables.foo'.

- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.

See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz

- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the

request resource.

CEL expressions have access to [Kubernetes CEL function libraries](https://kubernetes.io/docs/reference/using-api/cel/#cel-options-language-features-and-libraries)

as well as:

- 'jsonpatch.escapeKey' - Performs JSONPatch key escaping. '~' and '/' are escaped as '~0' and `~1' respectively).

Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible.

Required.

type MatchConditionDie

type MatchConditionDie struct {
	// contains filtered or unexported fields
}

func (*MatchConditionDie) DeepCopy

func (d *MatchConditionDie) DeepCopy() *MatchConditionDie

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*MatchConditionDie) DieDiff

func (d *MatchConditionDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*MatchConditionDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*MatchConditionDie) DieFeedJSON

func (d *MatchConditionDie) DieFeedJSON(j []byte) *MatchConditionDie

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*MatchConditionDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*MatchConditionDie) DieFeedRawExtension

func (d *MatchConditionDie) DieFeedRawExtension(raw runtime.RawExtension) *MatchConditionDie

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MatchConditionDie) DieFeedYAML

func (d *MatchConditionDie) DieFeedYAML(y []byte) *MatchConditionDie

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*MatchConditionDie) DieFeedYAMLFile

func (d *MatchConditionDie) DieFeedYAMLFile(name string) *MatchConditionDie

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*MatchConditionDie) DieImmutable

func (d *MatchConditionDie) DieImmutable(immutable bool) *MatchConditionDie

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*MatchConditionDie) DiePatch

func (d *MatchConditionDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*MatchConditionDie) DieRelease

DieRelease returns the resource managed by the die.

func (*MatchConditionDie) DieReleaseJSON

func (d *MatchConditionDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*MatchConditionDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*MatchConditionDie) DieReleaseRawExtension

func (d *MatchConditionDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MatchConditionDie) DieReleaseYAML

func (d *MatchConditionDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*MatchConditionDie) DieSeal

func (d *MatchConditionDie) DieSeal() *MatchConditionDie

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*MatchConditionDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*MatchConditionDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*MatchConditionDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*MatchConditionDie) DieSealReleasePtr

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*MatchConditionDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*MatchConditionDie) DieStampAt

func (d *MatchConditionDie) DieStampAt(jp string, fn interface{}) *MatchConditionDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*MatchConditionDie) DieWith

func (d *MatchConditionDie) DieWith(fns ...func(d *MatchConditionDie)) *MatchConditionDie

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*MatchConditionDie) Expression

func (d *MatchConditionDie) Expression(v string) *MatchConditionDie

Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:

'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.

See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz

'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the

request resource.

Documentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/

Required.

func (*MatchConditionDie) Name

Name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')

Required.

type MatchResourcesDie

type MatchResourcesDie struct {
	// contains filtered or unexported fields
}

func (*MatchResourcesDie) DeepCopy

func (d *MatchResourcesDie) DeepCopy() *MatchResourcesDie

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*MatchResourcesDie) DieDiff

func (d *MatchResourcesDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*MatchResourcesDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*MatchResourcesDie) DieFeedJSON

func (d *MatchResourcesDie) DieFeedJSON(j []byte) *MatchResourcesDie

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*MatchResourcesDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*MatchResourcesDie) DieFeedRawExtension

func (d *MatchResourcesDie) DieFeedRawExtension(raw runtime.RawExtension) *MatchResourcesDie

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MatchResourcesDie) DieFeedYAML

func (d *MatchResourcesDie) DieFeedYAML(y []byte) *MatchResourcesDie

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*MatchResourcesDie) DieFeedYAMLFile

func (d *MatchResourcesDie) DieFeedYAMLFile(name string) *MatchResourcesDie

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*MatchResourcesDie) DieImmutable

func (d *MatchResourcesDie) DieImmutable(immutable bool) *MatchResourcesDie

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*MatchResourcesDie) DiePatch

func (d *MatchResourcesDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*MatchResourcesDie) DieRelease

DieRelease returns the resource managed by the die.

func (*MatchResourcesDie) DieReleaseJSON

func (d *MatchResourcesDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*MatchResourcesDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*MatchResourcesDie) DieReleaseRawExtension

func (d *MatchResourcesDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MatchResourcesDie) DieReleaseYAML

func (d *MatchResourcesDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*MatchResourcesDie) DieSeal

func (d *MatchResourcesDie) DieSeal() *MatchResourcesDie

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*MatchResourcesDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*MatchResourcesDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*MatchResourcesDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*MatchResourcesDie) DieSealReleasePtr

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*MatchResourcesDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*MatchResourcesDie) DieStampAt

func (d *MatchResourcesDie) DieStampAt(jp string, fn interface{}) *MatchResourcesDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*MatchResourcesDie) DieWith

func (d *MatchResourcesDie) DieWith(fns ...func(d *MatchResourcesDie)) *MatchResourcesDie

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*MatchResourcesDie) ExcludeResourceRules

ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about.

The exclude rules take precedence over include rules (if a resource matches both, it is excluded)

func (*MatchResourcesDie) ExcludeResourceRulesDie

func (d *MatchResourcesDie) ExcludeResourceRulesDie(v ...*NamedRuleWithOperationsDie) *MatchResourcesDie

ExcludeResourceRulesDie replaces ExcludeResourceRules by collecting the released value from each die passed.

ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about.

The exclude rules take precedence over include rules (if a resource matches both, it is excluded)

func (*MatchResourcesDie) MatchPolicy

matchPolicy defines how the "MatchResources" list is used to match incoming requests.

Allowed values are "Exact" or "Equivalent".

- Exact: match a request only if it exactly matches a specified rule.

For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,

but "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,

a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy.

- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version.

For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1,

and "rules" only included `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]`,

a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy.

Defaults to "Equivalent"

func (*MatchResourcesDie) NamespaceSelector

func (d *MatchResourcesDie) NamespaceSelector(v *metav1.LabelSelector) *MatchResourcesDie

NamespaceSelector decides whether to run the admission control policy on an object based

on whether the namespace for that object matches the selector. If the

object itself is a namespace, the matching is performed on

object.metadata.labels. If the object is another cluster scoped resource,

it never skips the policy.

For example, to run the webhook on any objects whose namespace is not

associated with "runlevel" of "0" or "1"; you will set the selector as

follows:

"namespaceSelector": {

"matchExpressions": [

{

"key": "runlevel",

"operator": "NotIn",

"values": [

"0",

"1"

]

}

]

}

If instead you want to only run the policy on any objects whose

namespace is associated with the "environment" of "prod" or "staging";

you will set the selector as follows:

"namespaceSelector": {

"matchExpressions": [

{

"key": "environment",

"operator": "In",

"values": [

"prod",

"staging"

]

}

]

}

See

https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

for more examples of label selectors.

Default to the empty LabelSelector, which matches everything.

func (*MatchResourcesDie) NamespaceSelectorDie

func (d *MatchResourcesDie) NamespaceSelectorDie(fn func(d *v1.LabelSelectorDie)) *MatchResourcesDie

NamespaceSelectorDie mutates NamespaceSelector as a die.

NamespaceSelector decides whether to run the admission control policy on an object based

on whether the namespace for that object matches the selector. If the

object itself is a namespace, the matching is performed on

object.metadata.labels. If the object is another cluster scoped resource,

it never skips the policy.

For example, to run the webhook on any objects whose namespace is not

associated with "runlevel" of "0" or "1"; you will set the selector as

follows:

"namespaceSelector": {

"matchExpressions": [

{

"key": "runlevel",

"operator": "NotIn",

"values": [

"0",

"1"

]

}

]

}

If instead you want to only run the policy on any objects whose

namespace is associated with the "environment" of "prod" or "staging";

you will set the selector as follows:

"namespaceSelector": {

"matchExpressions": [

{

"key": "environment",

"operator": "In",

"values": [

"prod",

"staging"

]

}

]

}

See

https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/

for more examples of label selectors.

Default to the empty LabelSelector, which matches everything.

func (*MatchResourcesDie) ObjectSelector

ObjectSelector decides whether to run the validation based on if the

object has matching labels. objectSelector is evaluated against both

the oldObject and newObject that would be sent to the cel validation, and

is considered to match if either object matches the selector. A null

object (oldObject in the case of create, or newObject in the case of

delete) or an object that cannot have labels (like a

DeploymentRollback or a PodProxyOptions object) is not considered to

match.

Use the object selector only if the webhook is opt-in, because end

users may skip the admission webhook by setting the labels.

Default to the empty LabelSelector, which matches everything.

func (*MatchResourcesDie) ObjectSelectorDie

func (d *MatchResourcesDie) ObjectSelectorDie(fn func(d *v1.LabelSelectorDie)) *MatchResourcesDie

ObjectSelectorDie mutates ObjectSelector as a die.

ObjectSelector decides whether to run the validation based on if the

object has matching labels. objectSelector is evaluated against both

the oldObject and newObject that would be sent to the cel validation, and

is considered to match if either object matches the selector. A null

object (oldObject in the case of create, or newObject in the case of

delete) or an object that cannot have labels (like a

DeploymentRollback or a PodProxyOptions object) is not considered to

match.

Use the object selector only if the webhook is opt-in, because end

users may skip the admission webhook by setting the labels.

Default to the empty LabelSelector, which matches everything.

func (*MatchResourcesDie) ResourceRules

ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches.

The policy cares about an operation if it matches _any_ Rule.

func (*MatchResourcesDie) ResourceRulesDie

ResourceRulesDie replaces ResourceRules by collecting the released value from each die passed.

ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches.

The policy cares about an operation if it matches _any_ Rule.

type MutatingAdmissionPolicyDie

type MutatingAdmissionPolicyDie struct {
	v1.FrozenObjectMeta
	// contains filtered or unexported fields
}

func (*MutatingAdmissionPolicyDie) APIVersion

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

func (*MutatingAdmissionPolicyDie) DeepCopy

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*MutatingAdmissionPolicyDie) DeepCopyObject

func (d *MutatingAdmissionPolicyDie) DeepCopyObject() runtime.Object

func (*MutatingAdmissionPolicyDie) DieDefaultTypeMetadata

func (d *MutatingAdmissionPolicyDie) DieDefaultTypeMetadata() *MutatingAdmissionPolicyDie

DieDefaultTypeMetadata sets the APIVersion and Kind to "admissionregistration.k8s.io/v1alpha1" and "MutatingAdmissionPolicy" respectively.

func (*MutatingAdmissionPolicyDie) DieDiff

func (d *MutatingAdmissionPolicyDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*MutatingAdmissionPolicyDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*MutatingAdmissionPolicyDie) DieFeedJSON

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*MutatingAdmissionPolicyDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*MutatingAdmissionPolicyDie) DieFeedRawExtension

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MutatingAdmissionPolicyDie) DieFeedYAML

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*MutatingAdmissionPolicyDie) DieFeedYAMLFile

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*MutatingAdmissionPolicyDie) DieImmutable

func (d *MutatingAdmissionPolicyDie) DieImmutable(immutable bool) *MutatingAdmissionPolicyDie

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*MutatingAdmissionPolicyDie) DiePatch

func (d *MutatingAdmissionPolicyDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*MutatingAdmissionPolicyDie) DieRelease

DieRelease returns the resource managed by the die.

func (*MutatingAdmissionPolicyDie) DieReleaseJSON

func (d *MutatingAdmissionPolicyDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*MutatingAdmissionPolicyDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*MutatingAdmissionPolicyDie) DieReleaseRawExtension

func (d *MutatingAdmissionPolicyDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MutatingAdmissionPolicyDie) DieReleaseUnstructured

func (d *MutatingAdmissionPolicyDie) DieReleaseUnstructured() *unstructured.Unstructured

DieReleaseUnstructured returns the resource managed by the die as an unstructured object. Panics on error.

func (*MutatingAdmissionPolicyDie) DieReleaseYAML

func (d *MutatingAdmissionPolicyDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*MutatingAdmissionPolicyDie) DieSeal

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*MutatingAdmissionPolicyDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*MutatingAdmissionPolicyDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*MutatingAdmissionPolicyDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*MutatingAdmissionPolicyDie) DieSealReleasePtr

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*MutatingAdmissionPolicyDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*MutatingAdmissionPolicyDie) DieStampAt

func (d *MutatingAdmissionPolicyDie) DieStampAt(jp string, fn interface{}) *MutatingAdmissionPolicyDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*MutatingAdmissionPolicyDie) DieWith

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*MutatingAdmissionPolicyDie) GetObjectKind

func (d *MutatingAdmissionPolicyDie) GetObjectKind() schema.ObjectKind

func (*MutatingAdmissionPolicyDie) Kind

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

func (*MutatingAdmissionPolicyDie) MarshalJSON

func (d *MutatingAdmissionPolicyDie) MarshalJSON() ([]byte, error)

func (*MutatingAdmissionPolicyDie) Metadata

Metadata standard object's metadata.

func (*MutatingAdmissionPolicyDie) MetadataDie

MetadataDie stamps the resource's ObjectMeta field with a mutable die.

func (*MutatingAdmissionPolicyDie) Spec

Specification of the desired behavior of the MutatingAdmissionPolicy.

func (*MutatingAdmissionPolicyDie) SpecDie

SpecDie stamps the resource's spec field with a mutable die.

func (*MutatingAdmissionPolicyDie) TypeMetadata

TypeMetadata standard object's type metadata.

func (*MutatingAdmissionPolicyDie) TypeMetadataDie

func (d *MutatingAdmissionPolicyDie) TypeMetadataDie(fn func(d *v1.TypeMetaDie)) *MutatingAdmissionPolicyDie

TypeMetadataDie stamps the resource's TypeMeta field with a mutable die.

func (*MutatingAdmissionPolicyDie) UnmarshalJSON

func (d *MutatingAdmissionPolicyDie) UnmarshalJSON(b []byte) error

type MutatingAdmissionPolicySpecDie

type MutatingAdmissionPolicySpecDie struct {
	// contains filtered or unexported fields
}

func (*MutatingAdmissionPolicySpecDie) DeepCopy

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*MutatingAdmissionPolicySpecDie) DieDiff

func (d *MutatingAdmissionPolicySpecDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*MutatingAdmissionPolicySpecDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*MutatingAdmissionPolicySpecDie) DieFeedJSON

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*MutatingAdmissionPolicySpecDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*MutatingAdmissionPolicySpecDie) DieFeedRawExtension

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MutatingAdmissionPolicySpecDie) DieFeedYAML

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*MutatingAdmissionPolicySpecDie) DieFeedYAMLFile

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*MutatingAdmissionPolicySpecDie) DieImmutable

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*MutatingAdmissionPolicySpecDie) DiePatch

func (d *MutatingAdmissionPolicySpecDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*MutatingAdmissionPolicySpecDie) DieRelease

DieRelease returns the resource managed by the die.

func (*MutatingAdmissionPolicySpecDie) DieReleaseJSON

func (d *MutatingAdmissionPolicySpecDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*MutatingAdmissionPolicySpecDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*MutatingAdmissionPolicySpecDie) DieReleaseRawExtension

func (d *MutatingAdmissionPolicySpecDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MutatingAdmissionPolicySpecDie) DieReleaseYAML

func (d *MutatingAdmissionPolicySpecDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*MutatingAdmissionPolicySpecDie) DieSeal

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*MutatingAdmissionPolicySpecDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*MutatingAdmissionPolicySpecDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*MutatingAdmissionPolicySpecDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*MutatingAdmissionPolicySpecDie) DieSealReleasePtr

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*MutatingAdmissionPolicySpecDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*MutatingAdmissionPolicySpecDie) DieStampAt

func (d *MutatingAdmissionPolicySpecDie) DieStampAt(jp string, fn interface{}) *MutatingAdmissionPolicySpecDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*MutatingAdmissionPolicySpecDie) DieWith

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*MutatingAdmissionPolicySpecDie) FailurePolicy

failurePolicy defines how to handle failures for the admission policy. Failures can

occur from CEL expression parse errors, type check errors, runtime errors and invalid

or mis-configured policy definitions or bindings.

A policy is invalid if paramKind refers to a non-existent Kind.

A binding is invalid if paramRef.name refers to a non-existent resource.

failurePolicy does not define how validations that evaluate to false are handled.

Allowed values are Ignore or Fail. Defaults to Fail.

func (*MutatingAdmissionPolicySpecDie) MatchConditionDie

MatchConditionDie mutates a single item in MatchConditions matched by the nested field Name, appending a new item if no match is found.

matchConditions is a list of conditions that must be met for a request to be validated.

Match conditions filter requests that have already been matched by the matchConstraints.

An empty list of matchConditions matches all requests.

There are a maximum of 64 match conditions allowed.

If a parameter object is provided, it can be accessed via the `params` handle in the same

manner as validation expressions.

The exact matching logic is (in order):

1. If ANY matchCondition evaluates to FALSE, the policy is skipped.

2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.

3. If any matchCondition evaluates to an error (but none are FALSE):

- If failurePolicy=Fail, reject the request

- If failurePolicy=Ignore, the policy is skipped

func (*MutatingAdmissionPolicySpecDie) MatchConditions

matchConditions is a list of conditions that must be met for a request to be validated.

Match conditions filter requests that have already been matched by the matchConstraints.

An empty list of matchConditions matches all requests.

There are a maximum of 64 match conditions allowed.

If a parameter object is provided, it can be accessed via the `params` handle in the same

manner as validation expressions.

The exact matching logic is (in order):

1. If ANY matchCondition evaluates to FALSE, the policy is skipped.

2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.

3. If any matchCondition evaluates to an error (but none are FALSE):

- If failurePolicy=Fail, reject the request

- If failurePolicy=Ignore, the policy is skipped

func (*MutatingAdmissionPolicySpecDie) MatchConstraints

matchConstraints specifies what resources this policy is designed to validate.

The MutatingAdmissionPolicy cares about a request if it matches _all_ Constraints.

However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API

MutatingAdmissionPolicy cannot match MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding.

The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched.

'*' matches CREATE, UPDATE and CONNECT.

Required.

func (*MutatingAdmissionPolicySpecDie) MatchConstraintsDie

MatchConstraintsDie mutates MatchConstraints as a die.

matchConstraints specifies what resources this policy is designed to validate.

The MutatingAdmissionPolicy cares about a request if it matches _all_ Constraints.

However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API

MutatingAdmissionPolicy cannot match MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding.

The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched.

'*' matches CREATE, UPDATE and CONNECT.

Required.

func (*MutatingAdmissionPolicySpecDie) Mutations

mutations contain operations to perform on matching objects.

mutations may not be empty; a minimum of one mutation is required.

mutations are evaluated in order, and are reinvoked according to

the reinvocationPolicy.

The mutations of a policy are invoked for each binding of this policy

and reinvocation of mutations occurs on a per binding basis.

func (*MutatingAdmissionPolicySpecDie) MutationsDie

MutationsDie replaces Mutations by collecting the released value from each die passed.

mutations contain operations to perform on matching objects.

mutations may not be empty; a minimum of one mutation is required.

mutations are evaluated in order, and are reinvoked according to

the reinvocationPolicy.

The mutations of a policy are invoked for each binding of this policy

and reinvocation of mutations occurs on a per binding basis.

func (*MutatingAdmissionPolicySpecDie) ParamKind

paramKind specifies the kind of resources used to parameterize this policy.

If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions.

If paramKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied.

If paramKind is specified but paramRef is unset in MutatingAdmissionPolicyBinding, the params variable will be null.

func (*MutatingAdmissionPolicySpecDie) ParamKindDie

ParamKindDie mutates ParamKind as a die.

paramKind specifies the kind of resources used to parameterize this policy.

If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions.

If paramKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied.

If paramKind is specified but paramRef is unset in MutatingAdmissionPolicyBinding, the params variable will be null.

func (*MutatingAdmissionPolicySpecDie) ReinvocationPolicy

reinvocationPolicy indicates whether mutations may be called multiple times per MutatingAdmissionPolicyBinding

as part of a single admission evaluation.

Allowed values are "Never" and "IfNeeded".

Never: These mutations will not be called more than once per binding in a single admission evaluation.

IfNeeded: These mutations may be invoked more than once per binding for a single admission request and there is no guarantee of

order with respect to other admission plugins, admission webhooks, bindings of this policy and admission policies. Mutations are only

reinvoked when mutations change the object after this mutation is invoked.

Required.

func (*MutatingAdmissionPolicySpecDie) Variables

variables contain definitions of variables that can be used in composition of other expressions.

Each variable is defined as a named CEL expression.

The variables defined here will be available under `variables` in other expressions of the policy

except matchConditions because matchConditions are evaluated before the rest of the policy.

The expression of a variable can refer to other variables defined earlier in the list but not those after.

Thus, variables must be sorted by the order of first appearance and acyclic.

func (*MutatingAdmissionPolicySpecDie) VariablesDie

VariablesDie replaces Variables by collecting the released value from each die passed.

variables contain definitions of variables that can be used in composition of other expressions.

Each variable is defined as a named CEL expression.

The variables defined here will be available under `variables` in other expressions of the policy

except matchConditions because matchConditions are evaluated before the rest of the policy.

The expression of a variable can refer to other variables defined earlier in the list but not those after.

Thus, variables must be sorted by the order of first appearance and acyclic.

type MutationDie

type MutationDie struct {
	// contains filtered or unexported fields
}

func (*MutationDie) ApplyConfiguration

applyConfiguration defines the desired configuration values of an object.

The configuration is applied to the admission object using

[structured merge diff](https://github.com/kubernetes-sigs/structured-merge-diff).

A CEL expression is used to create apply configuration.

func (*MutationDie) ApplyConfigurationDie

func (d *MutationDie) ApplyConfigurationDie(fn func(d *ApplyConfigurationDie)) *MutationDie

ApplyConfigurationDie mutates ApplyConfiguration as a die.

applyConfiguration defines the desired configuration values of an object.

The configuration is applied to the admission object using

[structured merge diff](https://github.com/kubernetes-sigs/structured-merge-diff).

A CEL expression is used to create apply configuration.

func (*MutationDie) DeepCopy

func (d *MutationDie) DeepCopy() *MutationDie

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*MutationDie) DieDiff

func (d *MutationDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*MutationDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*MutationDie) DieFeedJSON

func (d *MutationDie) DieFeedJSON(j []byte) *MutationDie

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*MutationDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*MutationDie) DieFeedRawExtension

func (d *MutationDie) DieFeedRawExtension(raw runtime.RawExtension) *MutationDie

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MutationDie) DieFeedYAML

func (d *MutationDie) DieFeedYAML(y []byte) *MutationDie

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*MutationDie) DieFeedYAMLFile

func (d *MutationDie) DieFeedYAMLFile(name string) *MutationDie

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*MutationDie) DieImmutable

func (d *MutationDie) DieImmutable(immutable bool) *MutationDie

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*MutationDie) DiePatch

func (d *MutationDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*MutationDie) DieRelease

DieRelease returns the resource managed by the die.

func (*MutationDie) DieReleaseJSON

func (d *MutationDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*MutationDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*MutationDie) DieReleaseRawExtension

func (d *MutationDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*MutationDie) DieReleaseYAML

func (d *MutationDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*MutationDie) DieSeal

func (d *MutationDie) DieSeal() *MutationDie

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*MutationDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*MutationDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*MutationDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*MutationDie) DieSealReleasePtr

func (d *MutationDie) DieSealReleasePtr() *admissionregistrationv1alpha1.Mutation

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*MutationDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*MutationDie) DieStampAt

func (d *MutationDie) DieStampAt(jp string, fn interface{}) *MutationDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*MutationDie) DieWith

func (d *MutationDie) DieWith(fns ...func(d *MutationDie)) *MutationDie

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*MutationDie) JSONPatch

jsonPatch defines a [JSON patch](https://jsonpatch.com/) operation to perform a mutation to the object.

A CEL expression is used to create the JSON patch.

func (*MutationDie) JSONPatchDie

func (d *MutationDie) JSONPatchDie(fn func(d *JSONPatchDie)) *MutationDie

JSONPatchDie mutates JSONPatch as a die.

jsonPatch defines a [JSON patch](https://jsonpatch.com/) operation to perform a mutation to the object.

A CEL expression is used to create the JSON patch.

func (*MutationDie) PatchType

patchType indicates the patch strategy used.

Allowed values are "ApplyConfiguration" and "JSONPatch".

Required.

type NamedRuleWithOperationsDie

type NamedRuleWithOperationsDie struct {
	// contains filtered or unexported fields
}

func (*NamedRuleWithOperationsDie) DeepCopy

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*NamedRuleWithOperationsDie) DieDiff

func (d *NamedRuleWithOperationsDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*NamedRuleWithOperationsDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*NamedRuleWithOperationsDie) DieFeedJSON

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*NamedRuleWithOperationsDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*NamedRuleWithOperationsDie) DieFeedRawExtension

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*NamedRuleWithOperationsDie) DieFeedYAML

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*NamedRuleWithOperationsDie) DieFeedYAMLFile

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*NamedRuleWithOperationsDie) DieImmutable

func (d *NamedRuleWithOperationsDie) DieImmutable(immutable bool) *NamedRuleWithOperationsDie

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*NamedRuleWithOperationsDie) DiePatch

func (d *NamedRuleWithOperationsDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*NamedRuleWithOperationsDie) DieRelease

DieRelease returns the resource managed by the die.

func (*NamedRuleWithOperationsDie) DieReleaseJSON

func (d *NamedRuleWithOperationsDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*NamedRuleWithOperationsDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*NamedRuleWithOperationsDie) DieReleaseRawExtension

func (d *NamedRuleWithOperationsDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*NamedRuleWithOperationsDie) DieReleaseYAML

func (d *NamedRuleWithOperationsDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*NamedRuleWithOperationsDie) DieSeal

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*NamedRuleWithOperationsDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*NamedRuleWithOperationsDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*NamedRuleWithOperationsDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*NamedRuleWithOperationsDie) DieSealReleasePtr

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*NamedRuleWithOperationsDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*NamedRuleWithOperationsDie) DieStampAt

func (d *NamedRuleWithOperationsDie) DieStampAt(jp string, fn interface{}) *NamedRuleWithOperationsDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*NamedRuleWithOperationsDie) DieWith

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*NamedRuleWithOperationsDie) ResourceNames

ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.

func (*NamedRuleWithOperationsDie) RuleWithOperations

RuleWithOperations is a tuple of Operations and Resources.

func (*NamedRuleWithOperationsDie) RuleWithOperationsDie

RuleWithOperationsDie mutates RuleWithOperations as a die.

RuleWithOperations is a tuple of Operations and Resources.

type ParamKindDie

type ParamKindDie struct {
	// contains filtered or unexported fields
}

func (*ParamKindDie) APIVersion

func (d *ParamKindDie) APIVersion(v string) *ParamKindDie

APIVersion is the API group version the resources belong to.

In format of "group/version".

Required.

func (*ParamKindDie) DeepCopy

func (d *ParamKindDie) DeepCopy() *ParamKindDie

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*ParamKindDie) DieDiff

func (d *ParamKindDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*ParamKindDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*ParamKindDie) DieFeedJSON

func (d *ParamKindDie) DieFeedJSON(j []byte) *ParamKindDie

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*ParamKindDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*ParamKindDie) DieFeedRawExtension

func (d *ParamKindDie) DieFeedRawExtension(raw runtime.RawExtension) *ParamKindDie

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*ParamKindDie) DieFeedYAML

func (d *ParamKindDie) DieFeedYAML(y []byte) *ParamKindDie

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*ParamKindDie) DieFeedYAMLFile

func (d *ParamKindDie) DieFeedYAMLFile(name string) *ParamKindDie

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*ParamKindDie) DieImmutable

func (d *ParamKindDie) DieImmutable(immutable bool) *ParamKindDie

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*ParamKindDie) DiePatch

func (d *ParamKindDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*ParamKindDie) DieRelease

DieRelease returns the resource managed by the die.

func (*ParamKindDie) DieReleaseJSON

func (d *ParamKindDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*ParamKindDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*ParamKindDie) DieReleaseRawExtension

func (d *ParamKindDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*ParamKindDie) DieReleaseYAML

func (d *ParamKindDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*ParamKindDie) DieSeal

func (d *ParamKindDie) DieSeal() *ParamKindDie

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*ParamKindDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*ParamKindDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*ParamKindDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*ParamKindDie) DieSealReleasePtr

func (d *ParamKindDie) DieSealReleasePtr() *admissionregistrationv1alpha1.ParamKind

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*ParamKindDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*ParamKindDie) DieStampAt

func (d *ParamKindDie) DieStampAt(jp string, fn interface{}) *ParamKindDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*ParamKindDie) DieWith

func (d *ParamKindDie) DieWith(fns ...func(d *ParamKindDie)) *ParamKindDie

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*ParamKindDie) Kind

func (d *ParamKindDie) Kind(v string) *ParamKindDie

Kind is the API kind the resources belong to.

Required.

type VariableDie

type VariableDie struct {
	// contains filtered or unexported fields
}

func (*VariableDie) DeepCopy

func (d *VariableDie) DeepCopy() *VariableDie

DeepCopy returns a new die with equivalent state. Useful for snapshotting a mutable die.

func (*VariableDie) DieDiff

func (d *VariableDie) DieDiff(opts ...cmp.Option) string

DieDiff uses cmp.Diff to compare the current value of the die with the sealed value.

func (*VariableDie) DieFeed

DieFeed returns a new die with the provided resource.

func (*VariableDie) DieFeedJSON

func (d *VariableDie) DieFeedJSON(j []byte) *VariableDie

DieFeedJSON returns a new die with the provided JSON. Panics on error.

func (*VariableDie) DieFeedPtr

DieFeedPtr returns a new die with the provided resource pointer. If the resource is nil, the empty value is used instead.

func (*VariableDie) DieFeedRawExtension

func (d *VariableDie) DieFeedRawExtension(raw runtime.RawExtension) *VariableDie

DieFeedRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*VariableDie) DieFeedYAML

func (d *VariableDie) DieFeedYAML(y []byte) *VariableDie

DieFeedYAML returns a new die with the provided YAML. Panics on error.

func (*VariableDie) DieFeedYAMLFile

func (d *VariableDie) DieFeedYAMLFile(name string) *VariableDie

DieFeedYAMLFile returns a new die loading YAML from a file path. Panics on error.

func (*VariableDie) DieImmutable

func (d *VariableDie) DieImmutable(immutable bool) *VariableDie

DieImmutable returns a new die for the current die's state that is either mutable (`false`) or immutable (`true`).

func (*VariableDie) DiePatch

func (d *VariableDie) DiePatch(patchType types.PatchType) ([]byte, error)

DiePatch generates a patch between the current value of the die and the sealed value.

func (*VariableDie) DieRelease

DieRelease returns the resource managed by the die.

func (*VariableDie) DieReleaseJSON

func (d *VariableDie) DieReleaseJSON() []byte

DieReleaseJSON returns the resource managed by the die as JSON. Panics on error.

func (*VariableDie) DieReleasePtr

DieReleasePtr returns a pointer to the resource managed by the die.

func (*VariableDie) DieReleaseRawExtension

func (d *VariableDie) DieReleaseRawExtension() runtime.RawExtension

DieReleaseRawExtension returns the resource managed by the die as an raw extension. Panics on error.

func (*VariableDie) DieReleaseYAML

func (d *VariableDie) DieReleaseYAML() []byte

DieReleaseYAML returns the resource managed by the die as YAML. Panics on error.

func (*VariableDie) DieSeal

func (d *VariableDie) DieSeal() *VariableDie

DieSeal returns a new die for the current die's state that is sealed for comparison in future diff and patch operations.

func (*VariableDie) DieSealFeed

DieSealFeed returns a new die for the current die's state that uses a specific resource for comparison in future diff and patch operations.

func (*VariableDie) DieSealFeedPtr

DieSealFeedPtr returns a new die for the current die's state that uses a specific resource pointer for comparison in future diff and patch operations. If the resource is nil, the empty value is used instead.

func (*VariableDie) DieSealRelease

DieSealRelease returns the sealed resource managed by the die.

func (*VariableDie) DieSealReleasePtr

func (d *VariableDie) DieSealReleasePtr() *admissionregistrationv1alpha1.Variable

DieSealReleasePtr returns the sealed resource pointer managed by the die.

func (*VariableDie) DieStamp

DieStamp returns a new die with the resource passed to the callback function. The resource is mutable.

func (*VariableDie) DieStampAt

func (d *VariableDie) DieStampAt(jp string, fn interface{}) *VariableDie

Experimental: DieStampAt uses a JSON path (http://goessner.net/articles/JsonPath/) expression to stamp portions of the resource. The callback is invoked with each JSON path match. Panics if the callback function does not accept a single argument of the same type or a pointer to that type as found on the resource at the target location.

Future iterations will improve type coercion from the resource to the callback argument.

func (*VariableDie) DieWith

func (d *VariableDie) DieWith(fns ...func(d *VariableDie)) *VariableDie

DieWith returns a new die after passing the current die to the callback function. The passed die is mutable.

func (*VariableDie) Expression

func (d *VariableDie) Expression(v string) *VariableDie

Expression is the expression that will be evaluated as the value of the variable.

The CEL expression has access to the same identifiers as the CEL expressions in Validation.

func (*VariableDie) Name

func (d *VariableDie) Name(v string) *VariableDie

Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables.

The variable can be accessed in other expressions through `variables`

For example, if name is "foo", the variable will be available as `variables.foo`

Jump to

Keyboard shortcuts

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