mirror of
https://github.com/kyverno/kyverno.git
synced 2025-04-08 10:04:25 +00:00
Merge pull request #2496 from vyankyGH/autogen_mutate_foreach
Fix autogen issue for foreach mutate policy and foreach type issue
This commit is contained in:
commit
c16de81751
9 changed files with 863 additions and 0 deletions
|
@ -1437,6 +1437,143 @@ spec:
|
|||
mutate:
|
||||
description: Mutation is used to modify matching resources.
|
||||
properties:
|
||||
foreach:
|
||||
description: ForEach applies policy rule changes to nested
|
||||
elements.
|
||||
properties:
|
||||
context:
|
||||
description: Context defines variables and data sources
|
||||
that can be used during rule execution.
|
||||
items:
|
||||
description: ContextEntry adds variables and data
|
||||
sources to a rule Context. Either a ConfigMap reference
|
||||
or a APILookup must be provided.
|
||||
properties:
|
||||
apiCall:
|
||||
description: APICall defines an HTTP request to
|
||||
the Kubernetes API server. The JSON data retrieved
|
||||
is stored in the context.
|
||||
properties:
|
||||
jmesPath:
|
||||
description: JMESPath is an optional JSON
|
||||
Match Expression that can be used to transform
|
||||
the JSON response returned from the API
|
||||
server. For example a JMESPath of "items
|
||||
| length(@)" applied to the API server response
|
||||
to the URLPath "/apis/apps/v1/deployments"
|
||||
will return the total count of deployments
|
||||
across all namespaces.
|
||||
type: string
|
||||
urlPath:
|
||||
description: URLPath is the URL path to be
|
||||
used in the HTTP GET request to the Kubernetes
|
||||
API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
|
||||
The format required is the same format used
|
||||
by the `kubectl get --raw` command.
|
||||
type: string
|
||||
required:
|
||||
- urlPath
|
||||
type: object
|
||||
configMap:
|
||||
description: ConfigMap is the ConfigMap reference.
|
||||
properties:
|
||||
name:
|
||||
description: Name is the ConfigMap name.
|
||||
type: string
|
||||
namespace:
|
||||
description: Namespace is the ConfigMap namespace.
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
name:
|
||||
description: Name is the variable name.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
list:
|
||||
description: List specifies a JMESPath expression that
|
||||
results in one or more elements to which the validation
|
||||
logic is applied.
|
||||
type: string
|
||||
patchStrategicMerge:
|
||||
description: PatchStrategicMerge is a strategic merge
|
||||
patch used to modify resources. See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
|
||||
and https://kubectl.docs.kubernetes.io/references/kustomize/patchesstrategicmerge/.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
preconditions:
|
||||
description: 'Preconditions are used to determine if
|
||||
a policy rule should be applied by evaluating a set
|
||||
of conditions. The declaration can contain nested
|
||||
`any` or `all` statements. See: https://kyverno.io/docs/writing-policies/preconditions/'
|
||||
properties:
|
||||
all:
|
||||
description: AllConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, all of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
any:
|
||||
description: AnyConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, at least one of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
overlay:
|
||||
description: Overlay specifies an overlay pattern to modify
|
||||
resources. DEPRECATED. Use PatchStrategicMerge instead.
|
||||
|
|
|
@ -1438,6 +1438,143 @@ spec:
|
|||
mutate:
|
||||
description: Mutation is used to modify matching resources.
|
||||
properties:
|
||||
foreach:
|
||||
description: ForEach applies policy rule changes to nested
|
||||
elements.
|
||||
properties:
|
||||
context:
|
||||
description: Context defines variables and data sources
|
||||
that can be used during rule execution.
|
||||
items:
|
||||
description: ContextEntry adds variables and data
|
||||
sources to a rule Context. Either a ConfigMap reference
|
||||
or a APILookup must be provided.
|
||||
properties:
|
||||
apiCall:
|
||||
description: APICall defines an HTTP request to
|
||||
the Kubernetes API server. The JSON data retrieved
|
||||
is stored in the context.
|
||||
properties:
|
||||
jmesPath:
|
||||
description: JMESPath is an optional JSON
|
||||
Match Expression that can be used to transform
|
||||
the JSON response returned from the API
|
||||
server. For example a JMESPath of "items
|
||||
| length(@)" applied to the API server response
|
||||
to the URLPath "/apis/apps/v1/deployments"
|
||||
will return the total count of deployments
|
||||
across all namespaces.
|
||||
type: string
|
||||
urlPath:
|
||||
description: URLPath is the URL path to be
|
||||
used in the HTTP GET request to the Kubernetes
|
||||
API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
|
||||
The format required is the same format used
|
||||
by the `kubectl get --raw` command.
|
||||
type: string
|
||||
required:
|
||||
- urlPath
|
||||
type: object
|
||||
configMap:
|
||||
description: ConfigMap is the ConfigMap reference.
|
||||
properties:
|
||||
name:
|
||||
description: Name is the ConfigMap name.
|
||||
type: string
|
||||
namespace:
|
||||
description: Namespace is the ConfigMap namespace.
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
name:
|
||||
description: Name is the variable name.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
list:
|
||||
description: List specifies a JMESPath expression that
|
||||
results in one or more elements to which the validation
|
||||
logic is applied.
|
||||
type: string
|
||||
patchStrategicMerge:
|
||||
description: PatchStrategicMerge is a strategic merge
|
||||
patch used to modify resources. See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
|
||||
and https://kubectl.docs.kubernetes.io/references/kustomize/patchesstrategicmerge/.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
preconditions:
|
||||
description: 'Preconditions are used to determine if
|
||||
a policy rule should be applied by evaluating a set
|
||||
of conditions. The declaration can contain nested
|
||||
`any` or `all` statements. See: https://kyverno.io/docs/writing-policies/preconditions/'
|
||||
properties:
|
||||
all:
|
||||
description: AllConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, all of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
any:
|
||||
description: AnyConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, at least one of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
overlay:
|
||||
description: Overlay specifies an overlay pattern to modify
|
||||
resources. DEPRECATED. Use PatchStrategicMerge instead.
|
||||
|
|
|
@ -899,6 +899,143 @@ spec:
|
|||
mutate:
|
||||
description: Mutation is used to modify matching resources.
|
||||
properties:
|
||||
foreach:
|
||||
description: ForEach applies policy rule changes to nested
|
||||
elements.
|
||||
properties:
|
||||
context:
|
||||
description: Context defines variables and data sources
|
||||
that can be used during rule execution.
|
||||
items:
|
||||
description: ContextEntry adds variables and data
|
||||
sources to a rule Context. Either a ConfigMap reference
|
||||
or a APILookup must be provided.
|
||||
properties:
|
||||
apiCall:
|
||||
description: APICall defines an HTTP request to
|
||||
the Kubernetes API server. The JSON data retrieved
|
||||
is stored in the context.
|
||||
properties:
|
||||
jmesPath:
|
||||
description: JMESPath is an optional JSON
|
||||
Match Expression that can be used to transform
|
||||
the JSON response returned from the API
|
||||
server. For example a JMESPath of "items
|
||||
| length(@)" applied to the API server response
|
||||
to the URLPath "/apis/apps/v1/deployments"
|
||||
will return the total count of deployments
|
||||
across all namespaces.
|
||||
type: string
|
||||
urlPath:
|
||||
description: URLPath is the URL path to be
|
||||
used in the HTTP GET request to the Kubernetes
|
||||
API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
|
||||
The format required is the same format used
|
||||
by the `kubectl get --raw` command.
|
||||
type: string
|
||||
required:
|
||||
- urlPath
|
||||
type: object
|
||||
configMap:
|
||||
description: ConfigMap is the ConfigMap reference.
|
||||
properties:
|
||||
name:
|
||||
description: Name is the ConfigMap name.
|
||||
type: string
|
||||
namespace:
|
||||
description: Namespace is the ConfigMap namespace.
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
name:
|
||||
description: Name is the variable name.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
list:
|
||||
description: List specifies a JMESPath expression that
|
||||
results in one or more elements to which the validation
|
||||
logic is applied.
|
||||
type: string
|
||||
patchStrategicMerge:
|
||||
description: PatchStrategicMerge is a strategic merge
|
||||
patch used to modify resources. See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
|
||||
and https://kubectl.docs.kubernetes.io/references/kustomize/patchesstrategicmerge/.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
preconditions:
|
||||
description: 'Preconditions are used to determine if
|
||||
a policy rule should be applied by evaluating a set
|
||||
of conditions. The declaration can contain nested
|
||||
`any` or `all` statements. See: https://kyverno.io/docs/writing-policies/preconditions/'
|
||||
properties:
|
||||
all:
|
||||
description: AllConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, all of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
any:
|
||||
description: AnyConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, at least one of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
overlay:
|
||||
description: Overlay specifies an overlay pattern to modify resources. DEPRECATED. Use PatchStrategicMerge instead. Scheduled for removal in release 1.5+.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
|
@ -3218,6 +3355,143 @@ spec:
|
|||
mutate:
|
||||
description: Mutation is used to modify matching resources.
|
||||
properties:
|
||||
foreach:
|
||||
description: ForEach applies policy rule changes to nested
|
||||
elements.
|
||||
properties:
|
||||
context:
|
||||
description: Context defines variables and data sources
|
||||
that can be used during rule execution.
|
||||
items:
|
||||
description: ContextEntry adds variables and data
|
||||
sources to a rule Context. Either a ConfigMap reference
|
||||
or a APILookup must be provided.
|
||||
properties:
|
||||
apiCall:
|
||||
description: APICall defines an HTTP request to
|
||||
the Kubernetes API server. The JSON data retrieved
|
||||
is stored in the context.
|
||||
properties:
|
||||
jmesPath:
|
||||
description: JMESPath is an optional JSON
|
||||
Match Expression that can be used to transform
|
||||
the JSON response returned from the API
|
||||
server. For example a JMESPath of "items
|
||||
| length(@)" applied to the API server response
|
||||
to the URLPath "/apis/apps/v1/deployments"
|
||||
will return the total count of deployments
|
||||
across all namespaces.
|
||||
type: string
|
||||
urlPath:
|
||||
description: URLPath is the URL path to be
|
||||
used in the HTTP GET request to the Kubernetes
|
||||
API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
|
||||
The format required is the same format used
|
||||
by the `kubectl get --raw` command.
|
||||
type: string
|
||||
required:
|
||||
- urlPath
|
||||
type: object
|
||||
configMap:
|
||||
description: ConfigMap is the ConfigMap reference.
|
||||
properties:
|
||||
name:
|
||||
description: Name is the ConfigMap name.
|
||||
type: string
|
||||
namespace:
|
||||
description: Namespace is the ConfigMap namespace.
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
name:
|
||||
description: Name is the variable name.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
list:
|
||||
description: List specifies a JMESPath expression that
|
||||
results in one or more elements to which the validation
|
||||
logic is applied.
|
||||
type: string
|
||||
patchStrategicMerge:
|
||||
description: PatchStrategicMerge is a strategic merge
|
||||
patch used to modify resources. See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
|
||||
and https://kubectl.docs.kubernetes.io/references/kustomize/patchesstrategicmerge/.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
preconditions:
|
||||
description: 'Preconditions are used to determine if
|
||||
a policy rule should be applied by evaluating a set
|
||||
of conditions. The declaration can contain nested
|
||||
`any` or `all` statements. See: https://kyverno.io/docs/writing-policies/preconditions/'
|
||||
properties:
|
||||
all:
|
||||
description: AllConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, all of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
any:
|
||||
description: AnyConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, at least one of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
overlay:
|
||||
description: Overlay specifies an overlay pattern to modify resources. DEPRECATED. Use PatchStrategicMerge instead. Scheduled for removal in release 1.5+.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
|
|
|
@ -886,6 +886,143 @@ spec:
|
|||
mutate:
|
||||
description: Mutation is used to modify matching resources.
|
||||
properties:
|
||||
foreach:
|
||||
description: ForEach applies policy rule changes to nested
|
||||
elements.
|
||||
properties:
|
||||
context:
|
||||
description: Context defines variables and data sources
|
||||
that can be used during rule execution.
|
||||
items:
|
||||
description: ContextEntry adds variables and data
|
||||
sources to a rule Context. Either a ConfigMap reference
|
||||
or a APILookup must be provided.
|
||||
properties:
|
||||
apiCall:
|
||||
description: APICall defines an HTTP request to
|
||||
the Kubernetes API server. The JSON data retrieved
|
||||
is stored in the context.
|
||||
properties:
|
||||
jmesPath:
|
||||
description: JMESPath is an optional JSON
|
||||
Match Expression that can be used to transform
|
||||
the JSON response returned from the API
|
||||
server. For example a JMESPath of "items
|
||||
| length(@)" applied to the API server response
|
||||
to the URLPath "/apis/apps/v1/deployments"
|
||||
will return the total count of deployments
|
||||
across all namespaces.
|
||||
type: string
|
||||
urlPath:
|
||||
description: URLPath is the URL path to be
|
||||
used in the HTTP GET request to the Kubernetes
|
||||
API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
|
||||
The format required is the same format used
|
||||
by the `kubectl get --raw` command.
|
||||
type: string
|
||||
required:
|
||||
- urlPath
|
||||
type: object
|
||||
configMap:
|
||||
description: ConfigMap is the ConfigMap reference.
|
||||
properties:
|
||||
name:
|
||||
description: Name is the ConfigMap name.
|
||||
type: string
|
||||
namespace:
|
||||
description: Namespace is the ConfigMap namespace.
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
name:
|
||||
description: Name is the variable name.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
list:
|
||||
description: List specifies a JMESPath expression that
|
||||
results in one or more elements to which the validation
|
||||
logic is applied.
|
||||
type: string
|
||||
patchStrategicMerge:
|
||||
description: PatchStrategicMerge is a strategic merge
|
||||
patch used to modify resources. See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
|
||||
and https://kubectl.docs.kubernetes.io/references/kustomize/patchesstrategicmerge/.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
preconditions:
|
||||
description: 'Preconditions are used to determine if
|
||||
a policy rule should be applied by evaluating a set
|
||||
of conditions. The declaration can contain nested
|
||||
`any` or `all` statements. See: https://kyverno.io/docs/writing-policies/preconditions/'
|
||||
properties:
|
||||
all:
|
||||
description: AllConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, all of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
any:
|
||||
description: AnyConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, at least one of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
overlay:
|
||||
description: Overlay specifies an overlay pattern to modify resources. DEPRECATED. Use PatchStrategicMerge instead. Scheduled for removal in release 1.5+.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
|
@ -3177,6 +3314,143 @@ spec:
|
|||
mutate:
|
||||
description: Mutation is used to modify matching resources.
|
||||
properties:
|
||||
foreach:
|
||||
description: ForEach applies policy rule changes to nested
|
||||
elements.
|
||||
properties:
|
||||
context:
|
||||
description: Context defines variables and data sources
|
||||
that can be used during rule execution.
|
||||
items:
|
||||
description: ContextEntry adds variables and data
|
||||
sources to a rule Context. Either a ConfigMap reference
|
||||
or a APILookup must be provided.
|
||||
properties:
|
||||
apiCall:
|
||||
description: APICall defines an HTTP request to
|
||||
the Kubernetes API server. The JSON data retrieved
|
||||
is stored in the context.
|
||||
properties:
|
||||
jmesPath:
|
||||
description: JMESPath is an optional JSON
|
||||
Match Expression that can be used to transform
|
||||
the JSON response returned from the API
|
||||
server. For example a JMESPath of "items
|
||||
| length(@)" applied to the API server response
|
||||
to the URLPath "/apis/apps/v1/deployments"
|
||||
will return the total count of deployments
|
||||
across all namespaces.
|
||||
type: string
|
||||
urlPath:
|
||||
description: URLPath is the URL path to be
|
||||
used in the HTTP GET request to the Kubernetes
|
||||
API server (e.g. "/api/v1/namespaces" or "/apis/apps/v1/deployments").
|
||||
The format required is the same format used
|
||||
by the `kubectl get --raw` command.
|
||||
type: string
|
||||
required:
|
||||
- urlPath
|
||||
type: object
|
||||
configMap:
|
||||
description: ConfigMap is the ConfigMap reference.
|
||||
properties:
|
||||
name:
|
||||
description: Name is the ConfigMap name.
|
||||
type: string
|
||||
namespace:
|
||||
description: Namespace is the ConfigMap namespace.
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
name:
|
||||
description: Name is the variable name.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
list:
|
||||
description: List specifies a JMESPath expression that
|
||||
results in one or more elements to which the validation
|
||||
logic is applied.
|
||||
type: string
|
||||
patchStrategicMerge:
|
||||
description: PatchStrategicMerge is a strategic merge
|
||||
patch used to modify resources. See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
|
||||
and https://kubectl.docs.kubernetes.io/references/kustomize/patchesstrategicmerge/.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
preconditions:
|
||||
description: 'Preconditions are used to determine if
|
||||
a policy rule should be applied by evaluating a set
|
||||
of conditions. The declaration can contain nested
|
||||
`any` or `all` statements. See: https://kyverno.io/docs/writing-policies/preconditions/'
|
||||
properties:
|
||||
all:
|
||||
description: AllConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, all of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
any:
|
||||
description: AnyConditions enable variable-based
|
||||
conditional rule execution. This is useful for
|
||||
finer control of when an rule is applied. A condition
|
||||
can reference object data using JMESPath notation.
|
||||
Here, at least one of the conditions need to pass
|
||||
items:
|
||||
description: Condition defines variable-based
|
||||
conditional criteria for rule execution.
|
||||
properties:
|
||||
key:
|
||||
description: Key is the context entry (using
|
||||
JMESPath) for conditional rule evaluation.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
operator:
|
||||
description: Operator is the operation to
|
||||
perform. Valid operators are Equals, NotEquals,
|
||||
In and NotIn.
|
||||
enum:
|
||||
- Equals
|
||||
- NotEquals
|
||||
- In
|
||||
- NotIn
|
||||
type: string
|
||||
value:
|
||||
description: Value is the conditional value,
|
||||
or set of values. The values can be fixed
|
||||
set or can be variables declared using using
|
||||
JMESPath.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
overlay:
|
||||
description: Overlay specifies an overlay pattern to modify resources. DEPRECATED. Use PatchStrategicMerge instead. Scheduled for removal in release 1.5+.
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
|
|
|
@ -404,6 +404,7 @@ type Mutation struct {
|
|||
PatchesJSON6902 string `json:"patchesJson6902,omitempty" yaml:"patchesJson6902,omitempty"`
|
||||
|
||||
// ForEach applies policy rule changes to nested elements.
|
||||
// +optional
|
||||
ForEachMutation *ForEachMutation `json:"foreach,omitempty" yaml:"foreach,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
@ -185,6 +185,12 @@ func (in *ForEachValidation) DeepCopyInto(out *ForEachValidation) {
|
|||
*out = *in
|
||||
}
|
||||
}
|
||||
|
||||
func (in *ForEachMutation) DeepCopyInto(out *ForEachMutation) {
|
||||
if out != nil {
|
||||
*out = *in
|
||||
}
|
||||
}
|
||||
func (gen *Generation) DeepCopyInto(out *Generation) {
|
||||
if out != nil {
|
||||
*out = *gen
|
||||
|
|
|
@ -297,6 +297,16 @@ func (in *ForEachValidation) DeepCopy() *ForEachValidation {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ForEachMutation.
|
||||
func (in *ForEachMutation) DeepCopy() *ForEachMutation {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ForEachMutation)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GenerateRequest) DeepCopyInto(out *GenerateRequest) {
|
||||
*out = *in
|
||||
|
|
|
@ -144,6 +144,22 @@ func generateCronJobRule(rule kyverno.Rule, controllers string, log logr.Logger)
|
|||
return *cronJobRule
|
||||
}
|
||||
|
||||
if (jobRule.Mutation != nil) && (jobRule.Mutation.ForEachMutation != nil) && (jobRule.Mutation.ForEachMutation.PatchStrategicMerge != nil) {
|
||||
cronJobRule.Mutation = &kyverno.Mutation{
|
||||
ForEachMutation: jobRule.Mutation.ForEachMutation,
|
||||
}
|
||||
return *cronJobRule
|
||||
}
|
||||
|
||||
if jobRule.VerifyImages != nil {
|
||||
newVerifyImages := make([]*kyverno.ImageVerification, len(jobRule.VerifyImages))
|
||||
for i, vi := range rule.VerifyImages {
|
||||
newVerifyImages[i] = vi.DeepCopy()
|
||||
}
|
||||
cronJobRule.VerifyImages = newVerifyImages
|
||||
return *cronJobRule
|
||||
}
|
||||
|
||||
return kyvernoRule{}
|
||||
}
|
||||
|
||||
|
|
|
@ -724,6 +724,14 @@ func generateRuleForControllers(rule kyverno.Rule, controllers string, log logr.
|
|||
return *controllerRule
|
||||
}
|
||||
|
||||
if rule.Mutation.ForEachMutation != nil && rule.Mutation.ForEachMutation.PatchStrategicMerge != nil {
|
||||
newForeachMutation := &kyverno.Mutation{
|
||||
ForEachMutation: rule.Mutation.ForEachMutation,
|
||||
}
|
||||
controllerRule.Mutation = newForeachMutation.DeepCopy()
|
||||
return *controllerRule
|
||||
}
|
||||
|
||||
if rule.Validation.Pattern != nil {
|
||||
newValidate := &kyverno.Validation{
|
||||
Message: variables.FindAndShiftReferences(log, rule.Validation.Message, "spec/template", "pattern"),
|
||||
|
|
Loading…
Add table
Reference in a new issue