-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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: fix bug of kubeletconfig not being downloaded on upgrade #124480
kubeadm: fix bug of kubeletconfig not being downloaded on upgrade #124480
Conversation
During upgrade apply we had logic to download the kubelet and kubeproxy configs from the cluster as part of the call to: FetchInitConfigurationFromCluster() With the introduction of UpgradeConfiguration there was some refactor in this area and the function no longer had the argument skipComponentConfigs set to false. It is set to 'true', an InitConfiguration is downloaded but it would contain empty / defaulted component configs. - Set the argument to 'false' - Perform minor cleanup of STDOUT messages and comments. that were missed in 1.30.
/kind bug |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proposing all these changes for backport and not only the function argument switch true -> false
@@ -53,17 +53,14 @@ import ( | |||
|
|||
// enforceRequirements verifies that it's okay to upgrade and then returns the variables needed for the rest of the procedure | |||
func enforceRequirements(flagSet *pflag.FlagSet, flags *applyPlanFlags, args []string, dryRun bool, upgradeApply bool, printer output.Printer) (clientset.Interface, upgrade.VersionGetter, *kubeadmapi.InitConfiguration, *kubeadmapi.UpgradeConfiguration, error) { | |||
// Fetch the configuration from a file or ConfigMap and validate it | |||
_, _ = printer.Printf("[upgrade/config] Making sure the configuration is correct:\n") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this message is just confusing on the CLI output.
the config is loaded or defaulted, so there is no need for the message i think.
externalCfg := &v1beta4.UpgradeConfiguration{} | ||
opt := configutil.LoadOrDefaultConfigurationOptions{} | ||
upgradeCfg, err := configutil.LoadOrDefaultUpgradeConfiguration(flags.cfgPath, externalCfg, opt) | ||
if err != nil { | ||
return nil, nil, nil, nil, errors.Wrap(err, "[upgrade/upgrade config] FATAL") | ||
} | ||
|
||
// `dryRun` should be always `false` for `kubeadm plan`. | ||
// `dryRun` should be always be `false` for `kubeadm plan`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
_, _ = printer.Printf("[upgrade/config] In order to upgrade, a ConfigMap called %q in the %q namespace must exist.\n", constants.KubeadmConfigConfigMap, metav1.NamespaceSystem) | ||
_, _ = printer.Printf("[upgrade/config] Use 'kubeadm init phase upload-config --config your-config.yaml' to re-upload it.\n") | ||
err = errors.Errorf("the ConfigMap %q in the %q namespace was not found", constants.KubeadmConfigConfigMap, metav1.NamespaceSystem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the old message is just incorrect. there is no longer a command "kubeadm config"
@@ -99,15 +96,12 @@ func enforceRequirements(flagSet *pflag.FlagSet, flags *applyPlanFlags, args []s | |||
return nil, nil, nil, nil, err | |||
} | |||
|
|||
initCfg, err := configutil.FetchInitConfigurationFromCluster(client, printer, "upgrade/config", false, true) | |||
initCfg, err := configutil.FetchInitConfigurationFromCluster(client, printer, "upgrade/config", false, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the main fix!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we change the behavior introduced by #91980?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, test did not cover this scenario.
Only if skipComponentConfigs is set to false, the componentConfig of kubelet and kubeproxy can be returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we change the behavior introduced by #91980?
this was already removed as a feature since its not possible to supply them with --config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, test did not cover this scenario. Only if skipComponentConfigs is set to false, the componentConfig of kubelet and kubeproxy can be returned.
yeah, it needs refractor for proper unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/retest |
LGTM label has been added. Git tree hash: a7be0fb1d93f3096132814753ebd9a79611622eb
|
…24480-origin-release-1.30 Automated cherry pick of #124480: kubeadm: fix bug of kubeletconfig not being downloaded on
What type of PR is this?
What this PR does / why we need it:
During upgrade apply we had logic to download the kubelet and kubeproxy configs from the cluster as part of the call to:
FetchInitConfigurationFromCluster()
With the introduction of UpgradeConfiguration there was some refactor in this area and the function no longer had the argument skipComponentConfigs set to false.
It is set to 'true', an InitConfiguration is downloaded but it would contain empty / defaulted component configs.
Which issue(s) this PR fixes:
xref kubernetes/kubeadm#3049
Special notes for your reviewer:
PROPOSING to include the comment / STDOUT changes in the backport to 1.30.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: