Merge pull request #94869 from neolit123/1.20-remove-upgrade-node-kubelet-flag

kubeadm: remove the --kubelet-version flag for "upgrade node"
This commit is contained in:
Kubernetes Prow Robot 2020-09-21 12:55:52 -07:00 committed by GitHub
commit 4304f4bdbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 23 deletions

View File

@ -28,7 +28,6 @@ type Data interface {
EtcdUpgrade() bool
RenewCerts() bool
DryRun() bool
KubeletVersion() string
Cfg() *kubeadmapi.InitConfiguration
IsControlPlaneNode() bool
Client() clientset.Interface

View File

@ -50,7 +50,6 @@ func NewKubeletConfigPhase() workflow.Phase {
InheritFlags: []string{
options.DryRun,
options.KubeconfigPath,
options.KubeletVersion,
},
}
return phase
@ -76,17 +75,7 @@ func runKubeletConfigPhase() func(c workflow.RunData) error {
// TODO: Checkpoint the current configuration first so that if something goes wrong it can be recovered
// Store the kubelet component configuration.
// By default the kubelet version is expected to be equal to cfg.ClusterConfiguration.KubernetesVersion, but
// users can specify a different kubelet version (this is a legacy of the original implementation
// of `kubeadm upgrade node config` which we are preserving in order to not break the GA contract)
if data.KubeletVersion() != "" && data.KubeletVersion() != cfg.ClusterConfiguration.KubernetesVersion {
fmt.Printf("[upgrade] Using kubelet config version %s, while kubernetes-version is %s\n", data.KubeletVersion(), cfg.ClusterConfiguration.KubernetesVersion)
if err := kubeletphase.DownloadConfig(data.Client(), data.KubeletVersion(), kubeletDir); err != nil {
return err
}
// WriteConfigToDisk is what we should be calling since we already have the correct component config loaded
} else if err = kubeletphase.WriteConfigToDisk(&cfg.ClusterConfiguration, kubeletDir); err != nil {
if err = kubeletphase.WriteConfigToDisk(&cfg.ClusterConfiguration, kubeletDir); err != nil {
return err
}

View File

@ -39,7 +39,6 @@ import (
// supported by this api will be exposed as a flag.
type nodeOptions struct {
kubeConfigPath string
kubeletVersion string
etcdUpgrade bool
renewCerts bool
dryRun bool
@ -57,7 +56,6 @@ type nodeData struct {
etcdUpgrade bool
renewCerts bool
dryRun bool
kubeletVersion string
cfg *kubeadmapi.InitConfiguration
isControlPlaneNode bool
client clientset.Interface
@ -117,8 +115,6 @@ func newNodeOptions() *nodeOptions {
func addUpgradeNodeFlags(flagSet *flag.FlagSet, nodeOptions *nodeOptions) {
options.AddKubeConfigFlag(flagSet, &nodeOptions.kubeConfigPath)
flagSet.BoolVar(&nodeOptions.dryRun, options.DryRun, nodeOptions.dryRun, "Do not change any state, just output the actions that would be performed.")
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")
flagSet.MarkDeprecated(options.KubeletVersion, "This flag is deprecated and will be removed in a future version.")
flagSet.BoolVar(&nodeOptions.renewCerts, options.CertificateRenewal, nodeOptions.renewCerts, "Perform the renewal of certificates used by component changed during upgrades.")
flagSet.BoolVar(&nodeOptions.etcdUpgrade, options.EtcdUpgrade, nodeOptions.etcdUpgrade, "Perform the upgrade of etcd.")
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
etcdUpgrade: options.etcdUpgrade,
renewCerts: options.renewCerts,
dryRun: options.dryRun,
kubeletVersion: options.kubeletVersion,
cfg: cfg,
client: client,
isControlPlaneNode: isControlPlaneNode,
@ -185,11 +180,6 @@ func (d *nodeData) RenewCerts() bool {
return d.renewCerts
}
// KubeletVersion returns the kubeletVersion flag.
func (d *nodeData) KubeletVersion() string {
return d.kubeletVersion
}
// Cfg returns initConfiguration.
func (d *nodeData) Cfg() *kubeadmapi.InitConfiguration {
return d.cfg