Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

feature: support k8s v1.22 #56

Closed
wants to merge 1 commit into from

Conversation

adamzhoul
Copy link
Member

@adamzhoul adamzhoul commented Jun 2, 2022

What type of PR is this?

/kind feature

What this PR does / why we need it:

Since openYurt is fully supports the k8s v1.22
This project should support it as well.

Which issue(s) this PR fixes:

Fixes: openyurtio/openyurt#680

What does this pr include:

From v1.22 ChangeLog, we can see:
It removes :

  • The beta CustomResourceDefinition API (apiextensions.k8s.io/v1beta1)
  • Beta versions of the ValidatingWebhookConfiguration and MutatingWebhookConfiguration API (the admissionregistration.k8s.io/v1beta1 API versions)

To support k8s v1.22. I have to upgrade our crd and webhook.

  • To support crd from apiextensions.k8s.io/v1beta1 -> apiextensions.k8s.io/v1. Have done:

         Add "crd:crdVersions=v1" to controller-gen cmd in Makefile line 77.
    
  • To support webhook from admissionregistration/v1beta1 -> admissionregistration/v1. Have done:

         1. Use "v0.5.0-kruise-beta.3" to parse and generate v1 webhook. Makefile line 111
    
         2. Add sideEffects=none,admissionReviewVersions=v1, at the end of "// +kubebuilder:webhook"
         Those two keys are required in v1. Affected lots of files: 
         grep -rln 'kubebuilder:webhook' *
    
         3. "k8s.io/api/admissionregistration/v1beta1" -> "k8s.io/api/admissionregistration/v1"
         affected file:
         - pkg/yurtappmanager/webhook/util/controller/webhook_controller.go
         - pkg/yurtappmanager/webhook/util/configuration/configuration.go
    
         4. add "// +kubebuilder:pruning:PreserveUnknownFields" to DeploymentTemplateSpec.metav1 and StatefulSetTemplateSpec.metav1
         Otherwise it’s content will be ignored
    
         5. manually update file: config/yurt-app-manager/webhook/patch_manifests.yaml 
         set to v1
    
  • Run make generate-manifests regenerate crd and webhook yaml

       modified:   config/yurt-app-manager/crd/bases/apps.openyurt.io_nodepools.yaml
       modified:   config/yurt-app-manager/crd/bases/apps.openyurt.io_uniteddeployments.yaml
       modified:   config/yurt-app-manager/crd/bases/apps.openyurt.io_yurtappdaemons.yaml
       modified:   config/yurt-app-manager/crd/bases/apps.openyurt.io_yurtingresses.yaml
       modified:   config/yurt-app-manager/webhook/manifests.yaml
    
  • Run make generate-deploy-yaml and cat _output/yamls/yurt-app-manager.yaml > config/setup/all_in_one.yaml

       Attention:  image generate is openyurt/yurt-app-manager:d79a9f0
       we have to upload one, then update this config.
    
  • Finally, update hack/lib/release-images.sh to accelerate debug build time

         add mount volume: "-v ${GOPATH}:/go"
    

Related resources:
https://kubernetes.io/blog/2021/07/14/upcoming-changes-in-kubernetes-1-22/#api-changes
https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/
https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema
admissionregistration/v1

@openyurt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: adamzhoul
To complete the pull request process, please assign fei-guo
You can assign the PR to them by writing /assign @fei-guo in a comment when ready.

The full list of commands accepted by this bot can be found 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

@rambohe-ch
Copy link
Member

@adamzhoul Very appreciate for your job to adapt K8s v1.22 for yurt-app-manager. and i think we should review this pull request as quickly as possible so yurt-app-manager can support K8s v1.22.
@kadisi @zzguang please take a look.

@rambohe-ch
Copy link
Member

/assign @kadisi @zzguang

@zzguang
Copy link
Member

zzguang commented Jun 5, 2022

Hi, @adamzhoul:
@huiwq1990 submitted a PR to support k8s 1.22 for yurt-app-manager before: #49
I checked both of your PRs and found that your changes differ much with each other, so could you please cross review with @huiwq1990 and submit an unified PR after your discussion? Thanks!

@zzguang zzguang mentioned this pull request Jun 5, 2022
@huiwq1990
Copy link
Member

@adamzhoul @zzguang I think the most important is we should change to go.mod file. This PR does not upgrade k8s dependence to 1.22.3.

@adamzhoul
Copy link
Member Author

@zzguang @huiwq1990 @rambohe-ch thanks for the review

@huiwq1990 I think the update in #49 contains updates here and more.
so, I think we can close pr here.

But, pr #49 should be merged soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]Yurtctl not be able to convert a k8s cluster setup by kubeadm
5 participants