diff --git a/cmd/kubeadm/app/cmd/upgrade/common.go b/cmd/kubeadm/app/cmd/upgrade/common.go index 254c9afbce..82c3c10819 100644 --- a/cmd/kubeadm/app/cmd/upgrade/common.go +++ b/cmd/kubeadm/app/cmd/upgrade/common.go @@ -70,16 +70,19 @@ func enforceRequirements(flags *cmdUpgradeFlags, dryRun bool, newK8sVersion stri cfg.KubernetesVersion = newK8sVersion } + // If features gates are passed to the command line, use it (otherwise use featureGates from configuration) + if flags.featureGatesString != "" { + cfg.FeatureGates, err = features.NewFeatureGate(&features.InitFeatureGates, flags.featureGatesString) + if err != nil { + return nil, fmt.Errorf("[upgrade/config] FATAL: %v", err) + } + } + // If the user told us to print this information out; do it! if flags.printConfig { printConfiguration(cfg, os.Stdout) } - cfg.FeatureGates, err = features.NewFeatureGate(&features.InitFeatureGates, flags.featureGatesString) - if err != nil { - return nil, fmt.Errorf("[upgrade/config] FATAL: %v", err) - } - return &upgradeVariables{ client: client, cfg: cfg,