yannh / kubeconform

A FAST Kubernetes manifests validator, with support for Custom Resources!
Apache License 2.0
2.07k stars 116 forks source link

Kubeconform does not report invalid metadata.name #259

Open gvfnix opened 5 months ago

gvfnix commented 5 months ago

Kubeconform 0.6.4

❯ kubeconform -v
development

❯ cat /tmp/ns.yml 
apiVersion: v1
kind: Namespace
metadata:
  name: NameSpaceName

❯ kubeconform -verbose /tmp/ns.yml 
/tmp/ns.yml - Namespace NameSpaceName is valid

❯ kubectl apply -f /tmp/ns.yml 
The Namespace "NameSpaceName" is invalid: metadata.name: Invalid value: "NameSpaceName": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name',  or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')

Kubeconform should not allow this.

jfcoz commented 4 months ago

This also happens when metadata.name is too long :

metadata.name: Invalid value: "…-toooo-long": must be no more than 52 characters