Merge pull request #62455 from fabriziopandini/kubeadm-731

Automatic merge from submit-queue (batch tested with PRs 62455, 62465, 62427, 62416, 62411). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix kubeadm upgrade ignores HighAvailability feature gate

**What this PR does / why we need it**:
This PR fixes https://github.com/kubernetes/kubeadm/issues/731

**Which issue(s) this PR fixes**:
Fixes https://github.com/kubernetes/kubeadm/issues/731

**Special notes for your reviewer**:
The problem is a regression introduced by [#55952](https://github.com/kubernetes/kubernetes/pull/55952) which added a --feature-gates 
flag to `kubeadm upgrade`, to be used for updating feature gates during the upgrade process (so it is update + upgrade). 

The original implementation always override the actual feature gates with the flag value, even when the flag is not set; this PR fixes this behaviour making `kubeadm upgrade` considers the flag value only if set, otherwise actual feature gates will be preserved.

/cc @kubernetes/sig-cluster-lifecycle-pr-reviews @kubernetes/sig-cluster-lifecycle-bugs 

**Release note**:
```release-note
Fixed #731 kubeadm upgrade ignores HighAvailability feature gate
```
pull/8/head
Kubernetes Submit Queue 2018-04-12 08:54:08 -07:00 committed by GitHub
commit c07caaa7fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -70,15 +70,18 @@ func enforceRequirements(flags *cmdUpgradeFlags, dryRun bool, newK8sVersion stri
cfg.KubernetesVersion = newK8sVersion
}
// If the user told us to print this information out; do it!
if flags.printConfig {
printConfiguration(cfg, os.Stdout)
}
// 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)
}
return &upgradeVariables{
client: client,