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

Switch AdmissionReview from v1beta1 to v1 #4537

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

adriananeci
Copy link
Contributor

@adriananeci adriananeci commented Dec 18, 2021

This PR updates AdmissionReview from v1beta1 to v1. In V1, the UID field is mandatory and should be copied from the request.uid sent to the webhook based on https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#response

No other notable changes between AdmissionReview v1beta1 and v1. AdmissionReview v1 is available since k8s v1.16.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 18, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @adriananeci!

It looks like this is your first PR to kubernetes/autoscaler 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/autoscaler has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Dec 18, 2021
@adriananeci
Copy link
Contributor Author

/assign @krzysied

@jbartosik jbartosik changed the title Switch AdmissionReviw from v1beta1 to v1 Switch AdmissionReview from v1beta1 to v1 Dec 20, 2021
@jbartosik jbartosik assigned jbartosik and unassigned krzysied Dec 20, 2021
Copy link
Collaborator

@jbartosik jbartosik left a comment

Choose a reason for hiding this comment

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

Thank you.

I have some questions about migration:

  1. Can we drop dependency on v1beta1 admission API?
  2. If I have an existing cluster, with VPA webhook created using v1beta1 admission API and switch to VPA using v1 admission API what will happen? Will we overwrite the existing webhook? Will we have 2 webhooks?
  3. What will happen if I need to rollback VPA to an older version? So I'll switch from VPA using v1 admission API to older VPA using v1beta1 admission API?

@adriananeci
Copy link
Contributor Author

  1. Can we drop dependency on v1beta1 admission API?

Yes, just removed v1beta1 dependency

  1. If I have an existing cluster, with VPA webhook created using v1beta1 admission API and switch to VPA using v1 admission API what will happen? Will we overwrite the existing webhook? Will we have 2 webhooks?

Tested it on a kind cluster and the old webhook will be replaced with the new one having

- admissionReviewVersions:
    - v1
  1. What will happen if I need to rollback VPA to an older version? So I'll switch from VPA using v1 admission API to older VPA using v1beta1 admission API?

Everything should go smooth since the MutatingWebhookConfiguration will be recreated with admissionReviewVersions set to v1beta1.

Validated it on a kind cluster:

  • deploy VPA using ./hack/vpa-up.sh.
  • deploy the hamster example(k apply -f examples/hamster.yaml) and validate the vpa object status
❯ k get vpa
NAME          MODE   CPU    MEM       PROVIDED   AGE
hamster-vpa   Auto   587m   262144k   True       23m
  • build a new admission-controller image with changes from this PR using
make build-in-docker-amd64 docker-build-amd64 REGISTRY=test TAG=test
  • loaded the new image into the kind cluster using
kind load docker-image test/vpa-admission-controller-amd64:test --name test-cluster
  • edit the vpa-admission-controller deployment and swap the official image with the freshly built one
  • check the vpa-webhook-config mutatingwebhookconfiguration object and its admissionReviewVersions value
k get mutatingwebhookconfigurations.admissionregistration.k8s.io -oyaml
  • edit the vpa-admission-controller deployment and switch back to the official image(k8s.gcr.io/autoscaling/vpa-admission-controller:0.9.2)
  • re-validate everything is working as expected(webhook config, vpa components logs, vpa object, etc)

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 20, 2021
Copy link
Collaborator

@jbartosik jbartosik left a comment

Choose a reason for hiding this comment

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

Thank you for the answering quickly. This PR mostly looks good to me but I have a few small requests.

Please:

@adriananeci
Copy link
Contributor Author

Rebased from master, squashed commits and fixed commit message

Copy link
Collaborator

@jbartosik jbartosik left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 20, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adriananeci, jbartosik

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 20, 2021
@k8s-ci-robot k8s-ci-robot merged commit a0a4100 into kubernetes:master Dec 20, 2021
@adriananeci adriananeci deleted the admission_review_v1 branch February 8, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants