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

Invalid deployment passes kubeval #310

Open
DJAyth opened this issue Aug 19, 2021 · 2 comments
Open

Invalid deployment passes kubeval #310

DJAyth opened this issue Aug 19, 2021 · 2 comments

Comments

@DJAyth
Copy link

DJAyth commented Aug 19, 2021

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.

@DJAyth
Copy link
Author

DJAyth commented Aug 19, 2021

Actually I think I found my issue. We need to use the --strict flag.

@ivan-penchev
Copy link

just use --strict flag.

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

2 participants