-
Notifications
You must be signed in to change notification settings - Fork 764
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
Gatekeeper resource matching needs additional features #3081
Comments
One concern with excludedNamespaceSelector would be that K8's ValidatingAdmissionPolicy doesn't support that matcher: Which would complicate the ability to use Gatekeeper to manage validating admission policy. Part of the reason VAP doesn't have that is because label selectors let you use NotIn / DoesNotExist to do negative matching: G8r's namespaceSelector currently supports this syntax. Does this meet your needs? |
That doesn't seem to be the case with Gatekeeper's implementation. The documentation (https://open-policy-agent.github.io/gatekeeper/website/docs/howto#the-match-field) explicitly says you can't do this.
While If |
Ah, I think that was intended to read as: "namespaceSelector has the same behavior as labelSelector, but is applied to the containing namespace, instead of the object-under-test" Negative matching should be supported (both use the same k8s label selector code under-the-hood): gatekeeper/pkg/mutation/match/match.go Lines 73 to 116 in d95cdb6
|
Ah, so it's already implemented, but is just not clear from the documentation. I will admit that I haven't actually tried creating Constraints using namespaceSelector, because I didn't think it supported set based selection. |
Updated the description to incorporate the findings from the comments. I still believe that having |
+1 to excluded names/kinds |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
not stale |
Describe the solution you'd like
The
match
field in Config and Constraints has several features, but they are not all properly symmetric.There is the ability to select resources by label,labelSelector
, but no ability to exclude resources by label,excludedLabelSelector
.labelSelector
can use set-basedmatchExpressions
which cover this caseThere is the ability to select resources by namespace labels,namespaceSelector
, but no ability to exclude namespaces by label,excludedNamespaceSeelctor
.namespaceSelector
can use set-basedmatchExpressions
which cover this caseThere is the ability to provide a list of
kinds
, with wildcards, but noexcludedKinds
to refine that list.There is the ability to select objects by
name
, with wildcards, but noexcludedNames
to refine that list.I would like to see
match
expanded to add the missing symmetric features described above:excludedLabelSelector
excludedNamespaceSelector
excludedKinds
excludedNames
Environment:
The text was updated successfully, but these errors were encountered: