Implement kubectl rollout history and undo for DaemonSet

This commit is contained in:
Janet Kuo
2017-05-18 15:46:20 -07:00
parent dbd1503b65
commit edabdac094
13 changed files with 323 additions and 34 deletions

View File

@@ -28,15 +28,20 @@ import (
var (
rollout_long = templates.LongDesc(`
Manage a deployment using subcommands like "kubectl rollout undo deployment/abc"`)
Manage the rollout of a resource.` + rollout_valid_resources)
rollout_example = templates.Examples(`
# Rollback to the previous deployment
kubectl rollout undo deployment/abc`)
kubectl rollout undo deployment/abc
# Check the rollout status of a daemonset
kubectl rollout status daemonset/foo`)
rollout_valid_resources = dedent.Dedent(`
Valid resource types include:
* deployments
* daemonsets
`)
)
@@ -44,7 +49,7 @@ func NewCmdRollout(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "rollout SUBCOMMAND",
Short: i18n.T("Manage a deployment rollout"),
Short: i18n.T("Manage the rollout of a resource"),
Long: rollout_long,
Example: rollout_example,
Run: cmdutil.DefaultSubCommandRun(errOut),
@@ -54,7 +59,6 @@ func NewCmdRollout(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
cmd.AddCommand(NewCmdRolloutPause(f, out))
cmd.AddCommand(NewCmdRolloutResume(f, out))
cmd.AddCommand(NewCmdRolloutUndo(f, out))
cmd.AddCommand(NewCmdRolloutStatus(f, out))
return cmd

View File

@@ -37,14 +37,14 @@ var (
# View the rollout history of a deployment
kubectl rollout history deployment/abc
# View the details of deployment revision 3
kubectl rollout history deployment/abc --revision=3`)
# View the details of daemonset revision 3
kubectl rollout history daemonset/abc --revision=3`)
)
func NewCmdRolloutHistory(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := &resource.FilenameOptions{}
validArgs := []string{"deployment"}
validArgs := []string{"deployment", "daemonset"}
argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{

View File

@@ -53,7 +53,7 @@ var (
Mark the provided resource as paused
Paused resources will not be reconciled by a controller.
Use \"kubectl rollout resume\" to resume a paused resource.
Use "kubectl rollout resume" to resume a paused resource.
Currently only deployments support being paused.`)
pause_example = templates.Examples(`

View File

@@ -50,7 +50,7 @@ var (
func NewCmdRolloutStatus(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := &resource.FilenameOptions{}
validArgs := []string{"deployment"}
validArgs := []string{"deployment", "daemonset"}
argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{

View File

@@ -54,8 +54,8 @@ var (
# Rollback to the previous deployment
kubectl rollout undo deployment/abc
# Rollback to deployment revision 3
kubectl rollout undo deployment/abc --to-revision=3
# Rollback to daemonset revision 3
kubectl rollout undo daemonset/abc --to-revision=3
# Rollback to the previous deployment with dry-run
kubectl rollout undo --dry-run=true deployment/abc`)
@@ -64,7 +64,7 @@ var (
func NewCmdRolloutUndo(f cmdutil.Factory, out io.Writer) *cobra.Command {
options := &UndoOptions{}
validArgs := []string{"deployment"}
validArgs := []string{"deployment", "daemonset"}
argAliases := kubectl.ResourceAliases(validArgs)
cmd := &cobra.Command{