Skip to content

Resource name validation #65

@gerald-skydio

Description

@gerald-skydio

Greetings!

Love this project, been adding it to our build out of kubernetes manifest.

It seems like this tool is not finding any DNS-1035 as defined here [a-z]([-a-z0-9]*[a-z0-9] validation errors.

Example invalid manifest

apiVersion: v1
kind: Service
metadata:
  name: foo_bar
  labels:
    app: foo
spec:
  ports:
  - port: 10000
    targetPort: 6379
  selector:
    app: foo

While it can't apply to the cluster (currently 1.19 for this example)

gerald@gerald-laptop:~/playground/manifests$ kubectl apply -f service.yml 
The Service "foo_bar" is invalid: metadata.name: Invalid value: "foo_bar": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name',  or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')
gerald@gerald-laptop:~/playground/manifests$ ~/Downloads/kubeconform -summary -strict -output json -verbose service.yml 
{
  "resources": [
    {
      "filename": "service.yml",
      "kind": "Service",
      "name": "foo_bar",
      "version": "v1",
      "status": "statusValid",
      "msg": ""
    }
  ],
  "summary": {
    "valid": 1,
    "invalid": 0,
    "errors": 0,
    "skipped": 0
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions