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

Rename yurtctl init/join/reset to yurtadm init/join/reset #819

Merged
merged 1 commit into from
May 18, 2022

Conversation

lonelyCZ
Copy link
Member

@lonelyCZ lonelyCZ commented May 4, 2022

Signed-off-by: lonelyCZ 531187475@qq.com

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:

yurtctl init/join/reset are not suitable as name for creating OpenYurt cluster and join nodes.
so rename to yurtadm init/join/reset for conforming to kubeadm init/join/reset so reducing confusion for end users.

[root@master68 bin]# ./yurtadm -h
yurtadm administers the yurt cluster

Usage:
  yurtadm [command]

Available Commands:
  help        Help about any command
  init        Run this command in order to set up the OpenYurt control plane
  join        Run this on any machine you wish to join an existing cluster
  reset       Performs a best effort revert of changes made to this host by 'yurtadm join'
[root@master68 bin]# ./yurtctl -h
yurtctl controls the yurt cluster

Usage:
  yurtctl [command]

Available Commands:
  cluster-info   list cloud nodes and edge nodes in cluster
  convert        Converts the kubernetes cluster to a yurt cluster
  help           Help about any command
  markautonomous mark the nodes as autonomous
  revert         Reverts the yurt cluster back to a Kubernetes cluster
  test           Tools for developers to test the OpenYurt Cluster

Which issue(s) this PR fixes:

Fixes #737

Special notes for your reviewer:

Since it is uncertain whether yurtctl will be retained, in order to reduce the workload, I don't move the dependency for now.

/assign @rambohe-ch @Congrool

Does this PR introduce a user-facing change?

rename yurtctl init/join/reset to yurtadm init/join/reset

other Note

@openyurt-bot
Copy link
Collaborator

@lonelyCZ: 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:

Signed-off-by: lonelyCZ 531187475@qq.com

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:

yurtctl init/join/reset are not suitable as name for creating OpenYurt cluster and join nodes.
so rename to yurtadm init/join/reset for conforming to kubeadm init/join/reset so reducing confusion for end users.

[root@master68 bin]# ./yurtadm -h
yurtadm administers the yurt cluster

Usage:
 yurtadm [command]

Available Commands:
 help        Help about any command
 init        Run this command in order to set up the OpenYurt control plane
 join        Run this on any machine you wish to join an existing cluster
 reset       Performs a best effort revert of changes made to this host by 'yurtadm join'
[root@master68 bin]# ./yurtctl -h
yurtctl controls the yurt cluster

Usage:
 yurtctl [command]

Available Commands:
 cluster-info   list cloud nodes and edge nodes in cluster
 convert        Converts the kubernetes cluster to a yurt cluster
 help           Help about any command
 markautonomous mark the nodes as autonomous
 revert         Reverts the yurt cluster back to a Kubernetes cluster
 test           Tools for developers to test the OpenYurt Cluster

Which issue(s) this PR fixes:

Fixes #737

Special notes for your reviewer:

Since it is uncertain whether yurtctl will be retained, in order to reduce the workload, I don't move the dependency for now.

/assign @rambohe-ch @Congrool

Does this PR introduce a user-facing change?

rename yurtctl init/join/reset to yurtadm init/join/reset

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 size/L size/L: 100-499 label May 4, 2022
"github.com/openyurtio/openyurt/pkg/projectinfo"
"github.com/openyurtio/openyurt/pkg/yurtctl/cmd/join"
"github.com/openyurtio/openyurt/pkg/yurtctl/cmd/reset"
"github.com/openyurtio/openyurt/pkg/yurtctl/cmd/yurtinit"
Copy link
Member

Choose a reason for hiding this comment

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

please do not import yurtctl/cmd/xxx, and rename to yurtadm/cmd/xxx

@lonelyCZ lonelyCZ force-pushed the pr-rename-yurtadm branch 2 times, most recently from 9792232 to 8a3bfdd Compare May 5, 2022 14:01
@lonelyCZ
Copy link
Member Author

lonelyCZ commented May 5, 2022

Since some of the functionality in yurtctl will be removed, it is possible to temporarily make yurtctl dependent on yurtadm to reduce the amount of renamed work and subsequent removal efforts.

@@ -30,7 +30,7 @@ import (
"k8s.io/klog/v2"

"github.com/openyurtio/openyurt/pkg/projectinfo"
kubeutil "github.com/openyurtio/openyurt/pkg/yurtctl/util/kubernetes"
kubeutil "github.com/openyurtio/openyurt/pkg/yurtadm/util/kubernetes"
Copy link
Member

Choose a reason for hiding this comment

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

It looks strange that yurtctl import package of yurtadm.
Is it possible to move pkg/yurtadm/util/kubernetes to pkg/util/kubernetes

Copy link
Member Author

Choose a reason for hiding this comment

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

It can be, but pkg/util/kubernetes also depend on pkg/yurtadm/kubernetes.

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean? If we move pkg/yurtadm/util/kubernetes entirely to pkg/util/kubernetes, there's no dependence between them.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's a lot of subtle dependencies between them. For example, pkg/yurtadm/kubernetes/kubeadm/app/discovery/token depend on pkg/yurtadm/cmd/join/joindata. And pkg/yurtadm/kubernetes and pkg/yurtadm/util/kubernetes are different files. :(

Copy link
Member

Choose a reason for hiding this comment

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

Well, that's a problem. I find that yurtctl depends on the yurtadm/kubernetes mostly beacuse of convert/revert and test cmd. And test relies on yurtadm/kubernetes beacuse it reuses the code of convert. It's a solution that move test into yurtadm and remove convert/revert subcommand(which is under work in pr #748).

For dependence between pkg/yurtadm/kubernetes/kubeadm/app/discovery/token and pkg/yurtadm/cmd/join/joindata, can we move the joindata into yurtadm/kubernetes? It seems that yurtadm/kubernetes only depends on joindata pkg.

And what do you think @rambohe-ch ?

Copy link
Member

Choose a reason for hiding this comment

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

@Congrool @lonelyCZ The original idea of yurtadm/kubernetes or yurtctl/kubernetes is that codes comes from kubernetes project in order to avoid to import k8s.io/kubernetes. so move joindata into yurtadm/kubernetes maybe change the original idea.

how about deprecate yurtctl convert/revert at first? and now we have no response form writer of #748, so maybe we can post a new pull request to solve this case. @lonelyCZ would you like to take over this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok.

@@ -29,9 +29,9 @@ import (
"k8s.io/klog/v2"

"github.com/openyurtio/openyurt/pkg/projectinfo"
"github.com/openyurtio/openyurt/pkg/yurtctl/constants"
"github.com/openyurtio/openyurt/pkg/yurtadm/constants"
Copy link
Member

Choose a reason for hiding this comment

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

For constants, how about retaining the constants pkg both in yurtctl and yurtadm?
We can extract constants what yurtadm and yurtctl need respectively in pkg/yurtadm/constants and pkg/yurtctl/constants.
And each cmd only needs to import the constants pkg under its folder.

Copy link
Member Author

Choose a reason for hiding this comment

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

Many constants is common, may also need to put the part in pkg/util.

Copy link
Member

Choose a reason for hiding this comment

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

You can have a try, I don't find so many common constants. If there're only several common constants used by both yurtctl and yurtadm, the duplication is bearable.

Copy link
Member

Choose a reason for hiding this comment

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

We only use the constants.AnnotationAutonomy in yurtctl, please move it from pkg/yurtadm/constants to pkg/yurtctl/constants and import pkg/yurtctl/constants instead.

@openyurt-bot openyurt-bot added size/XL size/XL: 500-999 and removed size/L size/L: 100-499 labels May 16, 2022
@lonelyCZ lonelyCZ force-pushed the pr-rename-yurtadm branch 2 times, most recently from 9f5883e to 8b19ad1 Compare May 16, 2022 06:10
@rambohe-ch
Copy link
Member

@Congrool PTAL

@@ -29,9 +29,9 @@ import (
"k8s.io/klog/v2"

"github.com/openyurtio/openyurt/pkg/projectinfo"
"github.com/openyurtio/openyurt/pkg/yurtctl/constants"
"github.com/openyurtio/openyurt/pkg/yurtadm/constants"
Copy link
Member

Choose a reason for hiding this comment

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

We only use the constants.AnnotationAutonomy in yurtctl, please move it from pkg/yurtadm/constants to pkg/yurtctl/constants and import pkg/yurtctl/constants instead.

kubeutil "github.com/openyurtio/openyurt/pkg/yurtctl/util/kubernetes"
strutil "github.com/openyurtio/openyurt/pkg/yurtctl/util/strings"
tmplutil "github.com/openyurtio/openyurt/pkg/yurtctl/util/templates"
"github.com/openyurtio/openyurt/pkg/yurtadm/constants"
Copy link
Member

Choose a reason for hiding this comment

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

We should import pkg/yurtctl/constants instead of pkg/yurtadm/constants. Any constants used in this file should be in the pkg/yurtctl/constants, even there's duplication. In this way, we can decouple yurtctl with yurtadm.

@lonelyCZ lonelyCZ force-pushed the pr-rename-yurtadm branch 2 times, most recently from abbe2d2 to de13611 Compare May 16, 2022 14:10
Signed-off-by: lonelyCZ <531187475@qq.com>
@lonelyCZ
Copy link
Member Author

/cc @Congrool
PTAL

@Congrool
Copy link
Member

It's not an easy job to entirely decouple yurtadm with yurtctl, more work need to be put on it. In terms of this pr, it looks good.
/lgtm

@Congrool
Copy link
Member

/lgtm

@openyurt-bot openyurt-bot added the lgtm lgtm label May 17, 2022
@openyurt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lonelyCZ, 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:

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

@openyurt-bot openyurt-bot added the approved approved label May 18, 2022
@openyurt-bot openyurt-bot merged commit 5ac7aa8 into openyurtio:master May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved approved kind/feature kind/feature lgtm lgtm size/XL size/XL: 500-999
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request]rename yurtctl init/join to yurtadm init/join
4 participants