Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should a resource with an empty name be accepted? #122

Closed
PawelLipski opened this issue Aug 2, 2022 · 2 comments
Closed

Should a resource with an empty name be accepted? #122

PawelLipski opened this issue Aug 2, 2022 · 2 comments

Comments

@PawelLipski
Copy link

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 :/

@eyarz
Copy link
Contributor

eyarz commented Aug 2, 2022

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

@yannh
Copy link
Owner

yannh commented Sep 27, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants