instrumenta / instrumenta/kubeval
Invalid deployment passes kubeval
- Dominant language
- Go
- Stars
- 3.2k
- Forks
- 227
- PR merge metrics
- No merged PRs in 30d
Description
We had a deployment that contained the following block:
```
volumes:
- name: webhook-config
secret:
secretName: webhook
items:
- key: webhook.json
path: webhook.json
resources:
limits:
memory: 2Gi
restartPolicy: Always
```
It passed our kubeval job we have in our CI solution, but it fails to actually apply against our kubenetes cluster. Kubectl with the dry-run parameter fails the validation however:
```
kubectl apply -f deployment.yaml --dry-run
W0819 12:58:46.954177 86603 helpers.go:535] --dry-run is deprecated and can be replaced with --dry-run=client.
error: error validating "deployment.yaml": error validating data: ValidationError(Deployment.spec.template.spec.volumes[0]): unknown field "resources" in io.k8s.api.core.v1.Volume; if you choose to ignore these errors, turn validation off with --validate=false
```
We would expect this to fail as it's not valid.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the deployment.yaml example with kubeval and compare it with kubectl apply --dry-run. Trace the Kubernetes schema validation path used by the kubeval CI job, then confirm that the invalid resources field under volumes is rejected and add a regression test for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100