instrumenta / kubeval

Validate your Kubernetes configuration files, supports multiple Kubernetes versions
https://kubeval.com
Other
3.16k stars 229 forks source link

Invalid label values not caught #186

Open JohnPaton opened 4 years ago

JohnPaton commented 4 years ago

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:

nvtkaszpir commented 3 years ago

Moreover, the values must be 63 chars or less. See #175

james-pollard-leapyear commented 3 years ago

Is this something y'all could prioritize? We just tripped on this with a label accidentally ending with -