Skip to content

Commit

Permalink
Merge pull request #108820 from mozillazg/remove-kubectl-deprecated-f…
Browse files Browse the repository at this point in the history
…lags

kubectl: Remove deprecated run flags
  • Loading branch information
k8s-ci-robot committed Mar 24, 2022
2 parents 96aa415 + 95f5d50 commit e3982ce
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions staging/src/k8s.io/kubectl/pkg/cmd/run/run.go
Expand Up @@ -177,22 +177,14 @@ func addRunFlags(cmd *cobra.Command, opt *RunOptions) {
cmd.Flags().String("image-pull-policy", "", i18n.T("The image pull policy for the container. If left empty, this value will not be specified by the client and defaulted by the server."))
cmd.Flags().Bool("rm", false, "If true, delete the pod after it exits. Only valid when attaching to the container, e.g. with '--attach' or with '-i/--stdin'.")
cmd.Flags().StringArray("env", []string{}, "Environment variables to set in the container.")
cmd.Flags().String("serviceaccount", "", "Service account to set in the pod spec.")
cmd.Flags().MarkDeprecated("serviceaccount", "has no effect and will be removed in 1.24.")
cmd.Flags().StringVar(&opt.Port, "port", opt.Port, i18n.T("The port that this container exposes."))
cmd.Flags().Int("hostport", -1, "The host port mapping for the container port. To demonstrate a single-machine container.")
cmd.Flags().MarkDeprecated("hostport", "has no effect and will be removed in 1.24.")
cmd.Flags().StringP("labels", "l", "", "Comma separated labels to apply to the pod. Will override previous values.")
cmd.Flags().BoolVarP(&opt.Interactive, "stdin", "i", opt.Interactive, "Keep stdin open on the container in the pod, even if nothing is attached.")
cmd.Flags().BoolVarP(&opt.TTY, "tty", "t", opt.TTY, "Allocate a TTY for the container in the pod.")
cmd.Flags().BoolVar(&opt.Attach, "attach", opt.Attach, "If true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...' were called. Default false, unless '-i/--stdin' is set, in which case the default is true. With '--restart=Never' the exit code of the container process is returned.")
cmd.Flags().BoolVar(&opt.LeaveStdinOpen, "leave-stdin-open", opt.LeaveStdinOpen, "If the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. By default, stdin will be closed after the first attach completes.")
cmd.Flags().String("restart", "Always", i18n.T("The restart policy for this Pod. Legal values [Always, OnFailure, Never]."))
cmd.Flags().Bool("command", false, "If true and extra arguments are present, use them as the 'command' field in the container, rather than the 'args' field which is the default.")
cmd.Flags().String("requests", "", i18n.T("The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on the server configuration, such as limit ranges."))
cmd.Flags().MarkDeprecated("requests", "has no effect and will be removed in 1.24.")
cmd.Flags().String("limits", "", i18n.T("The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'. Note that server side components may assign limits depending on the server configuration, such as limit ranges."))
cmd.Flags().MarkDeprecated("limits", "has no effect and will be removed in 1.24.")
cmd.Flags().BoolVar(&opt.Expose, "expose", opt.Expose, "If true, create a ClusterIP service associated with the pod. Requires `--port`.")
cmd.Flags().BoolVarP(&opt.Quiet, "quiet", "q", opt.Quiet, "If true, suppress prompt messages.")
cmd.Flags().BoolVar(&opt.Privileged, "privileged", opt.Privileged, i18n.T("If true, run the container in privileged mode."))
Expand Down Expand Up @@ -314,13 +306,6 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
params["annotations"] = cmdutil.GetFlagStringArray(cmd, "annotations")
params["env"] = cmdutil.GetFlagStringArray(cmd, "env")

// TODO(eddiezane): These flags will be removed for 1.24
// https://github.com/kubernetes/kubectl/issues/1101#issuecomment-916149516
delete(params, "serviceaccount")
delete(params, "hostport")
delete(params, "requests")
delete(params, "limits")

var createdObjects = []*RunObject{}
runObject, err := o.createGeneratedObject(f, cmd, generator, names, params, o.NewOverrider(&corev1.Pod{}))
if err != nil {
Expand Down

0 comments on commit e3982ce

Please sign in to comment.