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

Exclude manifests for deprecated object versions #20

Open
maxdanilov opened this issue May 26, 2020 · 5 comments
Open

Exclude manifests for deprecated object versions #20

maxdanilov opened this issue May 26, 2020 · 5 comments

Comments

@maxdanilov
Copy link

maxdanilov commented May 26, 2020

Hi there,

We're using kubeval to validate manifests, as well as to catch deprecation warnings (before upgrading to the new version of k8s).

Unfortunately, as far as I can see, this repository includes deprecated manifests alongside with normal ones, and fires a false negative in case an object is passing a validation but the schema is marked as deprecated.

Example:

when running kubeval manifest.yml -v1.16.0 I would expect the following manifest to fail the kubeval checking:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: depl
  namespace: default

since extensions.v1beta1.Deployment is not supported in k8s 1.16.0 anymore (it's been moved to apps.v1.Deployment)

However, it passes, since the manifests for all old API groups for Deployment are still present in the repo, e.g.:

Not sure how this can be solved (as it seems coming from actual manifests for 1.16.0 that do have the manifests present), but one obvious solution could be creating a new set of manifest groups (e.g. v1.16.0-no-deprecated, v1.17.0-no-deprecated etc.) with manifests that have a DEPRECATED string in their description excluded from it:
https://github.com/instrumenta/kubernetes-json-schema/blob/master/v1.16.0/deployment-extensions-v1beta1.json#L2

@maxdanilov maxdanilov changed the title Exclude manifests for deprecated versions Do not include manifests for deprecated versions May 26, 2020
@maxdanilov maxdanilov changed the title Do not include manifests for deprecated versions Do not include manifests for deprecated object versions May 26, 2020
@maxdanilov maxdanilov changed the title Do not include manifests for deprecated object versions Exclude manifests for deprecated object versions May 26, 2020
@maxdanilov
Copy link
Author

Similar issue in kubeval repo: instrumenta/kubeval#189

@maxdanilov
Copy link
Author

@garethr do you have an opinion on this one?

@cmur2
Copy link

cmur2 commented Jul 3, 2020

I would be interested in some way to tell deprecated manifests apart from normal ones for a certain Kubernetes version - it would be great to have some input here :)

@nicorikken
Copy link

nicorikken commented Aug 6, 2020

I came here for the exact same use-case. Have been suggesting some ideas in the kubeval repo. Having an explicit keyword the schema would help. Rather than having to look for the word 'deprecated' in the description string. And the other solution is to have separate folders. But I think deprecation is orthogonal to the type of schema (local, standalone, strict). Having a keyword would prevent doubling the amount of directories for with/without deprecated schema's.

Also, not all deprecations have full-caps DEPRECATED in the description. Consider this extensions/v1beta1/podSecurityPolicy

@maxdanilov
Copy link
Author

maxdanilov commented Aug 6, 2020

@nicorikken
We gave up on the idea of using kubeval for this, instead for deprecation checks we run https://github.com/open-policy-agent/conftest using REGO policies (https://github.com/swade1987/deprek8ion/tree/master/policies could be a source of inspiration for the policies)

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

3 participants