kubeval
kubeval copied to clipboard
Invalid label values not caught
The only non-alphanumeric characters that can be in label values are . and -, but if you add
metadata:
labels:
test: this/should/fail
to some object it will still pass.
Trying to apply it yields
invalid: metadata.labels: Invalid value: "this/should/fail": a valid label must be
an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start
and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345',
regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
Versions:
- kubeval 0.14.0
- kubectl 1.14.6
- Kubernetes 1.12.9
Moreover, the values must be 63 chars or less. See #175
Is this something y'all could prioritize? We just tripped on this with a label accidentally ending with -