...
1
16
17 package rollout
18
19 import (
20 "github.com/lithammer/dedent"
21 "github.com/spf13/cobra"
22
23 "k8s.io/cli-runtime/pkg/genericiooptions"
24
25 cmdutil "k8s.io/kubectl/pkg/cmd/util"
26 "k8s.io/kubectl/pkg/util/i18n"
27 "k8s.io/kubectl/pkg/util/templates"
28 )
29
30 var (
31 rolloutLong = templates.LongDesc(i18n.T(`
32 Manage the rollout of one or many resources.`) + rolloutValidResources)
33
34 rolloutExample = templates.Examples(`
35 # Rollback to the previous deployment
36 kubectl rollout undo deployment/abc
37
38 # Check the rollout status of a daemonset
39 kubectl rollout status daemonset/foo
40
41 # Restart a deployment
42 kubectl rollout restart deployment/abc
43
44 # Restart deployments with the 'app=nginx' label
45 kubectl rollout restart deployment --selector=app=nginx`)
46
47 rolloutValidResources = dedent.Dedent(`
48 Valid resource types include:
49
50 * deployments
51 * daemonsets
52 * statefulsets
53 `)
54 )
55
56
57 func NewCmdRollout(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command {
58 cmd := &cobra.Command{
59 Use: "rollout SUBCOMMAND",
60 DisableFlagsInUseLine: true,
61 Short: i18n.T("Manage the rollout of a resource"),
62 Long: rolloutLong,
63 Example: rolloutExample,
64 Run: cmdutil.DefaultSubCommandRun(streams.Out),
65 }
66
67 cmd.AddCommand(NewCmdRolloutHistory(f, streams))
68 cmd.AddCommand(NewCmdRolloutPause(f, streams))
69 cmd.AddCommand(NewCmdRolloutResume(f, streams))
70 cmd.AddCommand(NewCmdRolloutUndo(f, streams))
71 cmd.AddCommand(NewCmdRolloutStatus(f, streams))
72 cmd.AddCommand(NewCmdRolloutRestart(f, streams))
73
74 return cmd
75 }
76
View as plain text