SAP-archive / karydia

Kubernetes Security Walnut
Other
77 stars 10 forks source link

pkg/admission/karydiasecuritypolicy: Internal error occurred: jsonpatch add operation does not apply #83

Closed schu closed 5 years ago

schu commented 5 years ago

If the pod doesn't have any annotations, karydia's attempt to patch the resource fails with

Error from server (InternalError): Internal error occurred: Internal error occurred: jsonpatch add operation does not apply: doc is missing path: "/metadata/annotations/seccomp.security.alpha.kubernetes.io~1pod"

That's probably because pkg/admission/karydiasecuritypolicy/pod.go does not consider whether there are any annotations yet. Fix then can be taken from https://github.com/karydia/karydia/blob/7bbb69324774ef365a63cd770e9fa3cdd40ba10d/pkg/admission/karydia/karydia.go#L132-L140