Skip to content

Commit 4304f4b

Browse files
authored
Merge pull request kubernetes#94869 from neolit123/1.20-remove-upgrade-node-kubelet-flag
kubeadm: remove the --kubelet-version flag for "upgrade node"
2 parents f5a0250 + 7185667 commit 4304f4b

File tree

3 files changed

+1
-23
lines changed

3 files changed

+1
-23
lines changed

cmd/kubeadm/app/cmd/phases/upgrade/node/data.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ type Data interface {
2828
EtcdUpgrade() bool
2929
RenewCerts() bool
3030
DryRun() bool
31-
KubeletVersion() string
3231
Cfg() *kubeadmapi.InitConfiguration
3332
IsControlPlaneNode() bool
3433
Client() clientset.Interface

cmd/kubeadm/app/cmd/phases/upgrade/node/kubeletconfig.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ func NewKubeletConfigPhase() workflow.Phase {
5050
InheritFlags: []string{
5151
options.DryRun,
5252
options.KubeconfigPath,
53-
options.KubeletVersion,
5453
},
5554
}
5655
return phase
@@ -76,17 +75,7 @@ func runKubeletConfigPhase() func(c workflow.RunData) error {
7675
// TODO: Checkpoint the current configuration first so that if something goes wrong it can be recovered
7776

7877
// Store the kubelet component configuration.
79-
// By default the kubelet version is expected to be equal to cfg.ClusterConfiguration.KubernetesVersion, but
80-
// users can specify a different kubelet version (this is a legacy of the original implementation
81-
// of `kubeadm upgrade node config` which we are preserving in order to not break the GA contract)
82-
if data.KubeletVersion() != "" && data.KubeletVersion() != cfg.ClusterConfiguration.KubernetesVersion {
83-
fmt.Printf("[upgrade] Using kubelet config version %s, while kubernetes-version is %s\n", data.KubeletVersion(), cfg.ClusterConfiguration.KubernetesVersion)
84-
if err := kubeletphase.DownloadConfig(data.Client(), data.KubeletVersion(), kubeletDir); err != nil {
85-
return err
86-
}
87-
88-
// WriteConfigToDisk is what we should be calling since we already have the correct component config loaded
89-
} else if err = kubeletphase.WriteConfigToDisk(&cfg.ClusterConfiguration, kubeletDir); err != nil {
78+
if err = kubeletphase.WriteConfigToDisk(&cfg.ClusterConfiguration, kubeletDir); err != nil {
9079
return err
9180
}
9281

cmd/kubeadm/app/cmd/upgrade/node.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import (
3939
// supported by this api will be exposed as a flag.
4040
type nodeOptions struct {
4141
kubeConfigPath string
42-
kubeletVersion string
4342
etcdUpgrade bool
4443
renewCerts bool
4544
dryRun bool
@@ -57,7 +56,6 @@ type nodeData struct {
5756
etcdUpgrade bool
5857
renewCerts bool
5958
dryRun bool
60-
kubeletVersion string
6159
cfg *kubeadmapi.InitConfiguration
6260
isControlPlaneNode bool
6361
client clientset.Interface
@@ -117,8 +115,6 @@ func newNodeOptions() *nodeOptions {
117115
func addUpgradeNodeFlags(flagSet *flag.FlagSet, nodeOptions *nodeOptions) {
118116
options.AddKubeConfigFlag(flagSet, &nodeOptions.kubeConfigPath)
119117
flagSet.BoolVar(&nodeOptions.dryRun, options.DryRun, nodeOptions.dryRun, "Do not change any state, just output the actions that would be performed.")
120-
flagSet.StringVar(&nodeOptions.kubeletVersion, options.KubeletVersion, nodeOptions.kubeletVersion, "The *desired* version for the kubelet config after the upgrade. If not specified, the KubernetesVersion from the kubeadm-config ConfigMap will be used")
121-
flagSet.MarkDeprecated(options.KubeletVersion, "This flag is deprecated and will be removed in a future version.")
122118
flagSet.BoolVar(&nodeOptions.renewCerts, options.CertificateRenewal, nodeOptions.renewCerts, "Perform the renewal of certificates used by component changed during upgrades.")
123119
flagSet.BoolVar(&nodeOptions.etcdUpgrade, options.EtcdUpgrade, nodeOptions.etcdUpgrade, "Perform the upgrade of etcd.")
124120
flagSet.StringSliceVar(&nodeOptions.ignorePreflightErrors, options.IgnorePreflightErrors, nodeOptions.ignorePreflightErrors, "A list of checks whose errors will be shown as warnings. Example: 'IsPrivilegedUser,Swap'. Value 'all' ignores errors from all checks.")
@@ -160,7 +156,6 @@ func newNodeData(cmd *cobra.Command, args []string, options *nodeOptions) (*node
160156
etcdUpgrade: options.etcdUpgrade,
161157
renewCerts: options.renewCerts,
162158
dryRun: options.dryRun,
163-
kubeletVersion: options.kubeletVersion,
164159
cfg: cfg,
165160
client: client,
166161
isControlPlaneNode: isControlPlaneNode,
@@ -185,11 +180,6 @@ func (d *nodeData) RenewCerts() bool {
185180
return d.renewCerts
186181
}
187182

188-
// KubeletVersion returns the kubeletVersion flag.
189-
func (d *nodeData) KubeletVersion() string {
190-
return d.kubeletVersion
191-
}
192-
193183
// Cfg returns initConfiguration.
194184
func (d *nodeData) Cfg() *kubeadmapi.InitConfiguration {
195185
return d.cfg

0 commit comments

Comments
 (0)