Merge pull request #3232 from KashifSaadat/cluster-upgrade-persist-custom-image

Automatic merge from submit-queue

Don't force ig image change on cluster upgrade if it is custom.

Fixes #3160
This commit is contained in:
Kubernetes Submit Queue 2017-08-18 14:51:54 -07:00 committed by GitHub
commit e3f27a6880
1 changed files with 16 additions and 11 deletions

View File

@ -19,6 +19,7 @@ package main
import ( import (
"fmt" "fmt"
"os" "os"
"strings"
"github.com/blang/semver" "github.com/blang/semver"
"github.com/golang/glog" "github.com/golang/glog"
@ -204,17 +205,21 @@ func (c *UpgradeClusterCmd) Run(args []string) error {
glog.Warningf("No matching images specified in channel; cannot prompt for upgrade") glog.Warningf("No matching images specified in channel; cannot prompt for upgrade")
} else { } else {
for _, ig := range instanceGroups { for _, ig := range instanceGroups {
if ig.Spec.Image != image.Name { if strings.Contains(ig.Spec.Image, "kope.io") {
target := ig if ig.Spec.Image != image.Name {
actions = append(actions, &upgradeAction{ target := ig
Item: "InstanceGroup/" + target.ObjectMeta.Name, actions = append(actions, &upgradeAction{
Property: "Image", Item: "InstanceGroup/" + target.ObjectMeta.Name,
Old: target.Spec.Image, Property: "Image",
New: image.Name, Old: target.Spec.Image,
apply: func() { New: image.Name,
target.Spec.Image = image.Name apply: func() {
}, target.Spec.Image = image.Name
}) },
})
}
} else {
glog.Infof("Custom image (%s) has been provided for Instance Group %q; not updating image", ig.Spec.Image, ig.GetName())
} }
} }
} }