Commit 275a7481 authored by Lubomir I. Ivanov's avatar Lubomir I. Ivanov

kubeadm: fix "upgrade plan" not working without k8s version

If the k8s version argument passed to "upgrade plan" is missing the logic should perform the following actions: - fetch a "stable" version from the internet. - if that fails, fallback to the local client version. Currentely the logic fails because the cfg.KubernetesVersion is defaulted to the version of the existing cluster, which then causes an early exit without any ugprade suggestions. See app/cmd/upgrade/common.go::enforceRequirements(): configutil.FetchInitConfigurationFromCluster(..) Fix that by passing the explicit user value that can also be "". This will then make the "offline getter" treat it as an explicit desired upgrade target. In the future it might be best to invert this logic: - if no user k8s version argument is passed - default to the kubeadm version. - if labels are passed (e.g. "stable"), fetch a version from the internet.
parent a9f35a67
...@@ -154,7 +154,7 @@ func enforceRequirements(flags *applyPlanFlags, dryRun bool, newK8sVersion strin ...@@ -154,7 +154,7 @@ func enforceRequirements(flags *applyPlanFlags, dryRun bool, newK8sVersion strin
} }
// Use a real version getter interface that queries the API server, the kubeadm client and the Kubernetes CI system for latest versions // Use a real version getter interface that queries the API server, the kubeadm client and the Kubernetes CI system for latest versions
return client, upgrade.NewOfflineVersionGetter(upgrade.NewKubeVersionGetter(client, os.Stdout), cfg.KubernetesVersion), cfg, nil return client, upgrade.NewOfflineVersionGetter(upgrade.NewKubeVersionGetter(client, os.Stdout), newK8sVersion), cfg, nil
} }
// printConfiguration prints the external version of the API to yaml // printConfiguration prints the external version of the API to yaml
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment