pkg/cmd/cli/cmd/set/set.go
95ec120f
 package set
 
 import (
 	"fmt"
 	"io"
 
 	"github.com/spf13/cobra"
a3eb6164
 	"k8s.io/kubernetes/pkg/kubectl/cmd/set"
95ec120f
 
 	"github.com/openshift/origin/pkg/cmd/templates"
 	cmdutil "github.com/openshift/origin/pkg/cmd/util"
 	"github.com/openshift/origin/pkg/cmd/util/clientcmd"
 )
 
6267dded
 var (
 	setLong = templates.LongDesc(`
 		Configure application resources
95ec120f
 
6267dded
 		These commands help you make changes to existing application resources.`)
95ec120f
 )
 
 // NewCmdSet exposes commands for modifying objects.
 func NewCmdSet(fullName string, f *clientcmd.Factory, in io.Reader, out, errout io.Writer) *cobra.Command {
 	set := &cobra.Command{
 		Use:   "set COMMAND",
 		Short: "Commands that help set specific features on objects",
 		Long:  setLong,
 		Run:   cmdutil.DefaultSubCommandRun(out),
 	}
 
 	name := fmt.Sprintf("%s set", fullName)
 
 	groups := templates.CommandGroups{
 		{
 			Message: "Replication controllers, deployments, and daemon sets:",
 			Commands: []*cobra.Command{
dd473fd9
 				NewCmdEnv(name, f, in, out, errout),
95ec120f
 				NewCmdVolume(name, f, out, errout),
b2de2910
 				NewCmdProbe(name, f, out, errout),
e8c6533e
 				NewCmdDeploymentHook(name, f, out, errout),
a3eb6164
 				NewCmdImage(name, f, out),
95ec120f
 			},
 		},
304a2b2b
 		{
a3360680
 			Message: "Manage secrets:",
 			Commands: []*cobra.Command{
 				NewCmdBuildSecret(name, f, out, errout),
 			},
 		},
 		{
304a2b2b
 			Message: "Manage application flows:",
 			Commands: []*cobra.Command{
 				NewCmdTriggers(name, f, out, errout),
01f3ddde
 				NewCmdBuildHook(name, f, out, errout),
304a2b2b
 			},
 		},
718df344
 		{
 			Message: "Control load balancing:",
 			Commands: []*cobra.Command{
 				NewCmdRouteBackends(name, f, out, errout),
 			},
 		},
95ec120f
 	}
 	groups.Add(set)
 	templates.ActsAsRootCommand(set, []string{"options"}, groups...)
 	return set
 }
a3eb6164
 
6267dded
 var (
 	setImageLong = templates.LongDesc(`
 Update existing container image(s) of resources.`)
a3eb6164
 
6267dded
 	setImageExample = templates.Examples(`
 		# Set a deployment configs's nginx container image to 'nginx:1.9.1', and its busybox container image to 'busybox'.
 	  %[1]s image dc/nginx busybox=busybox nginx=nginx:1.9.1
a3eb6164
 
6267dded
 	  # Update all deployments' and rc's nginx container's image to 'nginx:1.9.1'
 	  %[1]s image deployments,rc nginx=nginx:1.9.1 --all
a3eb6164
 
6267dded
 	  # Update image of all containers of daemonset abc to 'nginx:1.9.1'
 	  %[1]s image daemonset abc *=nginx:1.9.1
a3eb6164
 
6267dded
 	  # Print result (in yaml format) of updating nginx container image from local file, without hitting the server
 	  %[1]s image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml`)
a3eb6164
 )
 
 // NewCmdImage is a wrapper for the Kubernetes CLI set image command
 func NewCmdImage(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
 	cmd := set.NewCmdImage(f.Factory, out)
 	cmd.Long = setImageLong
 	cmd.Example = fmt.Sprintf(setImageExample, fullName)
bd099235
 
 	flags := cmd.Flags()
 	f.ImageResolutionOptions.Bind(flags)
 
a3eb6164
 	return cmd
 }