func NewCmdRollingUpdate(f *cmdutil.Factory, out io.Writer) *cobra.Command { options := &RollingUpdateOptions{} cmd := &cobra.Command{ Use: "rolling-update OLD_CONTROLLER_NAME ([NEW_CONTROLLER_NAME] --image=NEW_CONTAINER_IMAGE | -f NEW_CONTROLLER_SPEC)", // rollingupdate is deprecated. Aliases: []string{"rollingupdate"}, Short: "Perform a rolling update of the given ReplicationController.", Long: rollingUpdate_long, Example: rollingUpdate_example, Run: func(cmd *cobra.Command, args []string) { err := RunRollingUpdate(f, out, cmd, args, options) cmdutil.CheckErr(err) }, } cmd.Flags().Duration("update-period", updatePeriod, `Time to wait between updating pods. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) cmd.Flags().Duration("poll-interval", pollInterval, `Time delay between polling for replication controller status after the update. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) cmd.Flags().Duration("timeout", timeout, `Max time to wait for a replication controller to update before giving up. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`) usage := "Filename or URL to file to use to create the new replication controller." kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) cmd.MarkFlagRequired("filename") cmd.Flags().String("image", "", "Image to use for upgrading the replication controller. Must be distinct from the existing image (either new image or new image tag). Can not be used with --filename/-f") cmd.MarkFlagRequired("image") cmd.Flags().String("deployment-label-key", "deployment", "The key to use to differentiate between two different controllers, default 'deployment'. Only relevant when --image is specified, ignored otherwise") cmd.Flags().Bool("dry-run", false, "If true, print out the changes that would be made, but don't actually make them.") cmd.Flags().Bool("rollback", false, "If true, this is a request to abort an existing rollout that is partially rolled out. It effectively reverses current and next and runs a rollout") cmdutil.AddValidateFlags(cmd) cmdutil.AddPrinterFlags(cmd) return cmd }
func NewCmdReplace(f *cmdutil.Factory, out io.Writer) *cobra.Command { options := &ReplaceOptions{} cmd := &cobra.Command{ Use: "replace -f FILENAME", // update is deprecated. Aliases: []string{"update"}, Short: "Replace a resource by filename or stdin.", Long: replace_long, Example: replace_example, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(cmdutil.ValidateOutputArgs(cmd)) err := RunReplace(f, out, cmd, args, options) cmdutil.CheckErr(err) }, } usage := "Filename, directory, or URL to file to use to replace the resource." kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) cmd.MarkFlagRequired("filename") cmd.Flags().Bool("force", false, "Delete and re-create the specified resource") cmd.Flags().Bool("cascade", false, "Only relevant during a force replace. If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController).") cmd.Flags().Int("grace-period", -1, "Only relevant during a force replace. Period of time in seconds given to the old resource to terminate gracefully. Ignored if negative.") cmd.Flags().Duration("timeout", 0, "Only relevant during a force replace. The length of time to wait before giving up on a delete of the old resource, zero means determine a timeout from the size of the object") cmdutil.AddValidateFlags(cmd) cmdutil.AddOutputFlagsForMutation(cmd) return cmd }
// NewCmdConvert creates a command object for the generic "convert" action, which // translates the config file into a given version. func NewCmdConvert(f *cmdutil.Factory, out io.Writer) *cobra.Command { options := &ConvertOptions{} cmd := &cobra.Command{ Use: "convert -f FILENAME", Short: "Convert config files between different API versions", Long: convert_long, Example: convert_example, Run: func(cmd *cobra.Command, args []string) { err := options.Complete(f, out, cmd, args) cmdutil.CheckErr(err) err = options.RunConvert() cmdutil.CheckErr(err) }, } usage := "Filename, directory, or URL to file to need to get converted." kubectl.AddJsonFilenameFlag(cmd, &options.filenames, usage) cmd.MarkFlagRequired("filename") cmdutil.AddValidateFlags(cmd) cmdutil.AddPrinterFlags(cmd) cmd.Flags().BoolVar(&options.local, "local", true, "If true, convert will NOT try to contact api-server but run locally.") return cmd }
func NewCmdCreate(f *cmdutil.Factory, out io.Writer) *cobra.Command { options := &CreateOptions{} cmd := &cobra.Command{ Use: "create -f FILENAME", Short: "Create a resource by filename or stdin", Long: create_long, Example: create_example, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(ValidateArgs(cmd, args)) cmdutil.CheckErr(cmdutil.ValidateOutputArgs(cmd)) cmdutil.CheckErr(RunCreate(f, cmd, out, options)) }, } usage := "Filename, directory, or URL to file to use to create the resource" kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) cmd.MarkFlagRequired("filename") cmdutil.AddValidateFlags(cmd) cmdutil.AddOutputFlagsForMutation(cmd) return cmd }
func NewCmdApply(f *cmdutil.Factory, out io.Writer) *cobra.Command { options := &ApplyOptions{} cmd := &cobra.Command{ Use: "apply -f FILENAME", Short: "Apply a configuration to a resource by filename or stdin", Long: apply_long, Example: apply_example, Run: func(cmd *cobra.Command, args []string) { cmdutil.CheckErr(validateArgs(cmd, args)) cmdutil.CheckErr(cmdutil.ValidateOutputArgs(cmd)) cmdutil.CheckErr(RunApply(f, cmd, out, options)) }, } usage := "Filename, directory, or URL to file that contains the configuration to apply" kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage) cmd.MarkFlagRequired("filename") cmdutil.AddValidateFlags(cmd) cmdutil.AddOutputFlagsForMutation(cmd) return cmd }