yannh / kubeconform

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

Deployment port name length not validated #178

Closed stevehipwell closed 1 year ago

stevehipwell commented 1 year ago

When I run kubeconform on a deployment with the port name http-remote-write I don't get an error but when I try to deploy I get the following error.

Deployment.apps "thanos-receive-router" is invalid: spec.template.spec.containers[0].ports[2].name: Invalid value: "http-remote-write": must be no more than 15 characters

eyarz commented 1 year ago

@stevehipwell this is happening because the port name validation is not part of the object schema. therefore, this is only happening on the server side. you can read more about it here.

if you still want to make sure this check is also happening locally, you can do one of the following: 1) open a PR the K8s project to update the schema to include this check 2) use a 3rd tool for this validation (e.g. datree, polaris, kyverno, etc.). disclaimer: I'm one of the maintainers of datree and it should play really nicely with your use case because it will also run kubeconform.

stevehipwell commented 1 year ago

Thanks for confirming this @eyarz. It might be worth listing the known validations not covered by the OpenAPI spec on the readme to make it easier to understand what needs additional consideration.

eyarz commented 1 year ago

I agree, but we don't have the complete list of server-side validations which are not part of the schema. It's an open-source project, so feel free to open a PR and add your issue to the readme :)