diff --git a/cli/internal/kubecmd/kubecmd.go b/cli/internal/kubecmd/kubecmd.go index e6db339532..7d5a990a0c 100644 --- a/cli/internal/kubecmd/kubecmd.go +++ b/cli/internal/kubecmd/kubecmd.go @@ -117,13 +117,12 @@ func (k *KubeCmd) UpgradeK8sVersion(ctx context.Context, k8sVersion versions.Val string(k8sVersion), fmt.Errorf("no version config matching K8s %s", k8sVersion)) } components, err = k.updateK8s(&nodeVersion, versionConfig.ClusterVersion, versionConfig.KubernetesComponents, force) - if err == nil { - err = k.applyComponentsCM(ctx, components) - if err != nil { - return fmt.Errorf("applying k8s components ConfigMap: %w", err) - } + if err != nil { + return fmt.Errorf("updating K8s: %w", err) + } + if err := k.applyComponentsCM(ctx, components); err != nil { + return fmt.Errorf("applying k8s components ConfigMap: %w", err) } - fmt.Println("Successfully updated Kubernetes version", nodeVersion.Spec.KubernetesClusterVersion, "conf", k8sVersion) updatedNodeVersion, err := k.applyNodeVersion(ctx, nodeVersion) if err != nil { return fmt.Errorf("applying upgrade: %w", err)