feat: Add validationActions field type to PolicyException to override vpol failureAction#85
feat: Add validationActions field type to PolicyException to override vpol failureAction#85onasser1 wants to merge 2 commits into
Conversation
|
Why do we need this? |
|
The original issue is to add this field in policyexception to override the failure action. |
@realshuting I think I misunderstood this, I thought about introducing an override for validationActions |
f495ee2 to
e788b66
Compare
…ure action Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
@realshuting I made changes and updated the PR title and description |
|
|
||
| // ValidationActions overrides the policy's validation actions when set | ||
| // +optional | ||
| ValidationActions []admissionregistrationv1.ValidationAction `json:"validationActions,omitempty"` |
There was a problem hiding this comment.
How can we specify per-policy-level validation actions override?
There was a problem hiding this comment.
@realshuting you mean to have an override value for each policy reference?
so for each defined policy reference should have its own validation actions override? and if does not exist, apply the original policy's action.
Is this what you mean?
There was a problem hiding this comment.
Is this what you mean?
If yes, I think moving this into the PolicyRef type would be sufficient?
#85 (comment)
| type PolicyRef struct { | ||
| // Name is the name of the policy | ||
| Name string `json:"name"` | ||
|
|
||
| // Kind is the kind of the policy | ||
| Kind string `json:"kind"` | ||
| } |
There was a problem hiding this comment.
| type PolicyRef struct { | |
| // Name is the name of the policy | |
| Name string `json:"name"` | |
| // Kind is the kind of the policy | |
| Kind string `json:"kind"` | |
| // ValidationActions overrides the policy's validation actions when set | |
| // +optional | |
| ValidationActions []admissionregistrationv1.ValidationAction `json:"validationActions,omitempty"` | |
| } |
Signed-off-by: Omar Nasser <omarnasserjr@gmail.com>
|
|
||
| // ValidationActions overrides the policy's validation actions when set | ||
| // +optional | ||
| ValidationActions []admissionregistrationv1.ValidationAction `json:"validationActions,omitempty"` |
There was a problem hiding this comment.
Why do we need a list of actions?
|
Please resolve all comments once addressed. |
There was a problem hiding this comment.
Pull request overview
This PR extends the PolicyException API to support overriding a referenced policy’s validationActions, enabling per-exception control over ValidatingPolicy enforcement behavior.
Changes:
- Added
validationActionstoPolicyRefin the PolicyException API (Go types + deepcopy support). - Updated generated CRD manifests (raw + aggregated + Helm chart template) to expose the new field.
- Updated generated CRD documentation HTML to include the new field.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/user/crd/kyverno_cel_policies.v1alpha1.html | Generated CRD docs updated to document validationActions on PolicyRef. |
| docs/user/crd/index.html | Generated CRD index updated to include validationActions in PolicyRef. |
| config/crds/policies.kyverno.io_policyexceptions.yaml | PolicyException CRD schema updated to include policyRefs[].validationActions (multiple version blocks). |
| config/crds.yaml | Aggregated CRDs updated to include policyRefs[].validationActions (multiple version blocks). |
| charts/kyverno-api/templates/crds/policies.kyverno.io_policyexceptions.yaml | Helm CRD template updated to include policyRefs[].validationActions (multiple version blocks). |
| api/policies.kyverno.io/v1alpha1/zz_generated.deepcopy.go | Deepcopy generation updated to deep-copy PolicyRef elements due to the new slice field. |
| api/policies.kyverno.io/v1alpha1/policy_exception.go | Added validationActions field to PolicyRef. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Kind string `json:"kind"` | ||
|
|
||
| // ValidationActions overrides the policy's validation actions when set | ||
| // +optional |
| // ValidationActions overrides the policy's validation actions when set | ||
| // +optional | ||
| ValidationActions []admissionregistrationv1.ValidationAction `json:"validationActions,omitempty"` |
| action. | ||
| type: string | ||
| type: array |
| validationActions: | ||
| description: ValidationActions overrides the policy's validation | ||
| actions when set | ||
| items: | ||
| description: ValidationAction specifies a policy enforcement | ||
| action. | ||
| type: string | ||
| type: array |
| action. | ||
| type: string | ||
| type: array |
| action. | ||
| type: string | ||
| type: array |
| validationActions: | ||
| description: ValidationActions overrides the policy's validation | ||
| actions when set | ||
| items: | ||
| description: ValidationAction specifies a policy enforcement | ||
| action. | ||
| type: string | ||
| type: array |
| validationActions: | ||
| description: ValidationActions overrides the policy's validation | ||
| actions when set | ||
| items: | ||
| description: ValidationAction specifies a policy enforcement | ||
| action. | ||
| type: string | ||
| type: array |
| action. | ||
| type: string | ||
| type: array |
| action. | ||
| type: string | ||
| type: array |
Explanation
We need to support override for ValidatingPolicy failureAction in PolicyException so in order to do that we need to define the
validationActionsfield first in PolicyException APIRelated issue
Needed for / Part of: kyverno/kyverno#14927
Proposed Changes
validationActionsfield to PolicyExceptionChecklist
Further Comments