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

[feature] adapt k8s v1.20 version #705

Merged
merged 1 commit into from Jan 10, 2022

Conversation

rambohe-ch
Copy link
Member

@rambohe-ch rambohe-ch commented Jan 5, 2022

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind bug
/kind documentation
/kind enhancement
/kind good-first-issue
/kind feature
/kind question
/kind design
/sig ai
/sig iot
/sig network
/sig storage
/sig storage

/kind feature

What this PR does / why we need it:

update k8s version to v1.20.11, the main modify points as following:

  1. update k8s.io/xxx(like client-go) dependency libraries version to v0.20.11
  2. update yurt-controller-manager based on NodeLifeCycle controller in kube-controller-manager v1.20.11 version.
  3. support v1.CSR api in yurtcsrapprover controller.

Which issue(s) this PR fixes:

Fixes #682

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

@openyurt-bot
Copy link
Collaborator

@rambohe-ch: GitHub didn't allow me to assign the following users: your_reviewer.

Note that only openyurtio members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
/kind bug
/kind documentation
/kind enhancement
/kind good-first-issue
/kind feature
/kind question
/kind design
/sig ai
/sig iot
/sig network
/sig storage
/sig storage

/kind feature

What this PR does / why we need it:

update k8s version to v1.22.3, the main modify points as following:

  1. update k8s.io/xxx(like client-go) dependency libraries version to v0.22.3
  2. update yurt-controller-manager based on NodeLifeCycle controller in kube-controller-manager v1.22.3 version.
  3. support v1.CertificateSigningRequest api

Which issue(s) this PR fixes:

Fixes #682

Special notes for your reviewer:

Does this PR introduce a user-facing change?


other Note

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openyurt-bot openyurt-bot added the kind/feature kind/feature label Jan 5, 2022
@rambohe-ch
Copy link
Member Author

rambohe-ch commented Jan 5, 2022

/assign @qclc @Peeknut @Congrool

@openyurt-bot openyurt-bot added the approved approved label Jan 5, 2022
@rambohe-ch rambohe-ch force-pushed the update-k8s-v1.22 branch 2 times, most recently from 7a57436 to 64e3eb9 Compare January 5, 2022 06:29
@rambohe-ch
Copy link
Member Author

/hold

@openyurt-bot openyurt-bot added the do-not-merge/hold do-not-merge/hold label Jan 5, 2022
@rambohe-ch
Copy link
Member Author

/assign @qclc @Peeknut @Congrool

sharedInformers.Certificates().V1().CertificateSigningRequests().Informer().AddEventHandler(handler)
hasSynced = sharedInformers.Certificates().V1().CertificateSigningRequests().Informer().HasSynced
getCsr = sharedInformers.Certificates().V1().CertificateSigningRequests().Lister().Get
} else {
Copy link
Member

Choose a reason for hiding this comment

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

It seems this branch will never work?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.

return v1beta1err
}

func v1Csr2v1beta1Csr(csr *certificatesv1.CertificateSigningRequest) *certificatesv1beta1.CertificateSigningRequest {
Copy link
Member

Choose a reason for hiding this comment

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

How about use conversion func like Convert_v1_CertificateSigningRequestList_To_certificates_CertificateSigningRequestList which provided by k8s?

Copy link
Member Author

Choose a reason for hiding this comment

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

but we need to import k8s.io/kubernetes, so we provide these funcs.

nc.evictorLock.Lock()
defer nc.evictorLock.Unlock()
if status == v1.ConditionFalse {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we don't need judgment of status there.
The use of markNodeForTainting will judge the status(in func processTaintBaseEviction).

Copy link
Member Author

Choose a reason for hiding this comment

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

This judgement is imported from upstream kubernetes. you can reference from pull request here: kubernetes/kubernetes#89059

)

// fileStoreWrapper is a wrapper for "k8s.io/client-go/util/certificate#FileStore"
// fileStoreWrapper is a wrapper for "github.com/openyurtio/openyurt/pkg/util/certificate#FileStore"
Copy link
Member

Choose a reason for hiding this comment

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

why not use k8s.io/client-go? Did we modify something ?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

@qclc qclc left a comment

Choose a reason for hiding this comment

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

The GetZoneKey(...) function in openyurt/pkg/controller/kubernetes/util/node/node.go has been replaced by k8s.io/component-helpers/node/topology/helps.go in the code, so we can delete this useless function.

@@ -90,7 +90,7 @@ var (
// CheckServantJobPeriod defines the time interval between two successive ServantJob statu's inspection
CheckServantJobPeriod = time.Second * 10
// ValidServerVersions contains all compatible server version
// yurtctl only support Kubernetes 1.12+ - 1.16+ for now
// yurtctl only support Kubernetes 1.12+ - 1.23+ for now
ValidServerVersions = []string{
Copy link
Member

Choose a reason for hiding this comment

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

This variable seems to have the same effect as the ValidServerVersions in openyurt/pkg/yurtctl/cmd/convert/options.go. How about merging the two variables together?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed.

@rambohe-ch
Copy link
Member Author

The GetZoneKey(...) function in openyurt/pkg/controller/kubernetes/util/node/node.go has been replaced by k8s.io/component-helpers/node/topology/helps.go in the code, so we can delete this useless function.

ok

}
}
return nil
},
Copy link
Member

Choose a reason for hiding this comment

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

How about just testing if len(args) > 0, instead of a range loop

Copy link
Member Author

Choose a reason for hiding this comment

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

in order to avoid influence from empty args, so a range loop used. and these code snippet is imported from upstream kubernetes.

k8s.io/kube-controller-manager v0.22.3
k8s.io/kubelet v0.22.3
k8s.io/system-validators v1.6.0
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
Copy link
Member

Choose a reason for hiding this comment

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

In require block, how about directly using k8s.io/api v0.22.3, k8s.io/klog/v2 v2.9.0 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

Choose a reason for hiding this comment

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

@rambohe-ch BTW, cloud I know the reason why we need to require and replace the package with the same version, such as :

require (
  ...
  k8s.io/apimachinery v0.22.3
  ...
)
replace (
  ...
  k8s.io/apimachinery => k8s.io/apimachinery v0.22.3
  ...
)

In my mind, we just need to do so for sigs.k8s.io/apiserver-network-proxy v0.0.15, because we forked it and modified for openyurt.
Thanks.

@Congrool
Copy link
Member

Congrool commented Jan 6, 2022

After this pr, how about updating the k8s version of e2e test to 1.22?

@rambohe-ch
Copy link
Member Author

After this pr, how about updating the k8s version of e2e test to 1.22?

@Congrool Would you be able to make a pull request to update e2e test?

@Congrool
Copy link
Member

Congrool commented Jan 6, 2022

After this pr, how about updating the k8s version of e2e test to 1.22?

@Congrool Would you be able to make a pull request to update e2e test?

Sure, but things seem to be more complicate than just updating kind node image.
We use both csr v1 and v1beta1 to support 1.22 and the previous version. Do we need to retain tests for 1.21 and previous version, or just only test 1.22?

@qclc
Copy link
Member

qclc commented Jan 6, 2022

/hold cancel

@openyurt-bot openyurt-bot removed the do-not-merge/hold do-not-merge/hold label Jan 6, 2022
@qclc
Copy link
Member

qclc commented Jan 6, 2022

/lgtm

@openyurt-bot openyurt-bot added the lgtm lgtm label Jan 6, 2022
@kadisi
Copy link
Member

kadisi commented Jan 6, 2022

/lgtm

@kadisi
Copy link
Member

kadisi commented Jan 6, 2022

/approve

@qclc
Copy link
Member

qclc commented Jan 6, 2022

/hold

@openyurt-bot openyurt-bot added the do-not-merge/hold do-not-merge/hold label Jan 6, 2022
@openyurt-bot openyurt-bot removed the lgtm lgtm label Jan 6, 2022
@rambohe-ch rambohe-ch force-pushed the update-k8s-v1.22 branch 2 times, most recently from 22bd284 to fb99b04 Compare January 10, 2022 04:04
@rambohe-ch rambohe-ch changed the title [feature] adapt k8s v1.22 version [feature] adapt k8s v1.20 version Jan 10, 2022
@rambohe-ch
Copy link
Member Author

/hold cancel

@qclc
Copy link
Member

qclc commented Jan 10, 2022

/lgtm

@openyurt-bot openyurt-bot added the lgtm lgtm label Jan 10, 2022
@rambohe-ch
Copy link
Member Author

/hold cancel

@openyurt-bot openyurt-bot removed the do-not-merge/hold do-not-merge/hold label Jan 10, 2022
@openyurt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: huangyuqi, kadisi, rambohe-ch

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:
  • OWNERS [huangyuqi,kadisi,rambohe-ch]

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

@huangyuqi
Copy link
Member

/lgtm

@huangyuqi huangyuqi merged commit 0cd9d71 into openyurtio:master Jan 10, 2022
MrGirl pushed a commit to MrGirl/openyurt that referenced this pull request Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request]update k8s.io/xxx(like client-go...) dependency up to version v0.22.x
7 participants