fix issue(49965)kubectl scale also says that it can work based on a label selector or all
This commit is contained in:
parent
b0ad3a1c5d
commit
a24be450b2
@ -77,6 +77,8 @@ func NewCmdScale(f cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
ValidArgs: validArgs,
|
||||
ArgAliases: argAliases,
|
||||
}
|
||||
cmd.Flags().StringP("selector", "l", "", "Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)")
|
||||
cmd.Flags().Bool("all", false, "Select all resources in the namespace of the specified resource types")
|
||||
cmd.Flags().String("resource-version", "", i18n.T("Precondition for resource version. Requires that the current resource version match this value in order to scale."))
|
||||
cmd.Flags().Int("current-replicas", -1, "Precondition for current size. Requires that the current size of the resource match this value in order to scale.")
|
||||
cmd.Flags().Int("replicas", -1, "The new desired number of replicas. Required.")
|
||||
@ -98,13 +100,17 @@ func RunScale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []strin
|
||||
return err
|
||||
}
|
||||
|
||||
selector := cmdutil.GetFlagString(cmd, "selector")
|
||||
all := cmdutil.GetFlagBool(cmd, "all")
|
||||
|
||||
mapper, _ := f.Object()
|
||||
r := f.NewBuilder(true).
|
||||
ContinueOnError().
|
||||
NamespaceParam(cmdNamespace).DefaultNamespace().
|
||||
FilenameParam(enforceNamespace, options).
|
||||
ResourceTypeOrNameArgs(false, args...).
|
||||
ResourceTypeOrNameArgs(all, args...).
|
||||
Flatten().
|
||||
SelectorParam(selector).
|
||||
Do()
|
||||
err = r.Err()
|
||||
if resource.IsUsageError(err) {
|
||||
|
Loading…
Reference in New Issue
Block a user