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

kubeadm: support fetching configuration from the original cluster for 'upgrade diff' #80025

Merged
merged 1 commit into from
Jul 13, 2019

Conversation

SataQiu
Copy link
Member

@SataQiu SataQiu commented Jul 11, 2019

What type of PR is this?
/kind bug
/kind cleanup
/kind feature

What this PR does / why we need it:
kubeadm: support fetching configuration from the original cluster for 'upgrade diff'

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

kubeadm: support fetching configuration from the original cluster for 'upgrade diff'

@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/bug Categorizes issue or PR as related to a bug. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 11, 2019
@k8s-ci-robot k8s-ci-robot requested review from dixudx and timothysc July 11, 2019 10:00
@k8s-ci-robot k8s-ci-robot added area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 11, 2019
@SataQiu
Copy link
Member Author

SataQiu commented Jul 11, 2019

/cc @neolit123

@k8s-ci-robot k8s-ci-robot requested a review from neolit123 July 11, 2019 10:32
@SataQiu SataQiu force-pushed the fix-kubeadm-diff-20190711 branch from 58543a0 to eb90a7d Compare July 11, 2019 14:48
Copy link
Member

@yastij yastij left a comment

Choose a reason for hiding this comment

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

just nits and missing tests, but lgtm overall

var cfg *kubeadmapi.InitConfiguration
if flags.cfgPath != "" {
cfg, err = configutil.LoadInitConfigurationFromFile(flags.cfgPath)
} else {
Copy link
Member

Choose a reason for hiding this comment

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

can you add a test case for this ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @yastij
This does lack test cases. But FetchInitConfigurationFromCluster requires a running kubernetes cluster. How should we write this kind of test cases? Any examples?

Copy link
Member

Choose a reason for hiding this comment

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

If we want to unit test this, we need to mock FetchInitConfigurationFromCluster

Copy link
Member

Choose a reason for hiding this comment

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

yeah, let's not do the mock/unit test of the function in question for now.

Copy link
Member

Choose a reason for hiding this comment

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

I can settle with that, modulo a TODO or something to make us remember to do this

Copy link
Member Author

Choose a reason for hiding this comment

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

@yastij Where should we put the TODO:? in diff_test.go ?

Copy link
Member

Choose a reason for hiding this comment

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

diff_test.go seems reasonable to me

Copy link
Member Author

Choose a reason for hiding this comment

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

@yastij Done

@@ -47,7 +47,7 @@ func CreateInitStaticPodManifestFiles(manifestDir string, cfg *kubeadmapi.InitCo

// GetStaticPodSpecs returns all staticPodSpecs actualized to the context of the current configuration
// NB. this methods holds the information about how kubeadm creates static pod manifests.
func GetStaticPodSpecs(cfg *kubeadmapi.ClusterConfiguration, endpoint *kubeadmapi.APIEndpoint, k8sVersion *version.Version) map[string]v1.Pod {
func GetStaticPodSpecs(cfg *kubeadmapi.ClusterConfiguration, endpoint *kubeadmapi.APIEndpoint) map[string]v1.Pod {
Copy link
Member

Choose a reason for hiding this comment

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

can you move this refactoring to a separate PR ?

Copy link
Member

Choose a reason for hiding this comment

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

ok, @SataQiu
please move :

  • Fix the bug that k8sVersion is unused in kubeadm/app/phases/controlplane/manifests.go#getControllerManagerCommand function.
  • manifests.go#GetStaticPodSpecs uses cfg.KubernetesVersion instead of k8sVersion to generate manifests. This PR cleans up redundant k8sVersion parameter.

to separate PR.

Copy link
Member

Choose a reason for hiding this comment

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

ideally in other projects i'd just recommend a separate commit, but let's follow what k/k does / recommends.

@yastij
Copy link
Member

yastij commented Jul 12, 2019

/assign @neolit123

@SataQiu SataQiu changed the title kubeadm: add the ability of reading configuration from cluster for 'kubeadm upgrade diff' kubeadm: support fetching configuration from the origin cluster for 'upgrade diff' Jul 12, 2019
@SataQiu SataQiu changed the title kubeadm: support fetching configuration from the origin cluster for 'upgrade diff' kubeadm: support fetching configuration from the original cluster for 'upgrade diff' Jul 12, 2019
@SataQiu SataQiu force-pushed the fix-kubeadm-diff-20190711 branch from eb90a7d to 6dc0968 Compare July 12, 2019 13:55
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 12, 2019
@SataQiu SataQiu force-pushed the fix-kubeadm-diff-20190711 branch from 6dc0968 to a49f62f Compare July 12, 2019 15:52
@yastij
Copy link
Member

yastij commented Jul 12, 2019

/lgtm
/priority backlog

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jul 12, 2019
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 12, 2019
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 for the update.
/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jul 12, 2019
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

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/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants