mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
non-preempting-priorityclass
Co-authored-by: Vallery Lancey <vallery@zeitgeistlabs.io> Co-authored-by: Tan shanshan <tan.shanshan@zte.com.cn>
This commit is contained in:
@@ -29,7 +29,7 @@ import (
|
||||
|
||||
var (
|
||||
pcLong = templates.LongDesc(i18n.T(`
|
||||
Create a priorityclass with the specified name, value, globalDefault and description`))
|
||||
Create a priorityclass with the specified name, value, globalDefault,preempting and description`))
|
||||
|
||||
pcExample = templates.Examples(i18n.T(`
|
||||
# Create a priorityclass named high-priority
|
||||
@@ -67,11 +67,13 @@ func NewCmdCreatePriorityClass(f cmdutil.Factory, ioStreams genericclioptions.IO
|
||||
|
||||
cmdutil.AddApplyAnnotationFlags(cmd)
|
||||
cmdutil.AddValidateFlags(cmd)
|
||||
cmdutil.AddGeneratorFlags(cmd, generateversioned.PriorityClassV1Alpha1GeneratorName)
|
||||
cmdutil.AddGeneratorFlags(cmd, generateversioned.PriorityClassV1GeneratorName)
|
||||
|
||||
cmd.Flags().Int32("value", 0, i18n.T("the value of this priority class."))
|
||||
cmd.Flags().Bool("global-default", false, i18n.T("global-default specifies whether this PriorityClass should be considered as the default priority."))
|
||||
cmd.Flags().String("description", "", i18n.T("description is an arbitrary string that usually provides guidelines on when this priority class should be used."))
|
||||
cmd.Flags().Bool("preempting", false, i18n.T("preempting specifies whether a pod with this PriorityClass could trigger a preemption process."))
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -84,12 +86,13 @@ func (o *PriorityClassOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args
|
||||
|
||||
var generator generate.StructuredGenerator
|
||||
switch generatorName := cmdutil.GetFlagString(cmd, "generator"); generatorName {
|
||||
case generateversioned.PriorityClassV1Alpha1GeneratorName:
|
||||
case generateversioned.PriorityClassV1GeneratorName:
|
||||
generator = &generateversioned.PriorityClassV1Generator{
|
||||
Name: name,
|
||||
Value: cmdutil.GetFlagInt32(cmd, "value"),
|
||||
GlobalDefault: cmdutil.GetFlagBool(cmd, "global-default"),
|
||||
Description: cmdutil.GetFlagString(cmd, "description"),
|
||||
Preempting: cmdutil.GetFlagBool(cmd, "preempting"),
|
||||
}
|
||||
default:
|
||||
return errUnsupportedGenerator(cmd, generatorName)
|
||||
|
Reference in New Issue
Block a user