yannh / kubeconform

A FAST Kubernetes manifests validator, with support for Custom Resources!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should a resource with an empty name be accepted?

PawelLipski opened this issue · comments

Each of the following is accepted bykubeconform:

apiVersion: v1
kind: Secret
metadata:
  name:
---
apiVersion: v1
kind: Secret
metadata:
---
apiVersion: v1
kind: Secret

But I'm getting, as expected, from server for: "....yaml": resource name may not be empty from k8s server :/

This is actually the expected behavior.
Name check is NOT part of the K8s schema and therefore, it's not validated by kubeconform.
Why it's not part of the schema, and it's part of the server validation script? I don't know 🤷‍♂️

BTW, the key can be metadata.name OR metadata.generateName:
https://hub.datree.io/built-in-rules/ensure-resource-name

Closing, I believe @eyarz is right here... and yes, sometimes the server validation is more stringent than the schema itself :(