Skip to content

Commit a1f46a7

Browse files
committed
feat: Enable VPOL validationActions override in PolicyExceptions
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
1 parent 1384610 commit a1f46a7

6 files changed

Lines changed: 120 additions & 0 deletions

File tree

api/policies.kyverno.io/v1alpha1/policy_exception.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ type PolicyRef struct {
9393

9494
// Kind is the kind of the policy
9595
Kind string `json:"kind"`
96+
97+
// ValidationAction overrides the policy's validation action when set
98+
// +optional
99+
// +kubebuilder:validation:Enum=Deny;Audit;Warn
100+
ValidationAction admissionregistrationv1.ValidationAction `json:"validationAction,omitempty"`
96101
}
97102

98103
func (p *PolicyRef) Validate(path *field.Path) (errs field.ErrorList) {

charts/kyverno-api/templates/crds/policies.kyverno.io_policyexceptions.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ spec:
118118
name:
119119
description: Name is the name of the policy
120120
type: string
121+
validationAction:
122+
description: ValidationAction overrides the policy's validation
123+
action when set
124+
enum:
125+
- Deny
126+
- Audit
127+
- Warn
128+
type: string
121129
required:
122130
- kind
123131
- name
@@ -253,6 +261,14 @@ spec:
253261
name:
254262
description: Name is the name of the policy
255263
type: string
264+
validationAction:
265+
description: ValidationAction overrides the policy's validation
266+
action when set
267+
enum:
268+
- Deny
269+
- Audit
270+
- Warn
271+
type: string
256272
required:
257273
- kind
258274
- name
@@ -387,6 +403,14 @@ spec:
387403
name:
388404
description: Name is the name of the policy
389405
type: string
406+
validationAction:
407+
description: ValidationAction overrides the policy's validation
408+
action when set
409+
enum:
410+
- Deny
411+
- Audit
412+
- Warn
413+
type: string
390414
required:
391415
- kind
392416
- name

config/crds.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32083,6 +32083,14 @@ spec:
3208332083
name:
3208432084
description: Name is the name of the policy
3208532085
type: string
32086+
validationAction:
32087+
description: ValidationAction overrides the policy's validation
32088+
action when set
32089+
enum:
32090+
- Deny
32091+
- Audit
32092+
- Warn
32093+
type: string
3208632094
required:
3208732095
- kind
3208832096
- name
@@ -32218,6 +32226,14 @@ spec:
3221832226
name:
3221932227
description: Name is the name of the policy
3222032228
type: string
32229+
validationAction:
32230+
description: ValidationAction overrides the policy's validation
32231+
action when set
32232+
enum:
32233+
- Deny
32234+
- Audit
32235+
- Warn
32236+
type: string
3222132237
required:
3222232238
- kind
3222332239
- name
@@ -32352,6 +32368,14 @@ spec:
3235232368
name:
3235332369
description: Name is the name of the policy
3235432370
type: string
32371+
validationAction:
32372+
description: ValidationAction overrides the policy's validation
32373+
action when set
32374+
enum:
32375+
- Deny
32376+
- Audit
32377+
- Warn
32378+
type: string
3235532379
required:
3235632380
- kind
3235732381
- name

config/crds/policies.kyverno.io_policyexceptions.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ spec:
116116
name:
117117
description: Name is the name of the policy
118118
type: string
119+
validationAction:
120+
description: ValidationAction overrides the policy's validation
121+
action when set
122+
enum:
123+
- Deny
124+
- Audit
125+
- Warn
126+
type: string
119127
required:
120128
- kind
121129
- name
@@ -251,6 +259,14 @@ spec:
251259
name:
252260
description: Name is the name of the policy
253261
type: string
262+
validationAction:
263+
description: ValidationAction overrides the policy's validation
264+
action when set
265+
enum:
266+
- Deny
267+
- Audit
268+
- Warn
269+
type: string
254270
required:
255271
- kind
256272
- name
@@ -385,6 +401,14 @@ spec:
385401
name:
386402
description: Name is the name of the policy
387403
type: string
404+
validationAction:
405+
description: ValidationAction overrides the policy's validation
406+
action when set
407+
enum:
408+
- Deny
409+
- Audit
410+
- Warn
411+
type: string
388412
required:
389413
- kind
390414
- name

docs/user/crd/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6696,6 +6696,20 @@ <h3 id="policies.kyverno.io/v1alpha1.PolicyRef">PolicyRef
66966696
<p>Kind is the kind of the policy</p>
66976697
</td>
66986698
</tr>
6699+
<tr>
6700+
<td>
6701+
<code>validationAction</code><br/>
6702+
<em>
6703+
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#validationaction-v1-admissionregistration">
6704+
Kubernetes admissionregistration/v1.ValidationAction
6705+
</a>
6706+
</em>
6707+
</td>
6708+
<td>
6709+
<em>(Optional)</em>
6710+
<p>ValidationAction overrides the policy&rsquo;s validation action when set</p>
6711+
</td>
6712+
</tr>
66996713
</tbody>
67006714
</table>
67016715
<hr />

docs/user/crd/kyverno_cel_policies.v1alpha1.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8814,6 +8814,35 @@ <H3 id="policies-kyverno-io-v1alpha1-PolicyRef">PolicyRef
88148814
</tr>
88158815

88168816

8817+
8818+
8819+
<tr>
8820+
<td><code>validationAction</code>
8821+
8822+
</br>
8823+
8824+
8825+
8826+
8827+
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.35/#validationaction-v1-admissionregistration">
8828+
<span style="font-family: monospace">admissionregistration/v1.ValidationAction</span>
8829+
</a>
8830+
8831+
8832+
</td>
8833+
<td>
8834+
8835+
8836+
<p>ValidationAction overrides the policy's validation action when set</p>
8837+
8838+
8839+
8840+
8841+
8842+
</td>
8843+
</tr>
8844+
8845+
88178846

88188847

88198848
</tbody>

0 commit comments

Comments
 (0)