-
Notifications
You must be signed in to change notification settings - Fork 776
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
"Object 'Kind' is missing in 'null'" #3743
Comments
Thanks for the report @alex-berger! There are few reasons why req.Object.Raw could be nil:
To help further debug the issue, please check the k8s API server logs to inspect the request object that ended in error e.g. |
@ritazh In our case Gatekeeper v3.18.0 was installed via Helm Chart, actually it was upgrade from version v3.15.1 (via FluxCD / GitOps).
Interestingly, we have not found anything in the k8s API server logs that would indicated failing webhook calls. But, that might well be, because the webhook's Handler function is not failing but just logging the error and then continues (i.e. does not immediately return). isExcludedNamespace, err := h.skipExcludedNamespace(&req.AdmissionRequest, process.Webhook)
if err != nil {
h.log.Error(err, "error while excluding namespace")
} |
@alex-berger can you provide the steps to reproduce? I am not able to reproduce the same on my end. Did you update to 3.18.1? if so, after 3.18.1 are you still facing the same issue? |
I'm facing the same issue @JaydipGabani @ritazh . Gatekeeper Version: 3.18.0 |
@shashank-shridhar can you share steps to repro? I am not able to reproduce this on my side. |
Hi @JaydipGabani , we updated gatekeeper through helm chart from version 3.16.3. |
@shashank-shridhar I tried upgrading from 3.16.3 to 3.18.0 using helm chart with below CT/C on cluster - CT apiVersion: templates.gatekeeper.sh/v1
kind: ConstraintTemplate
metadata:
name: k8srequiredlabels
spec:
crd:
spec:
names:
kind: K8sRequiredLabels
validation:
# Schema for the `parameters` field
openAPIV3Schema:
type: object
properties:
labels:
type: array
items:
type: string
targets:
- target: admission.k8s.gatekeeper.sh
rego: |
package k8srequiredlabels
violation[{"msg": msg, "details": {"missing_labels": missing}}] {
provided := {label | input.review.object.metadata.labels[label]}
required := {label | label := input.parameters.labels[_]}
missing := required - provided
count(missing) > 0
msg := sprintf("you must provide labels: %v", [missing])
} Constraint - apiVersion: constraints.gatekeeper.sh/v1beta1
kind: K8sRequiredLabels
metadata:
name: pod-must-have-test
spec:
match:
scope: "Namespaced"
namespaces: [ "nginx" ]
kinds:
- apiGroups: [ "" ]
kinds: [ "Pod" ]
parameters:
labels: [ "test" ] I had one violating pod running on the cluster and I created violating pod for 3.16 and after the upgrade to 3.18 (both times the request got denied). I was still not able to reproduce the similar issue. GK pods never went in Here is how I installed 3.16.3 - And here is how I upgraded to 3.18.0 - If you can, please share the Constraint Template and Constraints you are using along with anyother information that I can use to reproduce this issue to debug it further. cc: @alex-berger |
@JaydipGabani Unfortunately, we have way too many Constraint Templates and Constraints and I cannot narrow down which of those might cause this. However, I suspect that
Maybe, we should extends the logging in https://github.com/open-policy-agent/gatekeeper/blob/v3.18.0/pkg/webhook/policy.go#L172 to log some details about the AdmissionRequest (in trace or debug mode). |
What steps did you take and what happened:
After upgrading to Gatekeeper 3.18.0 we are observing below error message (exactly 4 messages every 2 minutes) and now I am wondering what might cause this.
Here a formatted version of the error message's stack trace:
It looks like this is because skipExcludedNamespace is calling
deserializer.Decode(nil, ...)
asreq.Object.Raw
seems to be nil.What did you expect to happen:
No errors :-)
Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
Environment:
3.18.0
v1.30.6-eks-7f9249a
The text was updated successfully, but these errors were encountered: