instrumenta / instrumenta/kubeval

Check length limitation (63 characters)

Open
#175 1 comment 9 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
3.2k
Forks
227
PR merge metrics
No merged PRs in 30d

Description

Example invalid manifest (see [overlong](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set) label):

```
apiVersion: v1
kind: Service
metadata:
name: mysvc
labels:
toolong: abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde77
spec:
ports:
- name: whatever
port: 10000
targetPort: 10000
protocol: TCP
selector:
app: does-not-matter
```

Unfortunately, kubectl's dry run also doesn't verify this, but maybe you can find a way to check length and character limitations.

```
$ kubectl apply -f /tmp/toolong.yml --dry-run
service/mysvc created (dry run)

$ kubectl apply -f /tmp/toolong.yml
The Service "mysvc" is invalid: metadata.labels: Invalid value: "abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde77": must be no more than 63 characters

$ kubeval /tmp/toolong.yml
The file /tmp/toolong.yml contains a valid Service

$ kubeval --version
Version: 0.13.0
Commit: 635b3c3604ec2d287b0f7e74cb1835df273dcb65
Date: 2019-08-10T09:30:32Z
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.