rollout.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. Copyright 2016 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package rollout
  14. import (
  15. "io"
  16. "github.com/renstrom/dedent"
  17. "github.com/spf13/cobra"
  18. cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
  19. )
  20. var (
  21. rollout_long = dedent.Dedent(`
  22. Manage a deployment using subcommands like "kubectl rollout undo deployment/abc"`)
  23. rollout_example = dedent.Dedent(`
  24. # Rollback to the previous deployment
  25. kubectl rollout undo deployment/abc`)
  26. rollout_valid_resources = dedent.Dedent(`
  27. Valid resource types include:
  28. * deployments
  29. `)
  30. )
  31. func NewCmdRollout(f *cmdutil.Factory, out io.Writer) *cobra.Command {
  32. cmd := &cobra.Command{
  33. Use: "rollout SUBCOMMAND",
  34. Short: "Manage a deployment rollout",
  35. Long: rollout_long,
  36. Example: rollout_example,
  37. Run: func(cmd *cobra.Command, args []string) {
  38. cmd.Help()
  39. },
  40. }
  41. // subcommands
  42. cmd.AddCommand(NewCmdRolloutHistory(f, out))
  43. cmd.AddCommand(NewCmdRolloutPause(f, out))
  44. cmd.AddCommand(NewCmdRolloutResume(f, out))
  45. cmd.AddCommand(NewCmdRolloutUndo(f, out))
  46. cmd.AddCommand(NewCmdRolloutStatus(f, out))
  47. return cmd
  48. }