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

Check if preferred api version exists #82

Merged
merged 3 commits into from
Jun 17, 2020
Merged

Check if preferred api version exists #82

merged 3 commits into from
Jun 17, 2020

Conversation

rikatz
Copy link
Collaborator

@rikatz rikatz commented Jun 14, 2020

Signed-off-by: Ricardo Pchevuzinske Katz ricardo.katz@gmail.com

Fixes #72

This PR adds a new validation into objects:

  • First it maps all the Kind objects existing in the swagger.json to a ResourceName and a preferred Group/Version (type PreferredResource map[string]ResourceStruct)

  • Then, when checking all the Deprecated APIs in the K8S cluster, if the GroupVersion that is being verified is different from the Preferred GroupVersion for the same Kind, it tries to list both of them in the cluster. If the length of the objects is the same it's very likely the API server supports both of them so we can disregard those objects as being deprecated.

  • Otherwise they're deprecated.

A test that can be run is against Kubernetes 1.13 created with KinD (kind create cluster --image kindest/node:v1.13.12@sha256:214476f1514e47fe3f6f54d0f9e24cfb1e4cda449529791286c7161b7f9c08e7), as that version contained a PriorityClass in scheduling.k8s.io/v1beta1, which is deprecated.

Something to note here is that the API Walker have a slight different behavior, as if the object kind is not existent in the swagger.json and we use the PreferredResource method it might mask still some deprecated object but still...as the API Server in those cases prefer what it calls the Preferred, it will still return the extensions/v1beta1/deployments as preferred and everytime consider that a Deleted API.

This might raise some alert for the cluster-admin as "please please please do release upgrades in steps before jumping from 1.13 to 1.18"

@codescalar @yogeek PTAL, if possible run some tests with this branch :) I'm planning to merge in the middle of the week and maybe release a beta version

Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>
@rikatz rikatz merged commit bc960fa into master Jun 17, 2020
@yogeek
Copy link

yogeek commented Jun 17, 2020

Hi @rikatz, sorry but I was not able to test the branch as I am in vacation until beginning of July. Just saw you merged, that's great and I will test it as soon as I can
Thanks again

@rikatz rikatz deleted the preferreditems branch November 28, 2021 18:39
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

Successfully merging this pull request may close these issues.

Deprecated resource being shown in multiple API groups
2 participants