mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Merge pull request #11942 from ironcladlou/rolling-update-availability
Auto commit by PR queue bot
This commit is contained in:
@@ -32,6 +32,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/kubectl"
|
||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||
"k8s.io/kubernetes/pkg/kubectl/resource"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
)
|
||||
|
||||
// RollingUpdateOptions is the start of the data required to perform the operation. As new fields are added, add them here instead of
|
||||
@@ -148,8 +149,6 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
|
||||
return err
|
||||
}
|
||||
|
||||
updaterClient := kubectl.NewRollingUpdaterClient(client)
|
||||
|
||||
var newRc *api.ReplicationController
|
||||
// fetch rc
|
||||
oldRc, err := client.ReplicationControllers(cmdNamespace).Get(oldName)
|
||||
@@ -158,11 +157,11 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
|
||||
return err
|
||||
}
|
||||
// We're in the middle of a rename, look for an RC with a source annotation of oldName
|
||||
newRc, err := kubectl.FindSourceController(updaterClient, cmdNamespace, oldName)
|
||||
newRc, err := kubectl.FindSourceController(client, cmdNamespace, oldName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return kubectl.Rename(kubectl.NewRollingUpdaterClient(client), newRc, oldName)
|
||||
return kubectl.Rename(client, newRc, oldName)
|
||||
}
|
||||
|
||||
var keepOldName bool
|
||||
@@ -242,7 +241,7 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
|
||||
filename, oldName)
|
||||
}
|
||||
|
||||
updater := kubectl.NewRollingUpdater(newRc.Namespace, updaterClient)
|
||||
updater := kubectl.NewRollingUpdater(newRc.Namespace, client)
|
||||
|
||||
// To successfully pull off a rolling update the new and old rc have to differ
|
||||
// by at least one selector. Every new pod should have the selector and every
|
||||
@@ -286,7 +285,8 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
|
||||
Interval: interval,
|
||||
Timeout: timeout,
|
||||
CleanupPolicy: updateCleanupPolicy,
|
||||
UpdateAcceptor: kubectl.DefaultUpdateAcceptor,
|
||||
MaxUnavailable: util.NewIntOrStringFromInt(0),
|
||||
MaxSurge: util.NewIntOrStringFromInt(1),
|
||||
}
|
||||
if cmdutil.GetFlagBool(cmd, "rollback") {
|
||||
kubectl.AbortRollingUpdate(config)
|
||||
|
||||
Reference in New Issue
Block a user