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

refactor(kubeadm): remove deprecated command "alpha selfhosting pivot" #97627

Merged

Conversation

knight42
Copy link
Member

What type of PR is this?

/kind deprecation
/kind cleanup

What this PR does / why we need it:

Remove deprecated command "kubeadm alpha selfhosting pivot".

Which issue(s) this PR fixes:

xref: kubernetes/kubeadm#2299

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

kubeadm: deprecated command "alpha selfhosting pivot" is removed now.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/deprecation Categorizes issue or PR as related to a feature/enhancement marked for deprecation. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Dec 31, 2020
@knight42
Copy link
Member Author

/triage accepted
/cc @neolit123

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 31, 2020

// Converts the Static Pod-hosted control plane into a self-hosted one
waiter := apiclient.NewKubeWaiter(client, 2*time.Minute, os.Stdout)
return selfhosting.CreateSelfHostedControlPlane(constants.GetStaticPodDirectory(), constants.KubernetesDir, internalcfg, client, waiter, false, certsInSecrets)
Copy link
Member

Choose a reason for hiding this comment

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

please remove the selfhosting package under phases too:
k8s.io/kubernetes/cmd/kubeadm/app/phases/selfhosting

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

@knight42 knight42 force-pushed the refactor/remove-kubeadm-pivot branch from fc0a489 to e954ccc Compare December 31, 2020 05:10
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 31, 2020
@neolit123
Copy link
Member

looks like there are more things to clean up under the upgrade and constants packages:

controlplane $ grep "selfhost" * -rniI
app/cmd/alpha/alpha.go:38:      shCommand := newCmdSelfhosting(in)
app/cmd/alpha/BUILD:9:        "selfhosting.go",
app/cmd/alpha/BUILD:27:        "//cmd/kubeadm/app/phases/selfhosting:go_default_library",
app/cmd/alpha/selfhosting.go:38:        "k8s.io/kubernetes/cmd/kubeadm/app/phases/selfhosting"
app/cmd/alpha/selfhosting.go:45:        selfhostingLongDesc = cmdutil.LongDesc(`
app/cmd/alpha/selfhosting.go:52:        selfhostingExample = cmdutil.Examples(`
app/cmd/alpha/selfhosting.go:59:// newCmdSelfhosting returns the self-hosting Cobra command
app/cmd/alpha/selfhosting.go:60:func newCmdSelfhosting(in io.Reader) *cobra.Command {
app/cmd/alpha/selfhosting.go:62:                Use:     "selfhosting",
app/cmd/alpha/selfhosting.go:63:                Aliases: []string{"selfhosted", "self-hosting"},
app/cmd/alpha/selfhosting.go:68:        cmd.AddCommand(getSelfhostingSubCommand(in))
app/cmd/alpha/selfhosting.go:72:// getSelfhostingSubCommand returns sub commands for Self-hosting phase
app/cmd/alpha/selfhosting.go:73:func getSelfhostingSubCommand(in io.Reader) *cobra.Command {
app/cmd/alpha/selfhosting.go:87:                Long:    selfhostingLongDesc,
app/cmd/alpha/selfhosting.go:88:                Example: selfhostingExample,
app/cmd/alpha/selfhosting.go:137:                       return selfhosting.CreateSelfHostedControlPlane(constants.GetStaticPodDirectory(), constants.KubernetesDir, internalcfg, client, waiter, false, certsInSecrets)
app/cmd/upgrade/common.go:131:  if upgrade.IsControlPlaneSelfHosted(client) {
app/constants/constants_test.go:113:func TestAddSelfHostedPrefix(t *testing.T) {
app/constants/constants_test.go:136:                    actual := AddSelfHostedPrefix(rt.componentName)
app/constants/constants_test.go:139:                                    "failed AddSelfHostedPrefix:\n\texpected: %s\n\t  actual: %s",
app/constants/constants.go:307: // SelfHostingPrefix describes the prefix workloads that are self-hosted by kubeadm has
app/constants/constants.go:308: SelfHostingPrefix = "self-hosted-"
app/constants/constants.go:558:// AddSelfHostedPrefix adds the self-hosted- prefix to the component name
app/constants/constants.go:559:func AddSelfHostedPrefix(componentName string) string {
app/constants/constants.go:560: return fmt.Sprintf("%s%s", SelfHostingPrefix, componentName)
app/phases/selfhosting/selfhosting_test.go:17:package selfhosting
app/phases/selfhosting/selfhosting_volumes_test.go:17:package selfhosting
app/phases/selfhosting/selfhosting_volumes.go:17:package selfhosting
app/phases/selfhosting/podspec_mutation_test.go:17:package selfhosting
app/phases/selfhosting/podspec_mutation_test.go:290:func TestSetSelfHostedVolumesForAPIServer(t *testing.T) {
app/phases/selfhosting/podspec_mutation_test.go:298:                    name: "set selfhosted volumes for api server",
app/phases/selfhosting/podspec_mutation_test.go:377:                    setSelfHostedVolumesForAPIServer(rt.podSpec)
app/phases/selfhosting/podspec_mutation_test.go:382:                            t.Errorf("failed setSelfHostedVolumesForAPIServer:\nexpected:\n%v\nsaw:\n%v", rt.expected, *rt.podSpec)
app/phases/selfhosting/podspec_mutation_test.go:388:func TestSetSelfHostedVolumesForControllerManager(t *testing.T) {
app/phases/selfhosting/podspec_mutation_test.go:397:                    name: "set selfhosted volumes for controller mananger",
app/phases/selfhosting/podspec_mutation_test.go:503:                    setSelfHostedVolumesForControllerManager(rt.podSpec)
app/phases/selfhosting/podspec_mutation_test.go:508:                            t.Errorf("failed setSelfHostedVolumesForControllerManager:\nexpected:\n%v\nsaw:\n%v", rt.expected, *rt.podSpec)
app/phases/selfhosting/podspec_mutation_test.go:514:func TestSetSelfHostedVolumesForScheduler(t *testing.T) {
app/phases/selfhosting/podspec_mutation_test.go:522:                    name: "set selfhosted volumes for scheduler",
app/phases/selfhosting/podspec_mutation_test.go:581:                    setSelfHostedVolumesForScheduler(rt.podSpec)
app/phases/selfhosting/podspec_mutation_test.go:586:                            t.Errorf("failed setSelfHostedVolumesForScheduler:\nexpected:\n%v\nsaw:\n%v", rt.expected, *rt.podSpec)
app/phases/selfhosting/podspec_mutation.go:17:package selfhosting
app/phases/selfhosting/podspec_mutation.go:29:  // selfHostedKubeConfigDir sets the directory where kubeconfig files for the scheduler and controller-manager should be mounted
app/phases/selfhosting/podspec_mutation.go:32:  selfHostedKubeConfigDir = "/etc/kubernetes/kubeconfig"
app/phases/selfhosting/podspec_mutation.go:68:          mutators[kubeadmconstants.KubeAPIServer] = append(mutators[kubeadmconstants.KubeAPIServer], setSelfHostedVolumesForAPIServer)
app/phases/selfhosting/podspec_mutation.go:69:          mutators[kubeadmconstants.KubeControllerManager] = append(mutators[kubeadmconstants.KubeControllerManager], setSelfHostedVolumesForControllerManager)
app/phases/selfhosting/podspec_mutation.go:70:          mutators[kubeadmconstants.KubeScheduler] = append(mutators[kubeadmconstants.KubeScheduler], setSelfHostedVolumesForScheduler)
app/phases/selfhosting/podspec_mutation.go:131:// setSelfHostedVolumesForAPIServer makes sure the self-hosted api server has the right volume source coming from a self-hosted cluster
app/phases/selfhosting/podspec_mutation.go:132:func setSelfHostedVolumesForAPIServer(podSpec *v1.PodSpec) {
app/phases/selfhosting/podspec_mutation.go:141:// setSelfHostedVolumesForControllerManager makes sure the self-hosted controller manager has the right volume source coming from a self-hosted cluster
app/phases/selfhosting/podspec_mutation.go:142:func setSelfHostedVolumesForControllerManager(podSpec *v1.PodSpec) {
app/phases/selfhosting/podspec_mutation.go:152: // Change directory for the kubeconfig directory to selfHostedKubeConfigDir
app/phases/selfhosting/podspec_mutation.go:155:                 podSpec.Containers[0].VolumeMounts[i].MountPath = selfHostedKubeConfigDir
app/phases/selfhosting/podspec_mutation.go:163:         controllerManagerKubeConfigPath := filepath.Join(selfHostedKubeConfigDir, kubeadmconstants.ControllerManagerKubeConfigFileName)
app/phases/selfhosting/podspec_mutation.go:175:// setSelfHostedVolumesForScheduler makes sure the self-hosted scheduler has theright volume source coming from a self-hosted cluster
app/phases/selfhosting/podspec_mutation.go:176:func setSelfHostedVolumesForScheduler(podSpec *v1.PodSpec) {
app/phases/selfhosting/podspec_mutation.go:184: // Change directory for the kubeconfig directory to selfHostedKubeConfigDir
app/phases/selfhosting/podspec_mutation.go:187:                 podSpec.Containers[0].VolumeMounts[i].MountPath = selfHostedKubeConfigDir
app/phases/selfhosting/podspec_mutation.go:195:         schedulerKubeConfigPath := filepath.Join(selfHostedKubeConfigDir, kubeadmconstants.SchedulerKubeConfigFileName)
app/phases/selfhosting/BUILD:13:        "selfhosting_test.go",
app/phases/selfhosting/BUILD:14:        "selfhosting_volumes_test.go",
app/phases/selfhosting/BUILD:30:        "selfhosting.go",
app/phases/selfhosting/BUILD:31:        "selfhosting_volumes.go",
app/phases/selfhosting/BUILD:33:    importpath = "k8s.io/kubernetes/cmd/kubeadm/app/phases/selfhosting",
app/phases/selfhosting/selfhosting.go:17:package selfhosting
app/phases/selfhosting/selfhosting.go:40:       // selfHostingWaitTimeout describes the maximum amount of time a self-hosting wait process should wait before timing out
app/phases/selfhosting/selfhosting.go:41:       selfHostingWaitTimeout = 2 * time.Minute
app/phases/selfhosting/selfhosting.go:43:       // selfHostingFailureThreshold describes how many times kubeadm will retry creating the DaemonSets
app/phases/selfhosting/selfhosting.go:44:       selfHostingFailureThreshold int = 5
app/phases/selfhosting/selfhosting.go:47:// CreateSelfHostedControlPlane is responsible for turning a Static Pod-hosted controlplane to a self-hosted one
app/phases/selfhosting/selfhosting.go:59:func CreateSelfHostedControlPlane(manifestsDir, kubeConfigDir string, cfg *kubeadmapi.InitConfiguration, client clientset.Interface, waiter apiclient.Waiter, dryRun bool, certsInSecrets bool) error {
app/phases/selfhosting/selfhosting.go:62:       waiter.SetTimeout(selfHostingWaitTimeout)
app/phases/selfhosting/selfhosting.go:97:               // Create or update the DaemonSet in the API Server, and retry selfHostingFailureThreshold times if it errors out
app/phases/selfhosting/selfhosting.go:100:              }, selfHostingFailureThreshold); err != nil {
app/phases/selfhosting/selfhosting.go:105:              if err := waiter.WaitForPodsWithLabel(BuildSelfHostedComponentLabelQuery(componentName)); err != nil {
app/phases/selfhosting/selfhosting.go:143:                      Name:      kubeadmconstants.AddSelfHostedPrefix(name),
app/phases/selfhosting/selfhosting.go:145:                      Labels:    BuildSelfhostedComponentLabels(name),
app/phases/selfhosting/selfhosting.go:149:                              MatchLabels: BuildSelfhostedComponentLabels(name),
app/phases/selfhosting/selfhosting.go:153:                                      Labels: BuildSelfhostedComponentLabels(name),
app/phases/selfhosting/selfhosting.go:165:// BuildSelfhostedComponentLabels returns the labels for a self-hosted component
app/phases/selfhosting/selfhosting.go:166:func BuildSelfhostedComponentLabels(component string) map[string]string {
app/phases/selfhosting/selfhosting.go:168:              "k8s-app": kubeadmconstants.AddSelfHostedPrefix(component),
app/phases/selfhosting/selfhosting.go:172:// BuildSelfHostedComponentLabelQuery creates the right query for matching a self-hosted Pod
app/phases/selfhosting/selfhosting.go:173:func BuildSelfHostedComponentLabelQuery(componentName string) string {
app/phases/selfhosting/selfhosting.go:174:      return fmt.Sprintf("k8s-app=%s", kubeadmconstants.AddSelfHostedPrefix(componentName))
app/phases/upgrade/health.go:260:// IsControlPlaneSelfHosted returns whether the control plane is self hosted or not
app/phases/upgrade/health.go:261:func IsControlPlaneSelfHosted(client clientset.Interface) bool {
app/phases/upgrade/health.go:267:       // If there are no NotReady DaemonSets, we are using selfhosting
app/phases/upgrade/health.go:275:               dsName := constants.AddSelfHostedPrefix(component)
app/BUILD:51:        "//cmd/kubeadm/app/phases/selfhosting:all-srcs",

@knight42 knight42 force-pushed the refactor/remove-kubeadm-pivot branch from e954ccc to 57d5634 Compare December 31, 2020 05:47
@knight42
Copy link
Member Author

@neolit123 I think I have cleaned all of them now. PTAL

Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

thanks
/lgtm
/approve
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Dec 31, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 31, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: knight42, neolit123

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 31, 2020
@k8s-ci-robot k8s-ci-robot merged commit 8725c3b into kubernetes:master Dec 31, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Dec 31, 2020
@knight42 knight42 deleted the refactor/remove-kubeadm-pivot branch December 31, 2020 07:44
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/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/deprecation Categorizes issue or PR as related to a feature/enhancement marked for deprecation. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants