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

feat: support admission.k8s.io/v1 alongside v1beta1 #759

Merged
merged 2 commits into from
Jul 8, 2020
Merged

Conversation

mflendrich
Copy link
Contributor

@mflendrich mflendrich commented Jul 6, 2020

What this PR does / why we need it:

This PR:

  • upgrades the admission.k8s.io APIs used by KIC to v1 from v1beta1. This PR assumes that a v1 webhook is backwards compatible with a v1beta1 apiserver as its caller. In other words, the webhook will accept both v1beta1 and v1 requests.
  • updates ValidationWebhookConfiguration manifests to allow v1 APIs (k8s >= 1.16) alongside v1beta1.
  • refactors the test for the admission controller server to table-driven for the following benefits:
    • makes it possible to introduce v1 tests alongside v1beta1 without exponential code growth
    • streamlined test execution (all tests have the same workflow but different inputs and expected outputs)
    • table-driven tests are idiomatic Go
  • run each server test for v1beta1 as well as v1

Which issue this PR fixes

fixes #678

Special notes for your reviewer:
Leaves ValidationWebhookConfiguration at v1beta1 for compatibility with k8s < 1.16. Added TODOs for a later cleanup.

@hbagdi
Copy link
Member

hbagdi commented Jul 6, 2020

As discussed out of band, we need v1beta1 and v1 at the same time.

BTW, nice work with table driven test refactoring here.
Make sure to have two separate commits, one for tests refactoring and other adding the feature, helps in git spellunking in future. Thanks!

@mflendrich
Copy link
Contributor Author

As discussed out of band, we need v1beta1 and v1 at the same time.

This PR supports both versions, according to my understanding of the admission.k8s.io documentation about (minimal) changes between these versions - v1 being essentially a promoted v1beta1 with some stricter validations. Reworded the PR description to capture it better.

BTW, nice work with table driven test refactoring here.
Make sure to have two separate commits, one for tests refactoring and other adding the feature, helps in git spellunking in future. Thanks!

Thanks! These are separate commits already.

@mflendrich mflendrich marked this pull request as ready for review July 7, 2020 19:33
@mflendrich mflendrich requested review from rainest and hbagdi July 7, 2020 19:33
@mflendrich
Copy link
Contributor Author

KIC admission webhook manually verified to work with:

  • kubernetes 1.15 and admission.k8s.io/v1beta1
  • kubernetes 1.18 and admission.k8s.io/v1

Copy link
Member

@hbagdi hbagdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor comments but otherwise looks good.

deploy/manifests/validation-webhook-configuration.yaml Outdated Show resolved Hide resolved
internal/admission/server_test.go Outdated Show resolved Hide resolved
@mflendrich
Copy link
Contributor Author

mflendrich commented Jul 7, 2020

Please take a look now @hbagdi. Added two new commits - to be autosquashed before merging.

hbagdi
hbagdi previously approved these changes Jul 7, 2020
Copy link
Member

@hbagdi hbagdi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be autosquashed before merging.

This is not possible in Github UI, you either have squash and merge or rebase and merge. We want two commits and we will either get 1 or 4 if we do this via Github.

(Unless this is a magical Github feature that I'm missing).

@mflendrich
Copy link
Contributor Author

done, looks like it requires another approval now 🙄

@hbagdi do we want to wait for #764 and then rebase on top of the new next?

@hbagdi
Copy link
Member

hbagdi commented Jul 8, 2020

@hbagdi do we want to wait for #764 and then rebase on top of the new next?

Sorry, I saw this comment after I merged 764 else I'd have merged this one first. Can you do a rebase please?

@mflendrich
Copy link
Contributor Author

Can you do a rebase please?

Done.
From my perspective, the PR is ready for merging.

@mflendrich mflendrich requested a review from hbagdi July 8, 2020 16:51
@hbagdi hbagdi merged commit edc272a into next Jul 8, 2020
@hbagdi hbagdi deleted the feat/admission-v1 branch July 8, 2020 20:16
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.

2 participants