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,
|
ValidArgs: validArgs,
|
||||||
ArgAliases: argAliases,
|
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().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("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.")
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selector := cmdutil.GetFlagString(cmd, "selector")
|
||||||
|
all := cmdutil.GetFlagBool(cmd, "all")
|
||||||
|
|
||||||
mapper, _ := f.Object()
|
mapper, _ := f.Object()
|
||||||
r := f.NewBuilder(true).
|
r := f.NewBuilder(true).
|
||||||
ContinueOnError().
|
ContinueOnError().
|
||||||
NamespaceParam(cmdNamespace).DefaultNamespace().
|
NamespaceParam(cmdNamespace).DefaultNamespace().
|
||||||
FilenameParam(enforceNamespace, options).
|
FilenameParam(enforceNamespace, options).
|
||||||
ResourceTypeOrNameArgs(false, args...).
|
ResourceTypeOrNameArgs(all, args...).
|
||||||
Flatten().
|
Flatten().
|
||||||
|
SelectorParam(selector).
|
||||||
Do()
|
Do()
|
||||||
err = r.Err()
|
err = r.Err()
|
||||||
if resource.IsUsageError(err) {
|
if resource.IsUsageError(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user