prometheus-engine icon indicating copy to clipboard operation
prometheus-engine copied to clipboard

Validate secret names are non-empty in a validating webhook

Open TheSpiritXIII opened this issue 3 years ago • 0 comments

The secret key name should always be provided. It looks like it's not optional at the moment because there's a TODO mentioning that other non-name selectors might be added.

For now, since they only have names, this code change properly generates an error like this:

Error from server (invalid collection credentials: missing secret key selector name): error when applying patch:
xyz
to:
Resource: "monitoring.googleapis.com/v1, Resource=operatorconfigs", GroupVersionKind: "monitoring.googleapis.com/v1, Kind=OperatorConfig"
Name: "config", Namespace: "gmp-public"
for: "abc": error when patching "123": admission webhook "validate.operatorconfigs.gmp-operator.gmp-system.monitoring.googleapis.com" denied the request: invalid collection credentials: missing secret key selector name

In the future, if they add any fields, we can check for the existence of at least one.

TheSpiritXIII avatar Sep 30 '22 14:09 TheSpiritXIII