redhat-cop / cert-utils-operator

Set of functionalities around certificates packaged in a Kubernetes operator
Apache License 2.0
95 stars 35 forks source link

Invalid secret name causes crash #48

Closed mathianasj closed 4 years ago

mathianasj commented 4 years ago

If you do not specify a secret with namespace/secret the controller will crash.

E0427 14:40:52.174434 56565 runtime.go:78] Observed a panic: runtime.boundsError{x:-1, y:8, signed:true, code:0x1} (runtime error: slice bounds out of range [:-1])

mathianasj commented 4 years ago

It would be better to attach a status to the annotated entry with an error message

raffaelespazzoli commented 4 years ago

this is a bit obscure. Which controller is failing? under which condition exactly?

mathianasj commented 4 years ago

I noticed with the config map controller for cainjector specifically. If I do not follow namespace/secret-name is what causes a crash. If I annotate with any of the following below.

Config Map Annotation cert-utils-operator.redhat-cop.io/injectca-from-secret: secret-name

Secret Annotation cert-utils-operator.redhat-cop.io/injectca-from-secret: secret-name

mathianasj commented 4 years ago

If that happens the pod goes into a crash loop

raffaelespazzoli commented 4 years ago

ok, the input is not correctly validated before being processed. The operator should simply fail without panicking.