Add cleanup policy to RollingUpdater

* Support configurable cleanup policies in RollingUpdater. Downstream
library consumers don't necessarily have the same rules for post
deployment cleanup; making the behavior policy driven is more flexible.

* Refactor RollingUpdater to accept a config object during Update instead
of a long argument list.

* Add test coverage for cleanup policy.
This commit is contained in:
Dan Mace
2015-04-17 14:58:43 -04:00
parent 94ae93a46b
commit 093b7c2e25
3 changed files with 174 additions and 19 deletions

View File

@@ -134,7 +134,15 @@ func RunRollingUpdate(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, arg
if newRc.Spec.Replicas == 0 {
newRc.Spec.Replicas = oldRc.Spec.Replicas
}
err = updater.Update(out, oldRc, newRc, period, interval, timeout)
err = updater.Update(&kubectl.RollingUpdaterConfig{
Out: out,
OldRc: oldRc,
NewRc: newRc,
UpdatePeriod: period,
Interval: interval,
Timeout: timeout,
CleanupPolicy: kubectl.DeleteRollingUpdateCleanupPolicy,
})
if err != nil {
return err
}