2016-01-20 21:35:01 +00:00
|
|
|
/*
|
2016-06-03 00:25:58 +00:00
|
|
|
Copyright 2016 The Kubernetes Authors.
|
2016-01-20 21:35:01 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package rollout
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
2016-05-20 17:49:56 +00:00
|
|
|
"github.com/renstrom/dedent"
|
2016-01-20 21:35:01 +00:00
|
|
|
"github.com/spf13/cobra"
|
2016-10-07 22:24:42 +00:00
|
|
|
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
|
2016-01-20 21:35:01 +00:00
|
|
|
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
|
|
|
)
|
|
|
|
|
2016-05-20 17:49:56 +00:00
|
|
|
var (
|
2016-10-07 22:24:42 +00:00
|
|
|
rollout_long = templates.LongDesc(`
|
2016-06-07 17:38:04 +00:00
|
|
|
Manage a deployment using subcommands like "kubectl rollout undo deployment/abc"`)
|
2016-10-07 22:24:42 +00:00
|
|
|
|
|
|
|
rollout_example = templates.Examples(`
|
2016-05-20 17:49:56 +00:00
|
|
|
# Rollback to the previous deployment
|
|
|
|
kubectl rollout undo deployment/abc`)
|
2016-10-07 22:24:42 +00:00
|
|
|
|
2016-05-20 17:49:56 +00:00
|
|
|
rollout_valid_resources = dedent.Dedent(`
|
|
|
|
Valid resource types include:
|
|
|
|
* deployments
|
|
|
|
`)
|
2016-01-20 21:35:01 +00:00
|
|
|
)
|
|
|
|
|
2016-10-13 00:18:39 +00:00
|
|
|
func NewCmdRollout(f cmdutil.Factory, out io.Writer) *cobra.Command {
|
2016-01-20 21:35:01 +00:00
|
|
|
|
|
|
|
cmd := &cobra.Command{
|
|
|
|
Use: "rollout SUBCOMMAND",
|
2016-06-07 17:38:04 +00:00
|
|
|
Short: "Manage a deployment rollout",
|
2016-01-20 21:35:01 +00:00
|
|
|
Long: rollout_long,
|
|
|
|
Example: rollout_example,
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
cmd.Help()
|
|
|
|
},
|
|
|
|
}
|
2016-01-19 22:50:03 +00:00
|
|
|
// subcommands
|
2016-01-20 23:48:52 +00:00
|
|
|
cmd.AddCommand(NewCmdRolloutHistory(f, out))
|
2016-01-25 11:34:48 +00:00
|
|
|
cmd.AddCommand(NewCmdRolloutPause(f, out))
|
|
|
|
cmd.AddCommand(NewCmdRolloutResume(f, out))
|
2016-01-19 22:50:03 +00:00
|
|
|
cmd.AddCommand(NewCmdRolloutUndo(f, out))
|
2016-01-20 23:48:52 +00:00
|
|
|
|
2016-01-21 19:07:23 +00:00
|
|
|
cmd.AddCommand(NewCmdRolloutStatus(f, out))
|
|
|
|
|
2016-01-20 21:35:01 +00:00
|
|
|
return cmd
|
|
|
|
}
|