-
Notifications
You must be signed in to change notification settings - Fork 759
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 constraints not correctly evaluating PriorityClass
objects
#3475
Comments
any traction here? |
@imbgar Can you try the same with below constaint to see if it works? apiVersion: constraints.gatekeeper.sh/v1beta1
kind: UserPriorityClassBoundsTest
metadata:
name: userpriorityclassboundstest
spec:
enforcementAction: deny
match:
kinds:
- apiGroups:
- "scheduling.k8s.io"
kinds:
- PriorityClass In both the provided examples of |
In my testing I was able to use below constraint for required_label policy to deny apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sRequiredLabels
metadata:
name: pod-must-have-gk
spec:
match:
kinds:
- apiGroups:
- "scheduling.k8s.io"
kinds:
- PriorityClass
parameters:
message: "All namespaces must have an `owner` label that points to your company username"
labels:
- key: owner
allowedRegex: "^[a-zA-Z]+.agilebank.demo$" based on the investigation, issue might be something else then "Gatekeeper constraints not correctly evaluating PriorityClass objects". Most likey the issue is misconfiguration of constraint. If not there might be bug in the rego code. I am removing the bug label for now. @imbgar let me know if the |
Hi @JaydipGabani. Thanks for taking the time to debug this. I verified that the constraint is misconfigured. Specifically, the value of I believe we can close this issue. |
What steps did you take and what happened:
I have a gatekeeper deployment that correctly evaluates policies for other kinds, but not
PriorityClass
.gatekeeper
via Argo with a manifest like this(slightly modified for obscurity):ValidatingWebhookConfiguration
ConstraintTemplate
based on this manifest withkubectl apply -f
Constraint
withkubectl apply -f
also tried with the following
match
condition in theConstraint
PriorityClass
object withkubectl apply -f
What did you expect to happen:
I expect the violation to be caught,
AdmissionReview
denied, and themsg
to be logged back to the me when I runkubectl apply -f
What am I doing wrong? Why is Gatekeeper not evaluating
PriorityClass
objects? My policies for namespaced objects likeDeployment
,StatefulSet
,Pod
, etc work fine.Environment:
v3.16.3
kubectl version
):The text was updated successfully, but these errors were encountered: