-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a proposal for introducing the ValidatingPolicy #66
base: main
Are you sure you want to change the base?
Conversation
84a9486
to
a1e660f
Compare
a1e660f
to
2f96614
Compare
Signed-off-by: Mariam Fahmy <[email protected]>
2f96614
to
f05708c
Compare
Signed-off-by: Khaled Emara <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great @MariamFahmy98 @KhaledEmaraDev ! Left a few comments below.
|
||
While ValidatingAdmissionPolicies and MutatingAdmissionPolicies offer robust features, they fall short in addressing several critical use cases for Policy-as-Code. Below are the limitations and opportunities for improvement: | ||
|
||
1. Data Lookups: The built-in policies cannot perform data lookups from the API server or external API endpoints. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...from the API server...
Is this still true?
|
||
#### Any/All Resource Filters | ||
|
||
Kyverno provides flexible resource matching through the use of `any` and `all` filters. The `any` filter allows you to define multiple resource specifications, where a match occurs if any of the specified conditions are met **(OR logic)**. This means a resource will be matched if it satisfies at least one of the defined criteria. The `all` filter requires all specified conditions to be true for a match **(AND logic)**. This ensures a resource matches only if it satisfies every single criterion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this represented in the ValidatingPolicy CRD, is there an example?
proposals/new_policy_types.md
Outdated
|
||
Kubernetes VAPs offer a `spec.matchConditions` field for fine-grained request filtering, similar to Kyverno's `preconditions`. This presents two options: utilize the VAP's matchConditions within the webhook configuration, or handle these conditions internally in the Kyverno engine. | ||
|
||
Furthermore, VAPs offer a matchPolicy field (set to `Exact` or `Equivalent`) that governs how incoming requests are matched against rules. `Exact` requires precise matching, while `Equivalent` allows for matching across different API groups or versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthermore, VAPs offer a matchPolicy field (set to `Exact` or `Equivalent`) that governs how incoming requests are matched against rules. `Exact` requires precise matching, while `Equivalent` allows for matching across different API groups or versions. | |
Furthermore, VAPs offer a `matchPolicy` field (set to `Exact` or `Equivalent`) that governs how incoming requests are matched against rules. `Exact` requires precise matching, while `Equivalent` allows for matching across different API groups or versions. |
proposals/new_policy_types.md
Outdated
|
||
1. `ruleNames`: This field is unnecessary, as ValidatingPolicies don't employ the concept of rules. This field should be removed from the PolicyException spec. | ||
|
||
2. `match`: This field filters resources based on Kind. However, ValidatingPolicies utilize `matchConstraints` based on API groups, versions, operations, and resources. Therefore, the PolicyException's match field must be replaced with a matchConstraints field to align with this mechanism. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. `match`: This field filters resources based on Kind. However, ValidatingPolicies utilize `matchConstraints` based on API groups, versions, operations, and resources. Therefore, the PolicyException's match field must be replaced with a matchConstraints field to align with this mechanism. | |
2. `match`: This field filters resources based on Kind. However, ValidatingPolicies utilize `matchConstraints` based on API groups, versions, operations, and resources. Therefore, the PolicyException's match field must be replaced with a `matchConstraints` field to align with this mechanism. |
proposals/new_policy_types.md
Outdated
object.metadata.labels.app == 'busybox' | ||
``` | ||
|
||
How can we generate Kubernetes ValidatingAdmissionPolicies based on Kyverno's ValidatingPolicy and PolicyException CRDs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leverage webhook match conditions for exclusions?
Signed-off-by: ShutingZhao <[email protected]>
proposals/new_policy_types.md
Outdated
Kubernetes VAPs offer a `spec.matchConditions` field for fine-grained request filtering, similar to Kyverno's `preconditions`. This presents two options: utilize the VAP's matchConditions within the webhook configuration, or handle these conditions internally in the Kyverno engine. | ||
|
||
Furthermore, VAPs offer a matchPolicy field (set to `Exact` or `Equivalent`) that governs how incoming requests are matched against rules. `Exact` requires precise matching, while `Equivalent` allows for matching across different API groups or versions. | ||
|
||
To maintain consistency and offer similar flexibility, the `ValidatingPolicy` CRD should introduce a `matchPolicy` field too. This presents two options: utilize this field within the webhook configuration, or handle it internally in the Kyverno engine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this proposal, a webhookConfiguration
is added to the validatingpolicy.spec
. Both matchConditions
and matchPolicy
are available for webhook configuraiton.
feat: add webhook registration details for new CRD
a1c7754
to
077ee71
Compare
Signed-off-by: Mariam Fahmy <[email protected]>
This PR adds a proposal to introduce ValidatingPolicy