mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 13:07:07 +00:00
change preempting to PreemptionPolicy
This commit is contained in:
parent
5c9438c691
commit
52f3380ef3
20
api/openapi-spec/swagger.json
generated
20
api/openapi-spec/swagger.json
generated
@ -9328,9 +9328,9 @@
|
|||||||
"description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/",
|
"description": "NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"preempting": {
|
"preemptionPolicy": {
|
||||||
"description": "Preempting specifies whether a pod with this PriorityClass could start a preemption process. If this field is missing, the PriorityClass is considered a Preempting class by default.",
|
"description": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.",
|
||||||
"type": "boolean"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"priority": {
|
"priority": {
|
||||||
"description": "The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.",
|
"description": "The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.",
|
||||||
@ -15163,9 +15163,9 @@
|
|||||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
|
||||||
"description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata"
|
"description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata"
|
||||||
},
|
},
|
||||||
"preempting": {
|
"preemptionPolicy": {
|
||||||
"description": "Preempting specifies whether a pod with this PriorityClass could trigger a preemption process. If this field is unset, the PriorityClass is considered a Preempting class by default.",
|
"description": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.",
|
||||||
"type": "boolean"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"description": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
"description": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
||||||
@ -15243,6 +15243,10 @@
|
|||||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
|
||||||
"description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata"
|
"description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata"
|
||||||
},
|
},
|
||||||
|
"preemptionPolicy": {
|
||||||
|
"description": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"description": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
"description": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
||||||
"format": "int32",
|
"format": "int32",
|
||||||
@ -15319,6 +15323,10 @@
|
|||||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
|
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta",
|
||||||
"description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
|
"description": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
|
||||||
},
|
},
|
||||||
|
"preemptionPolicy": {
|
||||||
|
"description": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"value": {
|
"value": {
|
||||||
"description": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
"description": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
||||||
"format": "int32",
|
"format": "int32",
|
||||||
|
@ -172,7 +172,6 @@ func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error
|
|||||||
cc.InformerFactory.Core().V1().Services(),
|
cc.InformerFactory.Core().V1().Services(),
|
||||||
cc.InformerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
cc.InformerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||||
cc.InformerFactory.Storage().V1().StorageClasses(),
|
cc.InformerFactory.Storage().V1().StorageClasses(),
|
||||||
cc.InformerFactory.Scheduling().V1().PriorityClasses(),
|
|
||||||
cc.Recorder,
|
cc.Recorder,
|
||||||
cc.ComponentConfig.AlgorithmSource,
|
cc.ComponentConfig.AlgorithmSource,
|
||||||
stopCh,
|
stopCh,
|
||||||
|
@ -45,11 +45,9 @@ pkg/apis/rbac/v1
|
|||||||
pkg/apis/rbac/v1alpha1
|
pkg/apis/rbac/v1alpha1
|
||||||
pkg/apis/rbac/v1beta1
|
pkg/apis/rbac/v1beta1
|
||||||
pkg/apis/rbac/validation
|
pkg/apis/rbac/validation
|
||||||
pkg/apis/scheduling
|
|
||||||
pkg/apis/scheduling/v1
|
pkg/apis/scheduling/v1
|
||||||
pkg/apis/scheduling/v1alpha1
|
pkg/apis/scheduling/v1alpha1
|
||||||
pkg/apis/scheduling/v1beta1
|
pkg/apis/scheduling/v1beta1
|
||||||
pkg/apis/settings
|
|
||||||
pkg/apis/storage
|
pkg/apis/storage
|
||||||
pkg/apis/storage/v1
|
pkg/apis/storage/v1
|
||||||
pkg/apis/storage/v1beta1
|
pkg/apis/storage/v1beta1
|
||||||
@ -530,7 +528,6 @@ staging/src/k8s.io/client-go/scale/scheme/extensionsv1beta1
|
|||||||
staging/src/k8s.io/client-go/testing
|
staging/src/k8s.io/client-go/testing
|
||||||
staging/src/k8s.io/client-go/tools/cache
|
staging/src/k8s.io/client-go/tools/cache
|
||||||
staging/src/k8s.io/client-go/tools/cache/testing
|
staging/src/k8s.io/client-go/tools/cache/testing
|
||||||
staging/src/k8s.io/client-go/tools/cacheck/.golint_failures
|
|
||||||
staging/src/k8s.io/client-go/tools/clientcmd
|
staging/src/k8s.io/client-go/tools/clientcmd
|
||||||
staging/src/k8s.io/client-go/tools/clientcmd/api
|
staging/src/k8s.io/client-go/tools/clientcmd/api
|
||||||
staging/src/k8s.io/client-go/tools/clientcmd/api/latest
|
staging/src/k8s.io/client-go/tools/clientcmd/api/latest
|
||||||
|
@ -379,6 +379,12 @@ func dropDisabledFields(
|
|||||||
|
|
||||||
dropDisabledCSIVolumeSourceAlphaFields(podSpec, oldPodSpec)
|
dropDisabledCSIVolumeSourceAlphaFields(podSpec, oldPodSpec)
|
||||||
|
|
||||||
|
if !utilfeature.DefaultFeatureGate.Enabled(features.NonPreemptingPriority) &&
|
||||||
|
!podPriorityInUse(oldPodSpec) {
|
||||||
|
// Set to nil pod's PreemptionPolicy fields if the feature is disabled and the old pod
|
||||||
|
// does not specify any values for these fields.
|
||||||
|
podSpec.PreemptionPolicy = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dropDisabledRunAsGroupField removes disabled fields from PodSpec related
|
// dropDisabledRunAsGroupField removes disabled fields from PodSpec related
|
||||||
|
@ -22,11 +22,11 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
fuzz "github.com/google/gofuzz"
|
"github.com/google/gofuzz"
|
||||||
|
|
||||||
apiv1 "k8s.io/api/core/v1"
|
apiv1 "k8s.io/api/core/v1"
|
||||||
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
|
||||||
roundtrip "k8s.io/apimachinery/pkg/api/apitesting/roundtrip"
|
"k8s.io/apimachinery/pkg/api/apitesting/roundtrip"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
@ -147,8 +147,6 @@ func TestDefaulting(t *testing.T) {
|
|||||||
{Group: "storage.k8s.io", Version: "v1", Kind: "StorageClass"}: {},
|
{Group: "storage.k8s.io", Version: "v1", Kind: "StorageClass"}: {},
|
||||||
{Group: "storage.k8s.io", Version: "v1", Kind: "StorageClassList"}: {},
|
{Group: "storage.k8s.io", Version: "v1", Kind: "StorageClassList"}: {},
|
||||||
{Group: "authentication.k8s.io", Version: "v1", Kind: "TokenRequest"}: {},
|
{Group: "authentication.k8s.io", Version: "v1", Kind: "TokenRequest"}: {},
|
||||||
{Group: "scheduling.k8s.io", Version: "v1", Kind: "PriorityClass"}: {},
|
|
||||||
{Group: "scheduling.k8s.io", Version: "v1", Kind: "PriorityClassList"}: {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
f := fuzz.New().NilChance(.5).NumElements(1, 1).RandSource(rand.NewSource(1))
|
f := fuzz.New().NilChance(.5).NumElements(1, 1).RandSource(rand.NewSource(1))
|
||||||
|
@ -217,7 +217,7 @@ func TestRoundTripTypes(t *testing.T) {
|
|||||||
func TestEncodePtr(t *testing.T) {
|
func TestEncodePtr(t *testing.T) {
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
preempting := v1.DefaultPreempting
|
preemptNever := api.PreemptNever
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Labels: map[string]string{"name": "foo"},
|
Labels: map[string]string{"name": "foo"},
|
||||||
@ -231,7 +231,7 @@ func TestEncodePtr(t *testing.T) {
|
|||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: api.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
PreemptionPolicy: &preemptNever,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
obj := runtime.Object(pod)
|
obj := runtime.Object(pod)
|
||||||
|
@ -89,10 +89,6 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
|||||||
enableServiceLinks := corev1.DefaultEnableServiceLinks
|
enableServiceLinks := corev1.DefaultEnableServiceLinks
|
||||||
s.EnableServiceLinks = &enableServiceLinks
|
s.EnableServiceLinks = &enableServiceLinks
|
||||||
}
|
}
|
||||||
if s.Preempting == nil {
|
|
||||||
preempting := corev1.DefaultPreempting
|
|
||||||
s.Preempting = &preempting
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
func(j *core.PodPhase, c fuzz.Continue) {
|
func(j *core.PodPhase, c fuzz.Continue) {
|
||||||
statuses := []core.PodPhase{core.PodPending, core.PodRunning, core.PodFailed, core.PodUnknown}
|
statuses := []core.PodPhase{core.PodPending, core.PodRunning, core.PodFailed, core.PodUnknown}
|
||||||
|
@ -1941,6 +1941,16 @@ const (
|
|||||||
PullIfNotPresent PullPolicy = "IfNotPresent"
|
PullIfNotPresent PullPolicy = "IfNotPresent"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// PreemptionPolicy describes a policy for if/when to preempt a pod.
|
||||||
|
type PreemptionPolicy string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// PreemptLowerPriority means that pod can preempt other pods with lower priority.
|
||||||
|
PreemptLowerPriority PreemptionPolicy = "PreemptLowerPriority"
|
||||||
|
// PreemptNever means that pod never preempts other pods with lower priority.
|
||||||
|
PreemptNever PreemptionPolicy = "Never"
|
||||||
|
)
|
||||||
|
|
||||||
// TerminationMessagePolicy describes how termination messages are retrieved from a container.
|
// TerminationMessagePolicy describes how termination messages are retrieved from a container.
|
||||||
type TerminationMessagePolicy string
|
type TerminationMessagePolicy string
|
||||||
|
|
||||||
@ -2662,10 +2672,12 @@ type PodSpec struct {
|
|||||||
// The higher the value, the higher the priority.
|
// The higher the value, the higher the priority.
|
||||||
// +optional
|
// +optional
|
||||||
Priority *int32
|
Priority *int32
|
||||||
// Preempting specifies whether a pod with this PriorityClass could start a preemption process.
|
// PreemptionPolicy is the Policy for preempting pods with lower priority.
|
||||||
// If not specified, the default is true.
|
// One of Never, PreemptLowerPriority.
|
||||||
|
// Defaults to PreemptLowerPriority if unset.
|
||||||
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
// +optional
|
// +optional
|
||||||
Preempting *bool
|
PreemptionPolicy *PreemptionPolicy
|
||||||
// Specifies the DNS parameters of a pod.
|
// Specifies the DNS parameters of a pod.
|
||||||
// Parameters specified here will be merged to the generated DNS
|
// Parameters specified here will be merged to the generated DNS
|
||||||
// configuration based on DNSPolicy.
|
// configuration based on DNSPolicy.
|
||||||
|
@ -162,11 +162,6 @@ func SetDefaults_Pod(obj *v1.Pod) {
|
|||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
obj.Spec.EnableServiceLinks = &enableServiceLinks
|
obj.Spec.EnableServiceLinks = &enableServiceLinks
|
||||||
}
|
}
|
||||||
if obj.Spec.Preempting == nil {
|
|
||||||
// Set Preempting as true by default.
|
|
||||||
Preempting := v1.DefaultPreempting
|
|
||||||
obj.Spec.Preempting = &Preempting
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
func SetDefaults_PodSpec(obj *v1.PodSpec) {
|
func SetDefaults_PodSpec(obj *v1.PodSpec) {
|
||||||
// New fields added here will break upgrade tests:
|
// New fields added here will break upgrade tests:
|
||||||
|
@ -1390,11 +1390,3 @@ func TestSetDefaultEnableServiceLinks(t *testing.T) {
|
|||||||
t.Errorf("Expected enableServiceLinks value: %+v\ngot: %+v\n", v1.DefaultEnableServiceLinks, *output.Spec.EnableServiceLinks)
|
t.Errorf("Expected enableServiceLinks value: %+v\ngot: %+v\n", v1.DefaultEnableServiceLinks, *output.Spec.EnableServiceLinks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSetDefaultPreempting(t *testing.T) {
|
|
||||||
pod := &v1.Pod{}
|
|
||||||
output := roundTrip(t, runtime.Object(pod)).(*v1.Pod)
|
|
||||||
if output.Spec.Preempting == nil || *output.Spec.Preempting != v1.DefaultPreempting {
|
|
||||||
t.Errorf("Expected enableServiceLinks value: %+v\ngot: %+v\n", v1.DefaultPreempting, *output.Spec.Preempting)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
4
pkg/apis/core/v1/zz_generated.conversion.go
generated
4
pkg/apis/core/v1/zz_generated.conversion.go
generated
@ -5594,11 +5594,11 @@ func autoConvert_v1_PodSpec_To_core_PodSpec(in *v1.PodSpec, out *core.PodSpec, s
|
|||||||
out.HostAliases = *(*[]core.HostAlias)(unsafe.Pointer(&in.HostAliases))
|
out.HostAliases = *(*[]core.HostAlias)(unsafe.Pointer(&in.HostAliases))
|
||||||
out.PriorityClassName = in.PriorityClassName
|
out.PriorityClassName = in.PriorityClassName
|
||||||
out.Priority = (*int32)(unsafe.Pointer(in.Priority))
|
out.Priority = (*int32)(unsafe.Pointer(in.Priority))
|
||||||
out.Preempting = (*bool)(unsafe.Pointer(in.Preempting))
|
|
||||||
out.DNSConfig = (*core.PodDNSConfig)(unsafe.Pointer(in.DNSConfig))
|
out.DNSConfig = (*core.PodDNSConfig)(unsafe.Pointer(in.DNSConfig))
|
||||||
out.ReadinessGates = *(*[]core.PodReadinessGate)(unsafe.Pointer(&in.ReadinessGates))
|
out.ReadinessGates = *(*[]core.PodReadinessGate)(unsafe.Pointer(&in.ReadinessGates))
|
||||||
out.RuntimeClassName = (*string)(unsafe.Pointer(in.RuntimeClassName))
|
out.RuntimeClassName = (*string)(unsafe.Pointer(in.RuntimeClassName))
|
||||||
out.EnableServiceLinks = (*bool)(unsafe.Pointer(in.EnableServiceLinks))
|
out.EnableServiceLinks = (*bool)(unsafe.Pointer(in.EnableServiceLinks))
|
||||||
|
out.PreemptionPolicy = (*core.PreemptionPolicy)(unsafe.Pointer(in.PreemptionPolicy))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5642,7 +5642,7 @@ func autoConvert_core_PodSpec_To_v1_PodSpec(in *core.PodSpec, out *v1.PodSpec, s
|
|||||||
out.HostAliases = *(*[]v1.HostAlias)(unsafe.Pointer(&in.HostAliases))
|
out.HostAliases = *(*[]v1.HostAlias)(unsafe.Pointer(&in.HostAliases))
|
||||||
out.PriorityClassName = in.PriorityClassName
|
out.PriorityClassName = in.PriorityClassName
|
||||||
out.Priority = (*int32)(unsafe.Pointer(in.Priority))
|
out.Priority = (*int32)(unsafe.Pointer(in.Priority))
|
||||||
out.Preempting = (*bool)(unsafe.Pointer(in.Preempting))
|
out.PreemptionPolicy = (*v1.PreemptionPolicy)(unsafe.Pointer(in.PreemptionPolicy))
|
||||||
out.DNSConfig = (*v1.PodDNSConfig)(unsafe.Pointer(in.DNSConfig))
|
out.DNSConfig = (*v1.PodDNSConfig)(unsafe.Pointer(in.DNSConfig))
|
||||||
out.ReadinessGates = *(*[]v1.PodReadinessGate)(unsafe.Pointer(&in.ReadinessGates))
|
out.ReadinessGates = *(*[]v1.PodReadinessGate)(unsafe.Pointer(&in.ReadinessGates))
|
||||||
out.RuntimeClassName = (*string)(unsafe.Pointer(in.RuntimeClassName))
|
out.RuntimeClassName = (*string)(unsafe.Pointer(in.RuntimeClassName))
|
||||||
|
@ -2653,6 +2653,19 @@ func validateRestartPolicy(restartPolicy *core.RestartPolicy, fldPath *field.Pat
|
|||||||
return allErrors
|
return allErrors
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ValidatePreemptionPolicy(preemptionPolicy *core.PreemptionPolicy, fldPath *field.Path) field.ErrorList {
|
||||||
|
allErrors := field.ErrorList{}
|
||||||
|
switch *preemptionPolicy {
|
||||||
|
case core.PreemptLowerPriority, core.PreemptNever:
|
||||||
|
case "":
|
||||||
|
allErrors = append(allErrors, field.Required(fldPath, ""))
|
||||||
|
default:
|
||||||
|
validValues := []string{string(core.PreemptLowerPriority), string(core.PreemptNever)}
|
||||||
|
allErrors = append(allErrors, field.NotSupported(fldPath, preemptionPolicy, validValues))
|
||||||
|
}
|
||||||
|
return allErrors
|
||||||
|
}
|
||||||
|
|
||||||
func validateDNSPolicy(dnsPolicy *core.DNSPolicy, fldPath *field.Path) field.ErrorList {
|
func validateDNSPolicy(dnsPolicy *core.DNSPolicy, fldPath *field.Path) field.ErrorList {
|
||||||
allErrors := field.ErrorList{}
|
allErrors := field.ErrorList{}
|
||||||
switch *dnsPolicy {
|
switch *dnsPolicy {
|
||||||
@ -3033,6 +3046,10 @@ func ValidatePodSpec(spec *core.PodSpec, fldPath *field.Path) field.ErrorList {
|
|||||||
allErrs = append(allErrs, ValidateRuntimeClassName(*spec.RuntimeClassName, fldPath.Child("runtimeClassName"))...)
|
allErrs = append(allErrs, ValidateRuntimeClassName(*spec.RuntimeClassName, fldPath.Child("runtimeClassName"))...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if spec.PreemptionPolicy != nil {
|
||||||
|
allErrs = append(allErrs, ValidatePreemptionPolicy(spec.PreemptionPolicy, fldPath.Child("preemptionPolicy"))...)
|
||||||
|
}
|
||||||
|
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
pkg/apis/core/zz_generated.deepcopy.go
generated
6
pkg/apis/core/zz_generated.deepcopy.go
generated
@ -3610,9 +3610,9 @@ func (in *PodSpec) DeepCopyInto(out *PodSpec) {
|
|||||||
*out = new(int32)
|
*out = new(int32)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
if in.Preempting != nil {
|
if in.PreemptionPolicy != nil {
|
||||||
in, out := &in.Preempting, &out.Preempting
|
in, out := &in.PreemptionPolicy, &out.PreemptionPolicy
|
||||||
*out = new(bool)
|
*out = new(PreemptionPolicy)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
if in.DNSConfig != nil {
|
if in.DNSConfig != nil {
|
||||||
|
@ -9,7 +9,6 @@ load(
|
|||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = [
|
srcs = [
|
||||||
"annotations.go",
|
|
||||||
"doc.go",
|
"doc.go",
|
||||||
"helpers.go",
|
"helpers.go",
|
||||||
"register.go",
|
"register.go",
|
||||||
@ -18,6 +17,7 @@ go_library(
|
|||||||
],
|
],
|
||||||
importpath = "k8s.io/kubernetes/pkg/apis/scheduling",
|
importpath = "k8s.io/kubernetes/pkg/apis/scheduling",
|
||||||
deps = [
|
deps = [
|
||||||
|
"//pkg/apis/core:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
@ -37,6 +37,7 @@ filegroup(
|
|||||||
":package-srcs",
|
":package-srcs",
|
||||||
"//pkg/apis/scheduling/fuzzer:all-srcs",
|
"//pkg/apis/scheduling/fuzzer:all-srcs",
|
||||||
"//pkg/apis/scheduling/install:all-srcs",
|
"//pkg/apis/scheduling/install:all-srcs",
|
||||||
|
"//pkg/apis/scheduling/util:all-srcs",
|
||||||
"//pkg/apis/scheduling/v1:all-srcs",
|
"//pkg/apis/scheduling/v1:all-srcs",
|
||||||
"//pkg/apis/scheduling/v1alpha1:all-srcs",
|
"//pkg/apis/scheduling/v1alpha1:all-srcs",
|
||||||
"//pkg/apis/scheduling/v1beta1:all-srcs",
|
"//pkg/apis/scheduling/v1beta1:all-srcs",
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package scheduling
|
|
||||||
|
|
||||||
// PreemptingAnnotation is the annotation which holds preempting
|
|
||||||
// when converting the `Preempting` field from scheduling/v1
|
|
||||||
const PreemptingAnnotation = "scheduling.k8s.io/preempting"
|
|
@ -10,8 +10,11 @@ go_library(
|
|||||||
srcs = ["fuzzer.go"],
|
srcs = ["fuzzer.go"],
|
||||||
importpath = "k8s.io/kubernetes/pkg/apis/scheduling/fuzzer",
|
importpath = "k8s.io/kubernetes/pkg/apis/scheduling/fuzzer",
|
||||||
deps = [
|
deps = [
|
||||||
|
"//pkg/apis/core:go_default_library",
|
||||||
"//pkg/apis/scheduling:go_default_library",
|
"//pkg/apis/scheduling:go_default_library",
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
"//vendor/github.com/google/gofuzz:go_default_library",
|
"//vendor/github.com/google/gofuzz:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -19,7 +19,10 @@ package fuzzer
|
|||||||
import (
|
import (
|
||||||
"github.com/google/gofuzz"
|
"github.com/google/gofuzz"
|
||||||
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/apis/core"
|
||||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
"k8s.io/kubernetes/pkg/apis/scheduling"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Funcs returns the fuzzer functions for the scheduling api group.
|
// Funcs returns the fuzzer functions for the scheduling api group.
|
||||||
@ -27,9 +30,9 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
|||||||
return []interface{}{
|
return []interface{}{
|
||||||
func(s *scheduling.PriorityClass, c fuzz.Continue) {
|
func(s *scheduling.PriorityClass, c fuzz.Continue) {
|
||||||
c.FuzzNoCustom(s)
|
c.FuzzNoCustom(s)
|
||||||
if s.Preempting == nil {
|
if utilfeature.DefaultFeatureGate.Enabled(features.NonPreemptingPriority) && s.PreemptionPolicy == nil {
|
||||||
preempting := scheduling.DefaultPreempting
|
preemptLowerPriority := core.PreemptLowerPriority
|
||||||
s.Preempting = &preempting
|
s.PreemptionPolicy = &preemptLowerPriority
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,10 @@ limitations under the License.
|
|||||||
|
|
||||||
package scheduling
|
package scheduling
|
||||||
|
|
||||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
import (
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
"k8s.io/kubernetes/pkg/apis/core"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// DefaultPriorityWhenNoDefaultClassExists is used to set priority of pods
|
// DefaultPriorityWhenNoDefaultClassExists is used to set priority of pods
|
||||||
@ -36,8 +39,6 @@ const (
|
|||||||
SystemClusterCritical = SystemPriorityClassPrefix + "cluster-critical"
|
SystemClusterCritical = SystemPriorityClassPrefix + "cluster-critical"
|
||||||
// SystemNodeCritical is the system priority class name that represents node-critical.
|
// SystemNodeCritical is the system priority class name that represents node-critical.
|
||||||
SystemNodeCritical = SystemPriorityClassPrefix + "node-critical"
|
SystemNodeCritical = SystemPriorityClassPrefix + "node-critical"
|
||||||
// The default value for preempting attribute.
|
|
||||||
DefaultPreempting = true
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
@ -67,10 +68,10 @@ type PriorityClass struct {
|
|||||||
// +optional
|
// +optional
|
||||||
Description string
|
Description string
|
||||||
|
|
||||||
// Preempting specifies whether a pod with this PriorityClass could start a preemption process.
|
// PreemptionPolicy it the Policy for preempting pods with lower priority.
|
||||||
// If this field is missing, the PriorityClass is considered a preempting class by default.
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
// +optional
|
// +optional
|
||||||
Preempting *bool
|
PreemptionPolicy *core.PreemptionPolicy
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
45
pkg/apis/scheduling/util/BUILD
Normal file
45
pkg/apis/scheduling/util/BUILD
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
|
load(
|
||||||
|
"@io_bazel_rules_go//go:def.bzl",
|
||||||
|
"go_library",
|
||||||
|
"go_test",
|
||||||
|
)
|
||||||
|
|
||||||
|
go_library(
|
||||||
|
name = "go_default_library",
|
||||||
|
srcs = ["util.go"],
|
||||||
|
importpath = "k8s.io/kubernetes/pkg/apis/scheduling/util",
|
||||||
|
deps = [
|
||||||
|
"//pkg/apis/scheduling:go_default_library",
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "package-srcs",
|
||||||
|
srcs = glob(["**"]),
|
||||||
|
tags = ["automanaged"],
|
||||||
|
visibility = ["//visibility:private"],
|
||||||
|
)
|
||||||
|
|
||||||
|
filegroup(
|
||||||
|
name = "all-srcs",
|
||||||
|
srcs = [":package-srcs"],
|
||||||
|
tags = ["automanaged"],
|
||||||
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = ["util_test.go"],
|
||||||
|
embed = [":go_default_library"],
|
||||||
|
deps = [
|
||||||
|
"//pkg/apis/core:go_default_library",
|
||||||
|
"//pkg/apis/scheduling:go_default_library",
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
|
"//staging/src/k8s.io/component-base/featuregate/testing:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
40
pkg/apis/scheduling/util/util.go
Normal file
40
pkg/apis/scheduling/util/util.go
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/apis/scheduling"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DropDisabledFields removes disabled fields from the PriorityClass object.
|
||||||
|
func DropDisabledFields(class, oldClass *scheduling.PriorityClass) {
|
||||||
|
if !utilfeature.DefaultFeatureGate.Enabled(features.NonPreemptingPriority) && !preemptingPriorityInUse(oldClass) {
|
||||||
|
class.PreemptionPolicy = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func preemptingPriorityInUse(oldClass *scheduling.PriorityClass) bool {
|
||||||
|
if oldClass == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if oldClass.PreemptionPolicy != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
109
pkg/apis/scheduling/util/util_test.go
Normal file
109
pkg/apis/scheduling/util/util_test.go
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package util
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/apimachinery/pkg/util/diff"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
|
"k8s.io/kubernetes/pkg/apis/core"
|
||||||
|
"k8s.io/kubernetes/pkg/apis/scheduling"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestDropNonPreemptingPriority(t *testing.T) {
|
||||||
|
pcWithoutNonPreemptingPriority := func() *scheduling.PriorityClass {
|
||||||
|
return &scheduling.PriorityClass{}
|
||||||
|
}
|
||||||
|
pcWithNonPreemptingPriority := func() *scheduling.PriorityClass {
|
||||||
|
preemptionPolicy := core.PreemptNever
|
||||||
|
return &scheduling.PriorityClass{
|
||||||
|
PreemptionPolicy: &preemptionPolicy,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pcInfo := []struct {
|
||||||
|
description string
|
||||||
|
hasNonPreemptingPriority bool
|
||||||
|
pc func() *scheduling.PriorityClass
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
description: "PriorityClass Without NonPreemptingPriority",
|
||||||
|
hasNonPreemptingPriority: false,
|
||||||
|
pc: pcWithoutNonPreemptingPriority,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "PriorityClass With NonPreemptingPriority",
|
||||||
|
hasNonPreemptingPriority: true,
|
||||||
|
pc: pcWithNonPreemptingPriority,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: "is nil",
|
||||||
|
hasNonPreemptingPriority: false,
|
||||||
|
pc: func() *scheduling.PriorityClass { return nil },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, enabled := range []bool{true, false} {
|
||||||
|
for _, oldPriorityClassInfo := range pcInfo {
|
||||||
|
for _, newPriorityClassInfo := range pcInfo {
|
||||||
|
oldPriorityClassHasNonPreemptingPriority, oldPriorityClass := oldPriorityClassInfo.hasNonPreemptingPriority, oldPriorityClassInfo.pc()
|
||||||
|
newPriorityClassHasNonPreemptingPriority, newPriorityClass := newPriorityClassInfo.hasNonPreemptingPriority, newPriorityClassInfo.pc()
|
||||||
|
if newPriorityClass == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Run(fmt.Sprintf("feature enabled=%v, old PriorityClass %v, new PriorityClass %v", enabled, oldPriorityClassInfo.description, newPriorityClassInfo.description), func(t *testing.T) {
|
||||||
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NonPreemptingPriority, enabled)()
|
||||||
|
|
||||||
|
DropDisabledFields(newPriorityClass, oldPriorityClass)
|
||||||
|
|
||||||
|
// old PriorityClass should never be changed
|
||||||
|
if !reflect.DeepEqual(oldPriorityClass, oldPriorityClassInfo.pc()) {
|
||||||
|
t.Errorf("old PriorityClass changed: %v", diff.ObjectReflectDiff(oldPriorityClass, oldPriorityClassInfo.pc()))
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case enabled || oldPriorityClassHasNonPreemptingPriority:
|
||||||
|
// new PriorityClass should not be changed if the feature is enabled, or if the old PriorityClass had NonPreemptingPriority
|
||||||
|
if !reflect.DeepEqual(newPriorityClass, newPriorityClassInfo.pc()) {
|
||||||
|
t.Errorf("new PriorityClass changed: %v", diff.ObjectReflectDiff(newPriorityClass, newPriorityClassInfo.pc()))
|
||||||
|
}
|
||||||
|
case newPriorityClassHasNonPreemptingPriority:
|
||||||
|
// new PriorityClass should be changed
|
||||||
|
if reflect.DeepEqual(newPriorityClass, newPriorityClassInfo.pc()) {
|
||||||
|
t.Errorf("new PriorityClass was not changed")
|
||||||
|
}
|
||||||
|
// new PriorityClass should not have NonPreemptingPriority
|
||||||
|
if !reflect.DeepEqual(newPriorityClass, pcWithoutNonPreemptingPriority()) {
|
||||||
|
t.Errorf("new PriorityClass had PriorityClassNonPreemptingPriority: %v", diff.ObjectReflectDiff(newPriorityClass, pcWithoutNonPreemptingPriority()))
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
// new PriorityClass should not need to be changed
|
||||||
|
if !reflect.DeepEqual(newPriorityClass, newPriorityClassInfo.pc()) {
|
||||||
|
t.Errorf("new PriorityClass changed: %v", diff.ObjectReflectDiff(newPriorityClass, newPriorityClassInfo.pc()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,11 +12,15 @@ go_library(
|
|||||||
importpath = "k8s.io/kubernetes/pkg/apis/scheduling/v1",
|
importpath = "k8s.io/kubernetes/pkg/apis/scheduling/v1",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//pkg/apis/core:go_default_library",
|
||||||
"//pkg/apis/scheduling:go_default_library",
|
"//pkg/apis/scheduling:go_default_library",
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
|
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,8 +45,11 @@ go_test(
|
|||||||
deps = [
|
deps = [
|
||||||
"//pkg/api/legacyscheme:go_default_library",
|
"//pkg/api/legacyscheme:go_default_library",
|
||||||
"//pkg/api/testapi:go_default_library",
|
"//pkg/api/testapi:go_default_library",
|
||||||
"//pkg/apis/scheduling:go_default_library",
|
"//pkg/features:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
|
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
|
"//staging/src/k8s.io/component-base/featuregate/testing:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -17,9 +17,11 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/api/scheduling/v1"
|
"k8s.io/api/scheduling/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||||
@ -29,9 +31,8 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
|||||||
// SetDefaults_PriorityClass sets additional defaults compared to its counterpart
|
// SetDefaults_PriorityClass sets additional defaults compared to its counterpart
|
||||||
// in extensions.
|
// in extensions.
|
||||||
func SetDefaults_PriorityClass(obj *v1.PriorityClass) {
|
func SetDefaults_PriorityClass(obj *v1.PriorityClass) {
|
||||||
if obj.Preempting == nil {
|
if utilfeature.DefaultFeatureGate.Enabled(features.NonPreemptingPriority) && obj.PreemptionPolicy == nil {
|
||||||
// Set Preempting as true by default.
|
preemptLowerPriority := apiv1.PreemptLowerPriority
|
||||||
Preempting := scheduling.DefaultPreempting
|
obj.PreemptionPolicy = &preemptLowerPriority
|
||||||
obj.Preempting = &Preempting
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2015 The Kubernetes Authors.
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -24,9 +24,12 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
|
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
// enforce that all types are installed
|
// enforce that all types are installed
|
||||||
_ "k8s.io/kubernetes/pkg/api/testapi"
|
_ "k8s.io/kubernetes/pkg/api/testapi"
|
||||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
"k8s.io/kubernetes/pkg/features"
|
||||||
)
|
)
|
||||||
|
|
||||||
func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
|
func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
|
||||||
@ -50,10 +53,14 @@ func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
|
|||||||
return obj3
|
return obj3
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSetDefaultPreempting(t *testing.T) {
|
func TestSetDefaultPreemptionPolicy(t *testing.T) {
|
||||||
priorityClass := &v1.PriorityClass{}
|
priorityClass := &v1.PriorityClass{}
|
||||||
|
|
||||||
|
// set NonPreemptingPriority true
|
||||||
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NonPreemptingPriority, true)()
|
||||||
|
|
||||||
output := roundTrip(t, runtime.Object(priorityClass)).(*v1.PriorityClass)
|
output := roundTrip(t, runtime.Object(priorityClass)).(*v1.PriorityClass)
|
||||||
if output.Preempting == nil || *output.Preempting != scheduling.DefaultPreempting {
|
if output.PreemptionPolicy == nil || *output.PreemptionPolicy != apiv1.PreemptLowerPriority {
|
||||||
t.Errorf("Expected enableServiceLinks value: %+v\ngot: %+v\n", scheduling.DefaultPreempting, *output.Preempting)
|
t.Errorf("Expected PriorityClass.PreemptionPolicy value: %+v\ngot: %+v\n", apiv1.PreemptLowerPriority, output.PreemptionPolicy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,11 @@ package v1
|
|||||||
import (
|
import (
|
||||||
unsafe "unsafe"
|
unsafe "unsafe"
|
||||||
|
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
v1 "k8s.io/api/scheduling/v1"
|
v1 "k8s.io/api/scheduling/v1"
|
||||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
core "k8s.io/kubernetes/pkg/apis/core"
|
||||||
scheduling "k8s.io/kubernetes/pkg/apis/scheduling"
|
scheduling "k8s.io/kubernetes/pkg/apis/scheduling"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -64,7 +66,7 @@ func autoConvert_v1_PriorityClass_To_scheduling_PriorityClass(in *v1.PriorityCla
|
|||||||
out.Value = in.Value
|
out.Value = in.Value
|
||||||
out.GlobalDefault = in.GlobalDefault
|
out.GlobalDefault = in.GlobalDefault
|
||||||
out.Description = in.Description
|
out.Description = in.Description
|
||||||
out.Preempting = (*bool)(unsafe.Pointer(in.Preempting))
|
out.PreemptionPolicy = (*core.PreemptionPolicy)(unsafe.Pointer(in.PreemptionPolicy))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ func autoConvert_scheduling_PriorityClass_To_v1_PriorityClass(in *scheduling.Pri
|
|||||||
out.Value = in.Value
|
out.Value = in.Value
|
||||||
out.GlobalDefault = in.GlobalDefault
|
out.GlobalDefault = in.GlobalDefault
|
||||||
out.Description = in.Description
|
out.Description = in.Description
|
||||||
out.Preempting = (*bool)(unsafe.Pointer(in.Preempting))
|
out.PreemptionPolicy = (*corev1.PreemptionPolicy)(unsafe.Pointer(in.PreemptionPolicy))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load(
|
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
|
||||||
"go_library",
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = [
|
srcs = [
|
||||||
"conversion.go",
|
"defaults.go",
|
||||||
"doc.go",
|
"doc.go",
|
||||||
"register.go",
|
"register.go",
|
||||||
"zz_generated.conversion.go",
|
"zz_generated.conversion.go",
|
||||||
@ -16,11 +13,15 @@ go_library(
|
|||||||
],
|
],
|
||||||
importpath = "k8s.io/kubernetes/pkg/apis/scheduling/v1alpha1",
|
importpath = "k8s.io/kubernetes/pkg/apis/scheduling/v1alpha1",
|
||||||
deps = [
|
deps = [
|
||||||
|
"//pkg/apis/core:go_default_library",
|
||||||
"//pkg/apis/scheduling:go_default_library",
|
"//pkg/apis/scheduling:go_default_library",
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/scheduling/v1alpha1:go_default_library",
|
"//staging/src/k8s.io/api/scheduling/v1alpha1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -36,3 +37,19 @@ filegroup(
|
|||||||
srcs = [":package-srcs"],
|
srcs = [":package-srcs"],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = ["defaults_test.go"],
|
||||||
|
embed = [":go_default_library"],
|
||||||
|
deps = [
|
||||||
|
"//pkg/api/legacyscheme:go_default_library",
|
||||||
|
"//pkg/api/testapi:go_default_library",
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/scheduling/v1alpha1:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
|
"//staging/src/k8s.io/component-base/featuregate/testing:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1alpha1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"k8s.io/api/scheduling/v1alpha1"
|
|
||||||
"k8s.io/apimachinery/pkg/conversion"
|
|
||||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Convert_scheduling_PriorityClass_To_v1alpha1_PriorityClass(in *scheduling.PriorityClass, out *v1alpha1.PriorityClass, s conversion.Scope) error {
|
|
||||||
if err := autoConvert_scheduling_PriorityClass_To_v1alpha1_PriorityClass(in, out, s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
out.ObjectMeta.Annotations = deepCopyStringMap(out.Annotations)
|
|
||||||
|
|
||||||
if in.Preempting != nil {
|
|
||||||
if out.ObjectMeta.Annotations == nil {
|
|
||||||
out.ObjectMeta.Annotations = make(map[string]string)
|
|
||||||
}
|
|
||||||
out.ObjectMeta.Annotations[scheduling.PreemptingAnnotation] = strconv.FormatBool(*(in.Preempting))
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Convert_v1alpha1_PriorityClass_To_scheduling_PriorityClass(in *v1alpha1.PriorityClass, out *scheduling.PriorityClass, s conversion.Scope) error {
|
|
||||||
if err := autoConvert_v1alpha1_PriorityClass_To_scheduling_PriorityClass(in, out, s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
out.ObjectMeta.Annotations = deepCopyStringMap(out.Annotations)
|
|
||||||
|
|
||||||
if in.ObjectMeta.Annotations != nil {
|
|
||||||
if _, ok := in.ObjectMeta.Annotations[scheduling.PreemptingAnnotation]; ok {
|
|
||||||
preempting, err := strconv.ParseBool(in.ObjectMeta.Annotations[scheduling.PreemptingAnnotation])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
out.Preempting = &preempting
|
|
||||||
delete(out.ObjectMeta.Annotations, scheduling.PreemptingAnnotation)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
preempting := scheduling.DefaultPreempting
|
|
||||||
out.Preempting = &preempting
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func deepCopyStringMap(m map[string]string) map[string]string {
|
|
||||||
ret := make(map[string]string, len(m))
|
|
||||||
for k, v := range m {
|
|
||||||
ret[k] = v
|
|
||||||
}
|
|
||||||
return ret
|
|
||||||
}
|
|
38
pkg/apis/scheduling/v1alpha1/defaults.go
Normal file
38
pkg/apis/scheduling/v1alpha1/defaults.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1alpha1
|
||||||
|
|
||||||
|
import (
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
|
"k8s.io/api/scheduling/v1alpha1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
|
)
|
||||||
|
|
||||||
|
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||||
|
return RegisterDefaults(scheme)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults_PriorityClass sets additional defaults compared to its counterpart
|
||||||
|
// in extensions.
|
||||||
|
func SetDefaults_PriorityClass(obj *v1alpha1.PriorityClass) {
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.NonPreemptingPriority) && obj.PreemptionPolicy == nil {
|
||||||
|
preemptLowerPriority := apiv1.PreemptLowerPriority
|
||||||
|
obj.PreemptionPolicy = &preemptLowerPriority
|
||||||
|
}
|
||||||
|
}
|
66
pkg/apis/scheduling/v1alpha1/defaults_test.go
Normal file
66
pkg/apis/scheduling/v1alpha1/defaults_test.go
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1alpha1_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/api/scheduling/v1alpha1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
|
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
|
// enforce that all types are installed
|
||||||
|
_ "k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
|
)
|
||||||
|
|
||||||
|
func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
|
||||||
|
codec := legacyscheme.Codecs.LegacyCodec(v1alpha1.SchemeGroupVersion)
|
||||||
|
data, err := runtime.Encode(codec, obj)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("%v\n %#v", err, obj)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
obj2, err := runtime.Decode(codec, data)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
obj3 := reflect.New(reflect.TypeOf(obj).Elem()).Interface().(runtime.Object)
|
||||||
|
err = legacyscheme.Scheme.Convert(obj2, obj3, nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("%v\nSource: %#v", err, obj2)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return obj3
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSetDefaultPreempting(t *testing.T) {
|
||||||
|
priorityClass := &v1alpha1.PriorityClass{}
|
||||||
|
|
||||||
|
// set NonPreemptingPriority true
|
||||||
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NonPreemptingPriority, true)()
|
||||||
|
|
||||||
|
output := roundTrip(t, runtime.Object(priorityClass)).(*v1alpha1.PriorityClass)
|
||||||
|
if output.PreemptionPolicy == nil || *output.PreemptionPolicy != apiv1.PreemptLowerPriority {
|
||||||
|
t.Errorf("Expected PriorityClass.Preempting value: %+v\ngot: %+v\n", apiv1.PreemptLowerPriority, output.PreemptionPolicy)
|
||||||
|
}
|
||||||
|
}
|
@ -21,9 +21,13 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
unsafe "unsafe"
|
||||||
|
|
||||||
|
v1 "k8s.io/api/core/v1"
|
||||||
v1alpha1 "k8s.io/api/scheduling/v1alpha1"
|
v1alpha1 "k8s.io/api/scheduling/v1alpha1"
|
||||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
core "k8s.io/kubernetes/pkg/apis/core"
|
||||||
scheduling "k8s.io/kubernetes/pkg/apis/scheduling"
|
scheduling "k8s.io/kubernetes/pkg/apis/scheduling"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,16 +58,6 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := s.AddConversionFunc((*scheduling.PriorityClass)(nil), (*v1alpha1.PriorityClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
|
||||||
return Convert_scheduling_PriorityClass_To_v1alpha1_PriorityClass(a.(*scheduling.PriorityClass), b.(*v1alpha1.PriorityClass), scope)
|
|
||||||
}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := s.AddConversionFunc((*v1alpha1.PriorityClass)(nil), (*scheduling.PriorityClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
|
||||||
return Convert_v1alpha1_PriorityClass_To_scheduling_PriorityClass(a.(*v1alpha1.PriorityClass), b.(*scheduling.PriorityClass), scope)
|
|
||||||
}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,31 +66,32 @@ func autoConvert_v1alpha1_PriorityClass_To_scheduling_PriorityClass(in *v1alpha1
|
|||||||
out.Value = in.Value
|
out.Value = in.Value
|
||||||
out.GlobalDefault = in.GlobalDefault
|
out.GlobalDefault = in.GlobalDefault
|
||||||
out.Description = in.Description
|
out.Description = in.Description
|
||||||
|
out.PreemptionPolicy = (*core.PreemptionPolicy)(unsafe.Pointer(in.PreemptionPolicy))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert_v1alpha1_PriorityClass_To_scheduling_PriorityClass is an autogenerated conversion function.
|
||||||
|
func Convert_v1alpha1_PriorityClass_To_scheduling_PriorityClass(in *v1alpha1.PriorityClass, out *scheduling.PriorityClass, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1alpha1_PriorityClass_To_scheduling_PriorityClass(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
func autoConvert_scheduling_PriorityClass_To_v1alpha1_PriorityClass(in *scheduling.PriorityClass, out *v1alpha1.PriorityClass, s conversion.Scope) error {
|
func autoConvert_scheduling_PriorityClass_To_v1alpha1_PriorityClass(in *scheduling.PriorityClass, out *v1alpha1.PriorityClass, s conversion.Scope) error {
|
||||||
out.ObjectMeta = in.ObjectMeta
|
out.ObjectMeta = in.ObjectMeta
|
||||||
out.Value = in.Value
|
out.Value = in.Value
|
||||||
out.GlobalDefault = in.GlobalDefault
|
out.GlobalDefault = in.GlobalDefault
|
||||||
out.Description = in.Description
|
out.Description = in.Description
|
||||||
// WARNING: in.Preempting requires manual conversion: does not exist in peer-type
|
out.PreemptionPolicy = (*v1.PreemptionPolicy)(unsafe.Pointer(in.PreemptionPolicy))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert_scheduling_PriorityClass_To_v1alpha1_PriorityClass is an autogenerated conversion function.
|
||||||
|
func Convert_scheduling_PriorityClass_To_v1alpha1_PriorityClass(in *scheduling.PriorityClass, out *v1alpha1.PriorityClass, s conversion.Scope) error {
|
||||||
|
return autoConvert_scheduling_PriorityClass_To_v1alpha1_PriorityClass(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
func autoConvert_v1alpha1_PriorityClassList_To_scheduling_PriorityClassList(in *v1alpha1.PriorityClassList, out *scheduling.PriorityClassList, s conversion.Scope) error {
|
func autoConvert_v1alpha1_PriorityClassList_To_scheduling_PriorityClassList(in *v1alpha1.PriorityClassList, out *scheduling.PriorityClassList, s conversion.Scope) error {
|
||||||
out.ListMeta = in.ListMeta
|
out.ListMeta = in.ListMeta
|
||||||
if in.Items != nil {
|
out.Items = *(*[]scheduling.PriorityClass)(unsafe.Pointer(&in.Items))
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]scheduling.PriorityClass, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
if err := Convert_v1alpha1_PriorityClass_To_scheduling_PriorityClass(&(*in)[i], &(*out)[i], s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out.Items = nil
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,17 +102,7 @@ func Convert_v1alpha1_PriorityClassList_To_scheduling_PriorityClassList(in *v1al
|
|||||||
|
|
||||||
func autoConvert_scheduling_PriorityClassList_To_v1alpha1_PriorityClassList(in *scheduling.PriorityClassList, out *v1alpha1.PriorityClassList, s conversion.Scope) error {
|
func autoConvert_scheduling_PriorityClassList_To_v1alpha1_PriorityClassList(in *scheduling.PriorityClassList, out *v1alpha1.PriorityClassList, s conversion.Scope) error {
|
||||||
out.ListMeta = in.ListMeta
|
out.ListMeta = in.ListMeta
|
||||||
if in.Items != nil {
|
out.Items = *(*[]v1alpha1.PriorityClass)(unsafe.Pointer(&in.Items))
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]v1alpha1.PriorityClass, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
if err := Convert_scheduling_PriorityClass_To_v1alpha1_PriorityClass(&(*in)[i], &(*out)[i], s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out.Items = nil
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
v1alpha1 "k8s.io/api/scheduling/v1alpha1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,5 +29,18 @@ import (
|
|||||||
// Public to allow building arbitrary schemes.
|
// Public to allow building arbitrary schemes.
|
||||||
// All generated defaulters are covering - they call all nested defaulters.
|
// All generated defaulters are covering - they call all nested defaulters.
|
||||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddTypeDefaultingFunc(&v1alpha1.PriorityClass{}, func(obj interface{}) { SetObjectDefaults_PriorityClass(obj.(*v1alpha1.PriorityClass)) })
|
||||||
|
scheme.AddTypeDefaultingFunc(&v1alpha1.PriorityClassList{}, func(obj interface{}) { SetObjectDefaults_PriorityClassList(obj.(*v1alpha1.PriorityClassList)) })
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetObjectDefaults_PriorityClass(in *v1alpha1.PriorityClass) {
|
||||||
|
SetDefaults_PriorityClass(in)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetObjectDefaults_PriorityClassList(in *v1alpha1.PriorityClassList) {
|
||||||
|
for i := range in.Items {
|
||||||
|
a := &in.Items[i]
|
||||||
|
SetObjectDefaults_PriorityClass(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
|
|
||||||
load(
|
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
||||||
"@io_bazel_rules_go//go:def.bzl",
|
|
||||||
"go_library",
|
|
||||||
)
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "go_default_library",
|
name = "go_default_library",
|
||||||
srcs = [
|
srcs = [
|
||||||
"conversion.go",
|
"defaults.go",
|
||||||
"doc.go",
|
"doc.go",
|
||||||
"register.go",
|
"register.go",
|
||||||
"zz_generated.conversion.go",
|
"zz_generated.conversion.go",
|
||||||
@ -16,11 +13,15 @@ go_library(
|
|||||||
],
|
],
|
||||||
importpath = "k8s.io/kubernetes/pkg/apis/scheduling/v1beta1",
|
importpath = "k8s.io/kubernetes/pkg/apis/scheduling/v1beta1",
|
||||||
deps = [
|
deps = [
|
||||||
|
"//pkg/apis/core:go_default_library",
|
||||||
"//pkg/apis/scheduling:go_default_library",
|
"//pkg/apis/scheduling:go_default_library",
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/scheduling/v1beta1:go_default_library",
|
"//staging/src/k8s.io/api/scheduling/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -36,3 +37,19 @@ filegroup(
|
|||||||
srcs = [":package-srcs"],
|
srcs = [":package-srcs"],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
go_test(
|
||||||
|
name = "go_default_test",
|
||||||
|
srcs = ["defaults_test.go"],
|
||||||
|
embed = [":go_default_library"],
|
||||||
|
deps = [
|
||||||
|
"//pkg/api/legacyscheme:go_default_library",
|
||||||
|
"//pkg/api/testapi:go_default_library",
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/scheduling/v1beta1:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
|
"//staging/src/k8s.io/component-base/featuregate/testing:go_default_library",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2019 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package v1beta1
|
|
||||||
|
|
||||||
import (
|
|
||||||
"k8s.io/api/scheduling/v1beta1"
|
|
||||||
"k8s.io/apimachinery/pkg/conversion"
|
|
||||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
|
||||||
"strconv"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Convert_scheduling_PriorityClass_To_v1beta1_PriorityClass(in *scheduling.PriorityClass, out *v1beta1.PriorityClass, s conversion.Scope) error {
|
|
||||||
if err := autoConvert_scheduling_PriorityClass_To_v1beta1_PriorityClass(in, out, s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
out.ObjectMeta.Annotations = deepCopyStringMap(out.Annotations)
|
|
||||||
if in.Preempting != nil {
|
|
||||||
if out.ObjectMeta.Annotations == nil {
|
|
||||||
out.ObjectMeta.Annotations = make(map[string]string)
|
|
||||||
}
|
|
||||||
out.ObjectMeta.Annotations[scheduling.PreemptingAnnotation] = strconv.FormatBool(*(in.Preempting))
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Convert_v1beta1_PriorityClass_To_scheduling_PriorityClass(in *v1beta1.PriorityClass, out *scheduling.PriorityClass, s conversion.Scope) error {
|
|
||||||
if err := autoConvert_v1beta1_PriorityClass_To_scheduling_PriorityClass(in, out, s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
out.ObjectMeta.Annotations = deepCopyStringMap(out.Annotations)
|
|
||||||
if out.ObjectMeta.Annotations != nil {
|
|
||||||
if _, ok := out.ObjectMeta.Annotations[scheduling.PreemptingAnnotation]; ok {
|
|
||||||
preempting, err := strconv.ParseBool(out.ObjectMeta.Annotations[scheduling.PreemptingAnnotation])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
out.Preempting = &preempting
|
|
||||||
delete(out.ObjectMeta.Annotations, scheduling.PreemptingAnnotation)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
preempting := scheduling.DefaultPreempting
|
|
||||||
out.Preempting = &preempting
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func deepCopyStringMap(m map[string]string) map[string]string {
|
|
||||||
ret := make(map[string]string, len(m))
|
|
||||||
for k, v := range m {
|
|
||||||
ret[k] = v
|
|
||||||
}
|
|
||||||
return ret
|
|
||||||
}
|
|
38
pkg/apis/scheduling/v1beta1/defaults.go
Normal file
38
pkg/apis/scheduling/v1beta1/defaults.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1beta1
|
||||||
|
|
||||||
|
import (
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
|
"k8s.io/api/scheduling/v1beta1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
|
)
|
||||||
|
|
||||||
|
func addDefaultingFuncs(scheme *runtime.Scheme) error {
|
||||||
|
return RegisterDefaults(scheme)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDefaults_PriorityClass sets additional defaults compared to its counterpart
|
||||||
|
// in extensions.
|
||||||
|
func SetDefaults_PriorityClass(obj *v1beta1.PriorityClass) {
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.NonPreemptingPriority) && obj.PreemptionPolicy == nil {
|
||||||
|
preemptLowerPriority := apiv1.PreemptLowerPriority
|
||||||
|
obj.PreemptionPolicy = &preemptLowerPriority
|
||||||
|
}
|
||||||
|
}
|
66
pkg/apis/scheduling/v1beta1/defaults_test.go
Normal file
66
pkg/apis/scheduling/v1beta1/defaults_test.go
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2019 The Kubernetes Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package v1beta1_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"reflect"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/api/scheduling/v1beta1"
|
||||||
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
|
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||||
|
// enforce that all types are installed
|
||||||
|
_ "k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
|
)
|
||||||
|
|
||||||
|
func roundTrip(t *testing.T, obj runtime.Object) runtime.Object {
|
||||||
|
codec := legacyscheme.Codecs.LegacyCodec(v1beta1.SchemeGroupVersion)
|
||||||
|
data, err := runtime.Encode(codec, obj)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("%v\n %#v", err, obj)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
obj2, err := runtime.Decode(codec, data)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("%v\nData: %s\nSource: %#v", err, string(data), obj)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
obj3 := reflect.New(reflect.TypeOf(obj).Elem()).Interface().(runtime.Object)
|
||||||
|
err = legacyscheme.Scheme.Convert(obj2, obj3, nil)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("%v\nSource: %#v", err, obj2)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return obj3
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSetDefaultPreempting(t *testing.T) {
|
||||||
|
priorityClass := &v1beta1.PriorityClass{}
|
||||||
|
|
||||||
|
// set NonPreemptingPriority true
|
||||||
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NonPreemptingPriority, true)()
|
||||||
|
|
||||||
|
output := roundTrip(t, runtime.Object(priorityClass)).(*v1beta1.PriorityClass)
|
||||||
|
if output.PreemptionPolicy == nil || *output.PreemptionPolicy != apiv1.PreemptLowerPriority {
|
||||||
|
t.Errorf("Expected PriorityClass.Preempting value: %+v\ngot: %+v\n", apiv1.PreemptLowerPriority, output.PreemptionPolicy)
|
||||||
|
}
|
||||||
|
}
|
@ -21,9 +21,13 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
unsafe "unsafe"
|
||||||
|
|
||||||
|
v1 "k8s.io/api/core/v1"
|
||||||
v1beta1 "k8s.io/api/scheduling/v1beta1"
|
v1beta1 "k8s.io/api/scheduling/v1beta1"
|
||||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
core "k8s.io/kubernetes/pkg/apis/core"
|
||||||
scheduling "k8s.io/kubernetes/pkg/apis/scheduling"
|
scheduling "k8s.io/kubernetes/pkg/apis/scheduling"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,16 +58,6 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := s.AddConversionFunc((*scheduling.PriorityClass)(nil), (*v1beta1.PriorityClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
|
||||||
return Convert_scheduling_PriorityClass_To_v1beta1_PriorityClass(a.(*scheduling.PriorityClass), b.(*v1beta1.PriorityClass), scope)
|
|
||||||
}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if err := s.AddConversionFunc((*v1beta1.PriorityClass)(nil), (*scheduling.PriorityClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
|
||||||
return Convert_v1beta1_PriorityClass_To_scheduling_PriorityClass(a.(*v1beta1.PriorityClass), b.(*scheduling.PriorityClass), scope)
|
|
||||||
}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,31 +66,32 @@ func autoConvert_v1beta1_PriorityClass_To_scheduling_PriorityClass(in *v1beta1.P
|
|||||||
out.Value = in.Value
|
out.Value = in.Value
|
||||||
out.GlobalDefault = in.GlobalDefault
|
out.GlobalDefault = in.GlobalDefault
|
||||||
out.Description = in.Description
|
out.Description = in.Description
|
||||||
|
out.PreemptionPolicy = (*core.PreemptionPolicy)(unsafe.Pointer(in.PreemptionPolicy))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert_v1beta1_PriorityClass_To_scheduling_PriorityClass is an autogenerated conversion function.
|
||||||
|
func Convert_v1beta1_PriorityClass_To_scheduling_PriorityClass(in *v1beta1.PriorityClass, out *scheduling.PriorityClass, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1beta1_PriorityClass_To_scheduling_PriorityClass(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
func autoConvert_scheduling_PriorityClass_To_v1beta1_PriorityClass(in *scheduling.PriorityClass, out *v1beta1.PriorityClass, s conversion.Scope) error {
|
func autoConvert_scheduling_PriorityClass_To_v1beta1_PriorityClass(in *scheduling.PriorityClass, out *v1beta1.PriorityClass, s conversion.Scope) error {
|
||||||
out.ObjectMeta = in.ObjectMeta
|
out.ObjectMeta = in.ObjectMeta
|
||||||
out.Value = in.Value
|
out.Value = in.Value
|
||||||
out.GlobalDefault = in.GlobalDefault
|
out.GlobalDefault = in.GlobalDefault
|
||||||
out.Description = in.Description
|
out.Description = in.Description
|
||||||
// WARNING: in.Preempting requires manual conversion: does not exist in peer-type
|
out.PreemptionPolicy = (*v1.PreemptionPolicy)(unsafe.Pointer(in.PreemptionPolicy))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert_scheduling_PriorityClass_To_v1beta1_PriorityClass is an autogenerated conversion function.
|
||||||
|
func Convert_scheduling_PriorityClass_To_v1beta1_PriorityClass(in *scheduling.PriorityClass, out *v1beta1.PriorityClass, s conversion.Scope) error {
|
||||||
|
return autoConvert_scheduling_PriorityClass_To_v1beta1_PriorityClass(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
func autoConvert_v1beta1_PriorityClassList_To_scheduling_PriorityClassList(in *v1beta1.PriorityClassList, out *scheduling.PriorityClassList, s conversion.Scope) error {
|
func autoConvert_v1beta1_PriorityClassList_To_scheduling_PriorityClassList(in *v1beta1.PriorityClassList, out *scheduling.PriorityClassList, s conversion.Scope) error {
|
||||||
out.ListMeta = in.ListMeta
|
out.ListMeta = in.ListMeta
|
||||||
if in.Items != nil {
|
out.Items = *(*[]scheduling.PriorityClass)(unsafe.Pointer(&in.Items))
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]scheduling.PriorityClass, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
if err := Convert_v1beta1_PriorityClass_To_scheduling_PriorityClass(&(*in)[i], &(*out)[i], s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out.Items = nil
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,17 +102,7 @@ func Convert_v1beta1_PriorityClassList_To_scheduling_PriorityClassList(in *v1bet
|
|||||||
|
|
||||||
func autoConvert_scheduling_PriorityClassList_To_v1beta1_PriorityClassList(in *scheduling.PriorityClassList, out *v1beta1.PriorityClassList, s conversion.Scope) error {
|
func autoConvert_scheduling_PriorityClassList_To_v1beta1_PriorityClassList(in *scheduling.PriorityClassList, out *v1beta1.PriorityClassList, s conversion.Scope) error {
|
||||||
out.ListMeta = in.ListMeta
|
out.ListMeta = in.ListMeta
|
||||||
if in.Items != nil {
|
out.Items = *(*[]v1beta1.PriorityClass)(unsafe.Pointer(&in.Items))
|
||||||
in, out := &in.Items, &out.Items
|
|
||||||
*out = make([]v1beta1.PriorityClass, len(*in))
|
|
||||||
for i := range *in {
|
|
||||||
if err := Convert_scheduling_PriorityClass_To_v1beta1_PriorityClass(&(*in)[i], &(*out)[i], s); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out.Items = nil
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
pkg/apis/scheduling/v1beta1/zz_generated.defaults.go
generated
14
pkg/apis/scheduling/v1beta1/zz_generated.defaults.go
generated
@ -21,6 +21,7 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
v1beta1 "k8s.io/api/scheduling/v1beta1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,5 +29,18 @@ import (
|
|||||||
// Public to allow building arbitrary schemes.
|
// Public to allow building arbitrary schemes.
|
||||||
// All generated defaulters are covering - they call all nested defaulters.
|
// All generated defaulters are covering - they call all nested defaulters.
|
||||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||||
|
scheme.AddTypeDefaultingFunc(&v1beta1.PriorityClass{}, func(obj interface{}) { SetObjectDefaults_PriorityClass(obj.(*v1beta1.PriorityClass)) })
|
||||||
|
scheme.AddTypeDefaultingFunc(&v1beta1.PriorityClassList{}, func(obj interface{}) { SetObjectDefaults_PriorityClassList(obj.(*v1beta1.PriorityClassList)) })
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetObjectDefaults_PriorityClass(in *v1beta1.PriorityClass) {
|
||||||
|
SetDefaults_PriorityClass(in)
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetObjectDefaults_PriorityClassList(in *v1beta1.PriorityClassList) {
|
||||||
|
for i := range in.Items {
|
||||||
|
a := &in.Items[i]
|
||||||
|
SetObjectDefaults_PriorityClass(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -41,6 +41,9 @@ func ValidatePriorityClass(pc *scheduling.PriorityClass) field.ErrorList {
|
|||||||
// Non-system critical priority classes are not allowed to have a value larger than HighestUserDefinablePriority.
|
// Non-system critical priority classes are not allowed to have a value larger than HighestUserDefinablePriority.
|
||||||
allErrs = append(allErrs, field.Forbidden(field.NewPath("value"), fmt.Sprintf("maximum allowed value of a user defined priority is %v", scheduling.HighestUserDefinablePriority)))
|
allErrs = append(allErrs, field.Forbidden(field.NewPath("value"), fmt.Sprintf("maximum allowed value of a user defined priority is %v", scheduling.HighestUserDefinablePriority)))
|
||||||
}
|
}
|
||||||
|
if pc.PreemptionPolicy != nil {
|
||||||
|
allErrs = append(allErrs, apivalidation.ValidatePreemptionPolicy(pc.PreemptionPolicy, field.NewPath("preemptionPolicy"))...)
|
||||||
|
}
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,5 +55,7 @@ func ValidatePriorityClassUpdate(pc, oldPc *scheduling.PriorityClass) field.Erro
|
|||||||
if pc.Value != oldPc.Value {
|
if pc.Value != oldPc.Value {
|
||||||
allErrs = append(allErrs, field.Forbidden(field.NewPath("Value"), "may not be changed in an update."))
|
allErrs = append(allErrs, field.Forbidden(field.NewPath("Value"), "may not be changed in an update."))
|
||||||
}
|
}
|
||||||
|
// PreemptionPolicy is immutable and is checked by the ObjectMeta validator.
|
||||||
|
allErrs = append(allErrs, apivalidation.ValidateImmutableField(pc.PreemptionPolicy, oldPc.PreemptionPolicy, field.NewPath("preemptionPolicy"))...)
|
||||||
return allErrs
|
return allErrs
|
||||||
}
|
}
|
||||||
|
7
pkg/apis/scheduling/zz_generated.deepcopy.go
generated
7
pkg/apis/scheduling/zz_generated.deepcopy.go
generated
@ -22,6 +22,7 @@ package scheduling
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
core "k8s.io/kubernetes/pkg/apis/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
@ -29,9 +30,9 @@ func (in *PriorityClass) DeepCopyInto(out *PriorityClass) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
if in.Preempting != nil {
|
if in.PreemptionPolicy != nil {
|
||||||
in, out := &in.Preempting, &out.Preempting
|
in, out := &in.PreemptionPolicy, &out.PreemptionPolicy
|
||||||
*out = new(bool)
|
*out = new(core.PreemptionPolicy)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
"k8s.io/api/networking/v1",
|
"k8s.io/api/networking/v1",
|
||||||
"k8s.io/component-base/config",
|
"k8s.io/component-base/config",
|
||||||
"k8s.io/component-base/config/v1alpha1",
|
"k8s.io/component-base/config/v1alpha1",
|
||||||
"k8s.io/api/scheduling/v1beta1"
|
"k8s.io/api/scheduling/v1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -152,7 +152,6 @@ func generateDeployment(image string) apps.Deployment {
|
|||||||
podLabels := map[string]string{"name": image}
|
podLabels := map[string]string{"name": image}
|
||||||
terminationSec := int64(30)
|
terminationSec := int64(30)
|
||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
preempting := v1.DefaultPreempting
|
|
||||||
return apps.Deployment{
|
return apps.Deployment{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: image,
|
Name: image,
|
||||||
@ -179,7 +178,6 @@ func generateDeployment(image string) apps.Deployment {
|
|||||||
RestartPolicy: v1.RestartPolicyAlways,
|
RestartPolicy: v1.RestartPolicyAlways,
|
||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -459,6 +459,12 @@ const (
|
|||||||
// Allow use of filesystems for ephemeral storage monitoring.
|
// Allow use of filesystems for ephemeral storage monitoring.
|
||||||
// Only applies if LocalStorageCapacityIsolation is set.
|
// Only applies if LocalStorageCapacityIsolation is set.
|
||||||
LocalStorageCapacityIsolationFSQuotaMonitoring featuregate.Feature = "LocalStorageCapacityIsolationFSQuotaMonitoring"
|
LocalStorageCapacityIsolationFSQuotaMonitoring featuregate.Feature = "LocalStorageCapacityIsolationFSQuotaMonitoring"
|
||||||
|
|
||||||
|
// owner: @denkensk
|
||||||
|
// alpha: v1.15
|
||||||
|
//
|
||||||
|
// Enables NonPreempting option for priorityClass and pod.
|
||||||
|
NonPreemptingPriority featuregate.Feature = "NonPreemptingPriority"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -536,6 +542,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
KubeletPodResources: {Default: false, PreRelease: featuregate.Alpha},
|
KubeletPodResources: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
WindowsGMSA: {Default: false, PreRelease: featuregate.Alpha},
|
WindowsGMSA: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
LocalStorageCapacityIsolationFSQuotaMonitoring: {Default: false, PreRelease: featuregate.Alpha},
|
LocalStorageCapacityIsolationFSQuotaMonitoring: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
|
NonPreemptingPriority: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
|
|
||||||
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
|
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
|
||||||
// unintentionally on either side:
|
// unintentionally on either side:
|
||||||
|
@ -19,6 +19,7 @@ package create
|
|||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
"k8s.io/cli-runtime/pkg/genericclioptions"
|
"k8s.io/cli-runtime/pkg/genericclioptions"
|
||||||
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
|
||||||
"k8s.io/kubernetes/pkg/kubectl/generate"
|
"k8s.io/kubernetes/pkg/kubectl/generate"
|
||||||
@ -29,14 +30,17 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
pcLong = templates.LongDesc(i18n.T(`
|
pcLong = templates.LongDesc(i18n.T(`
|
||||||
Create a priorityclass with the specified name, value, globalDefault,preempting and description`))
|
Create a priorityclass with the specified name, value, globalDefault and description`))
|
||||||
|
|
||||||
pcExample = templates.Examples(i18n.T(`
|
pcExample = templates.Examples(i18n.T(`
|
||||||
# Create a priorityclass named high-priority
|
# Create a priorityclass named high-priority
|
||||||
kubectl create priorityclass high-priority --value=1000 --description="high priority"
|
kubectl create priorityclass high-priority --value=1000 --description="high priority"
|
||||||
|
|
||||||
# Create a priorityclass named default-priority that considered as the global default priority
|
# Create a priorityclass named default-priority that considered as the global default priority
|
||||||
kubectl create priorityclass default-priority --value=1000 --global-default=true --description="default priority"`))
|
kubectl create priorityclass default-priority --value=1000 --global-default=true --description="default priority"
|
||||||
|
|
||||||
|
# Create a priorityclass named high-priority that can not preempt pods with lower priority
|
||||||
|
kubectl create priorityclass high-priority --value=1000 --description="high priority" --preemption-policy="Never"`))
|
||||||
)
|
)
|
||||||
|
|
||||||
// PriorityClassOpts holds the options for 'create priorityclass' sub command
|
// PriorityClassOpts holds the options for 'create priorityclass' sub command
|
||||||
@ -72,8 +76,7 @@ func NewCmdCreatePriorityClass(f cmdutil.Factory, ioStreams genericclioptions.IO
|
|||||||
cmd.Flags().Int32("value", 0, i18n.T("the value of this priority class."))
|
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().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().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."))
|
cmd.Flags().String("preemption-policy", "", i18n.T("preemption-policy is the policy for preempting pods with lower priority."))
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +95,7 @@ func (o *PriorityClassOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args
|
|||||||
Value: cmdutil.GetFlagInt32(cmd, "value"),
|
Value: cmdutil.GetFlagInt32(cmd, "value"),
|
||||||
GlobalDefault: cmdutil.GetFlagBool(cmd, "global-default"),
|
GlobalDefault: cmdutil.GetFlagBool(cmd, "global-default"),
|
||||||
Description: cmdutil.GetFlagString(cmd, "description"),
|
Description: cmdutil.GetFlagString(cmd, "description"),
|
||||||
Preempting: cmdutil.GetFlagBool(cmd, "preempting"),
|
PreemptionPolicy: apiv1.PreemptionPolicy(cmdutil.GetFlagString(cmd, "preemption-policy")),
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return errUnsupportedGenerator(cmd, generatorName)
|
return errUnsupportedGenerator(cmd, generatorName)
|
||||||
|
@ -56,9 +56,9 @@ func TestCreatePriorityClass(t *testing.T) {
|
|||||||
cmd.Flags().Set("value", "1000")
|
cmd.Flags().Set("value", "1000")
|
||||||
cmd.Flags().Set("global-default", "true")
|
cmd.Flags().Set("global-default", "true")
|
||||||
cmd.Flags().Set("description", "my priority")
|
cmd.Flags().Set("description", "my priority")
|
||||||
cmd.Flags().Set("preempting", "true")
|
|
||||||
cmd.Flags().Set("dry-run", "true")
|
cmd.Flags().Set("dry-run", "true")
|
||||||
cmd.Flags().Set("output", outputFormat)
|
cmd.Flags().Set("output", outputFormat)
|
||||||
|
cmd.Flags().Set("preemption-policy", "Never")
|
||||||
|
|
||||||
printFlags := genericclioptions.NewPrintFlags("created").WithTypeSetter(scheme.Scheme)
|
printFlags := genericclioptions.NewPrintFlags("created").WithTypeSetter(scheme.Scheme)
|
||||||
printFlags.OutputFormat = &outputFormat
|
printFlags.OutputFormat = &outputFormat
|
||||||
|
@ -19,6 +19,7 @@ package versioned
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
scheduling "k8s.io/api/scheduling/v1"
|
scheduling "k8s.io/api/scheduling/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
@ -31,7 +32,7 @@ type PriorityClassV1Generator struct {
|
|||||||
Value int32
|
Value int32
|
||||||
GlobalDefault bool
|
GlobalDefault bool
|
||||||
Description string
|
Description string
|
||||||
Preempting bool
|
PreemptionPolicy apiv1.PreemptionPolicy
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure it supports the generator pattern that uses parameters specified during construction.
|
// Ensure it supports the generator pattern that uses parameters specified during construction.
|
||||||
@ -43,9 +44,10 @@ func (PriorityClassV1Generator) ParamNames() []generate.GeneratorParam {
|
|||||||
{Name: "value", Required: true},
|
{Name: "value", Required: true},
|
||||||
{Name: "global-default", Required: false},
|
{Name: "global-default", Required: false},
|
||||||
{Name: "description", Required: false},
|
{Name: "description", Required: false},
|
||||||
{Name: "preempting", Required: false},
|
{Name: "preemption-policy", Required: false},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s PriorityClassV1Generator) Generate(params map[string]interface{}) (runtime.Object, error) {
|
func (s PriorityClassV1Generator) Generate(params map[string]interface{}) (runtime.Object, error) {
|
||||||
if err := generate.ValidateParams(s.ParamNames(), params); err != nil {
|
if err := generate.ValidateParams(s.ParamNames(), params); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -71,12 +73,9 @@ func (s PriorityClassV1Generator) Generate(params map[string]interface{}) (runti
|
|||||||
return nil, fmt.Errorf("expected string, found %v", description)
|
return nil, fmt.Errorf("expected string, found %v", description)
|
||||||
}
|
}
|
||||||
|
|
||||||
Preempting, found := params["preempting"].(bool)
|
preemptionPolicy := apiv1.PreemptionPolicy(params["preemption-policy"].(string))
|
||||||
if !found {
|
|
||||||
return nil, fmt.Errorf("expected bool, found %v", Preempting)
|
|
||||||
}
|
|
||||||
|
|
||||||
delegate := &PriorityClassV1Generator{Name: name, Value: value, GlobalDefault: globalDefault, Description: description, Preempting: Preempting}
|
delegate := &PriorityClassV1Generator{Name: name, Value: value, GlobalDefault: globalDefault, Description: description, PreemptionPolicy: preemptionPolicy}
|
||||||
return delegate.StructuredGenerate()
|
return delegate.StructuredGenerate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +88,6 @@ func (s *PriorityClassV1Generator) StructuredGenerate() (runtime.Object, error)
|
|||||||
Value: s.Value,
|
Value: s.Value,
|
||||||
GlobalDefault: s.GlobalDefault,
|
GlobalDefault: s.GlobalDefault,
|
||||||
Description: s.Description,
|
Description: s.Description,
|
||||||
Preempting: &s.Preempting,
|
PreemptionPolicy: &s.PreemptionPolicy,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package versioned
|
package versioned
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
scheduling "k8s.io/api/scheduling/v1"
|
scheduling "k8s.io/api/scheduling/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
@ -25,8 +26,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestPriorityClassV1Generator(t *testing.T) {
|
func TestPriorityClassV1Generator(t *testing.T) {
|
||||||
true := true
|
var (
|
||||||
false := false
|
preemptLowerPriority = apiv1.PreemptLowerPriority
|
||||||
|
preemptNever = apiv1.PreemptNever
|
||||||
|
)
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
params map[string]interface{}
|
params map[string]interface{}
|
||||||
@ -40,7 +43,7 @@ func TestPriorityClassV1Generator(t *testing.T) {
|
|||||||
"value": int32(1000),
|
"value": int32(1000),
|
||||||
"global-default": false,
|
"global-default": false,
|
||||||
"description": "high priority class",
|
"description": "high priority class",
|
||||||
"preempting": false,
|
"preemption-policy": "PreemptLowerPriority",
|
||||||
},
|
},
|
||||||
expected: &scheduling.PriorityClass{
|
expected: &scheduling.PriorityClass{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
@ -49,7 +52,7 @@ func TestPriorityClassV1Generator(t *testing.T) {
|
|||||||
Value: int32(1000),
|
Value: int32(1000),
|
||||||
GlobalDefault: false,
|
GlobalDefault: false,
|
||||||
Description: "high priority class",
|
Description: "high priority class",
|
||||||
Preempting: &false,
|
PreemptionPolicy: &preemptLowerPriority,
|
||||||
},
|
},
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
@ -60,7 +63,7 @@ func TestPriorityClassV1Generator(t *testing.T) {
|
|||||||
"value": int32(1000),
|
"value": int32(1000),
|
||||||
"global-default": false,
|
"global-default": false,
|
||||||
"description": "high priority class",
|
"description": "high priority class",
|
||||||
"preempting": true,
|
"preemption-policy": "Never",
|
||||||
},
|
},
|
||||||
expected: &scheduling.PriorityClass{
|
expected: &scheduling.PriorityClass{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
@ -69,7 +72,7 @@ func TestPriorityClassV1Generator(t *testing.T) {
|
|||||||
Value: int32(1000),
|
Value: int32(1000),
|
||||||
GlobalDefault: false,
|
GlobalDefault: false,
|
||||||
Description: "high priority class",
|
Description: "high priority class",
|
||||||
Preempting: &true,
|
PreemptionPolicy: &preemptNever,
|
||||||
},
|
},
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
@ -80,7 +83,7 @@ func TestPriorityClassV1Generator(t *testing.T) {
|
|||||||
"value": int32(1000),
|
"value": int32(1000),
|
||||||
"global-default": true,
|
"global-default": true,
|
||||||
"description": "high priority class",
|
"description": "high priority class",
|
||||||
"preempting": false,
|
"preemption-policy": "PreemptLowerPriority",
|
||||||
},
|
},
|
||||||
expected: &scheduling.PriorityClass{
|
expected: &scheduling.PriorityClass{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
@ -89,7 +92,7 @@ func TestPriorityClassV1Generator(t *testing.T) {
|
|||||||
Value: int32(1000),
|
Value: int32(1000),
|
||||||
GlobalDefault: true,
|
GlobalDefault: true,
|
||||||
Description: "high priority class",
|
Description: "high priority class",
|
||||||
Preempting: &false,
|
PreemptionPolicy: &preemptLowerPriority,
|
||||||
},
|
},
|
||||||
expectErr: false,
|
expectErr: false,
|
||||||
},
|
},
|
||||||
@ -99,7 +102,7 @@ func TestPriorityClassV1Generator(t *testing.T) {
|
|||||||
"name": "foo",
|
"name": "foo",
|
||||||
"global-default": true,
|
"global-default": true,
|
||||||
"description": "high priority class",
|
"description": "high priority class",
|
||||||
"preempting": false,
|
"preemption-policy": "PreemptLowerPriority",
|
||||||
},
|
},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
|
@ -1444,7 +1444,6 @@ func TestUpdateRcWithRetries(t *testing.T) {
|
|||||||
one := int32(1)
|
one := int32(1)
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
enableServiceLinks := corev1.DefaultEnableServiceLinks
|
enableServiceLinks := corev1.DefaultEnableServiceLinks
|
||||||
preempting := corev1.DefaultPreempting
|
|
||||||
rc := &corev1.ReplicationController{
|
rc := &corev1.ReplicationController{
|
||||||
TypeMeta: metav1.TypeMeta{
|
TypeMeta: metav1.TypeMeta{
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
@ -1472,7 +1471,6 @@ func TestUpdateRcWithRetries(t *testing.T) {
|
|||||||
TerminationGracePeriodSeconds: &grace,
|
TerminationGracePeriodSeconds: &grace,
|
||||||
SecurityContext: &corev1.PodSecurityContext{},
|
SecurityContext: &corev1.PodSecurityContext{},
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -38,7 +38,6 @@ func noDefault(*core.Pod) error { return nil }
|
|||||||
func TestDecodeSinglePod(t *testing.T) {
|
func TestDecodeSinglePod(t *testing.T) {
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
preempting := v1.DefaultPreempting
|
|
||||||
pod := &v1.Pod{
|
pod := &v1.Pod{
|
||||||
TypeMeta: metav1.TypeMeta{
|
TypeMeta: metav1.TypeMeta{
|
||||||
APIVersion: "",
|
APIVersion: "",
|
||||||
@ -63,7 +62,6 @@ func TestDecodeSinglePod(t *testing.T) {
|
|||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: core.DefaultSchedulerName,
|
SchedulerName: core.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
json, err := runtime.Encode(testapi.Default.Codec(), pod)
|
json, err := runtime.Encode(testapi.Default.Codec(), pod)
|
||||||
@ -104,7 +102,6 @@ func TestDecodeSinglePod(t *testing.T) {
|
|||||||
func TestDecodePodList(t *testing.T) {
|
func TestDecodePodList(t *testing.T) {
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
preempting := v1.DefaultPreempting
|
|
||||||
pod := &v1.Pod{
|
pod := &v1.Pod{
|
||||||
TypeMeta: metav1.TypeMeta{
|
TypeMeta: metav1.TypeMeta{
|
||||||
APIVersion: "",
|
APIVersion: "",
|
||||||
@ -130,7 +127,6 @@ func TestDecodePodList(t *testing.T) {
|
|||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: core.DefaultSchedulerName,
|
SchedulerName: core.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
podList := &v1.PodList{
|
podList := &v1.PodList{
|
||||||
|
@ -140,7 +140,6 @@ type testCase struct {
|
|||||||
func getTestCases(hostname types.NodeName) []*testCase {
|
func getTestCases(hostname types.NodeName) []*testCase {
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
preempting := v1.DefaultPreempting
|
|
||||||
return []*testCase{
|
return []*testCase{
|
||||||
{
|
{
|
||||||
lock: &sync.Mutex{},
|
lock: &sync.Mutex{},
|
||||||
@ -192,7 +191,6 @@ func getTestCases(hostname types.NodeName) []*testCase {
|
|||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: api.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
},
|
},
|
||||||
Status: v1.PodStatus{
|
Status: v1.PodStatus{
|
||||||
Phase: v1.PodPending,
|
Phase: v1.PodPending,
|
||||||
|
@ -130,7 +130,6 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
|
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
preempting := v1.DefaultPreempting
|
|
||||||
var testCases = []struct {
|
var testCases = []struct {
|
||||||
desc string
|
desc string
|
||||||
pods runtime.Object
|
pods runtime.Object
|
||||||
@ -176,7 +175,6 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
TerminationGracePeriodSeconds: &grace,
|
TerminationGracePeriodSeconds: &grace,
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: api.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
|
|
||||||
Containers: []v1.Container{{
|
Containers: []v1.Container{{
|
||||||
Name: "1",
|
Name: "1",
|
||||||
@ -249,7 +247,6 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: api.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
|
|
||||||
Containers: []v1.Container{{
|
Containers: []v1.Container{{
|
||||||
Name: "1",
|
Name: "1",
|
||||||
@ -279,7 +276,6 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
SecurityContext: &v1.PodSecurityContext{},
|
SecurityContext: &v1.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: api.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
|
|
||||||
Containers: []v1.Container{{
|
Containers: []v1.Container{{
|
||||||
Name: "2",
|
Name: "2",
|
||||||
|
@ -59,7 +59,6 @@ func newStorage(t *testing.T) (*REST, *BindingREST, *StatusREST, *etcdtesting.Et
|
|||||||
func validNewPod() *api.Pod {
|
func validNewPod() *api.Pod {
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
preempting := v1.DefaultPreempting
|
|
||||||
return &api.Pod{
|
return &api.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
@ -84,7 +83,6 @@ func validNewPod() *api.Pod {
|
|||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: api.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -785,7 +783,6 @@ func TestEtcdUpdateScheduled(t *testing.T) {
|
|||||||
|
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
preempting := v1.DefaultPreempting
|
|
||||||
podIn := api.Pod{
|
podIn := api.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "foo",
|
Name: "foo",
|
||||||
@ -810,7 +807,6 @@ func TestEtcdUpdateScheduled(t *testing.T) {
|
|||||||
SecurityContext: &api.PodSecurityContext{},
|
SecurityContext: &api.PodSecurityContext{},
|
||||||
SchedulerName: api.DefaultSchedulerName,
|
SchedulerName: api.DefaultSchedulerName,
|
||||||
EnableServiceLinks: &enableServiceLinks,
|
EnableServiceLinks: &enableServiceLinks,
|
||||||
Preempting: &preempting,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
_, _, err = storage.Update(ctx, podIn.Name, rest.DefaultUpdatedObjectInfo(&podIn), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{})
|
_, _, err = storage.Update(ctx, podIn.Name, rest.DefaultUpdatedObjectInfo(&podIn), rest.ValidateAllObjectFunc, rest.ValidateAllObjectUpdateFunc, false, &metav1.UpdateOptions{})
|
||||||
@ -889,12 +885,10 @@ func TestEtcdUpdateStatus(t *testing.T) {
|
|||||||
expected.ResourceVersion = "2"
|
expected.ResourceVersion = "2"
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
enableServiceLinks := v1.DefaultEnableServiceLinks
|
enableServiceLinks := v1.DefaultEnableServiceLinks
|
||||||
preempting := v1.DefaultPreempting
|
|
||||||
expected.Spec.TerminationGracePeriodSeconds = &grace
|
expected.Spec.TerminationGracePeriodSeconds = &grace
|
||||||
expected.Spec.RestartPolicy = api.RestartPolicyAlways
|
expected.Spec.RestartPolicy = api.RestartPolicyAlways
|
||||||
expected.Spec.DNSPolicy = api.DNSClusterFirst
|
expected.Spec.DNSPolicy = api.DNSClusterFirst
|
||||||
expected.Spec.EnableServiceLinks = &enableServiceLinks
|
expected.Spec.EnableServiceLinks = &enableServiceLinks
|
||||||
expected.Spec.Preempting = &preempting
|
|
||||||
expected.Spec.Containers[0].ImagePullPolicy = api.PullIfNotPresent
|
expected.Spec.Containers[0].ImagePullPolicy = api.PullIfNotPresent
|
||||||
expected.Spec.Containers[0].TerminationMessagePath = api.TerminationMessagePathDefault
|
expected.Spec.Containers[0].TerminationMessagePath = api.TerminationMessagePathDefault
|
||||||
expected.Spec.Containers[0].TerminationMessagePolicy = api.TerminationMessageReadFile
|
expected.Spec.Containers[0].TerminationMessagePolicy = api.TerminationMessageReadFile
|
||||||
|
@ -27,6 +27,7 @@ go_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//pkg/api/legacyscheme:go_default_library",
|
"//pkg/api/legacyscheme:go_default_library",
|
||||||
"//pkg/apis/scheduling:go_default_library",
|
"//pkg/apis/scheduling:go_default_library",
|
||||||
|
"//pkg/apis/scheduling/util:go_default_library",
|
||||||
"//pkg/apis/scheduling/validation:go_default_library",
|
"//pkg/apis/scheduling/validation:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"k8s.io/apiserver/pkg/storage/names"
|
"k8s.io/apiserver/pkg/storage/names"
|
||||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
"k8s.io/kubernetes/pkg/apis/scheduling"
|
||||||
|
schedulingutil "k8s.io/kubernetes/pkg/apis/scheduling/util"
|
||||||
"k8s.io/kubernetes/pkg/apis/scheduling/validation"
|
"k8s.io/kubernetes/pkg/apis/scheduling/validation"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -45,12 +46,15 @@ func (priorityClassStrategy) NamespaceScoped() bool {
|
|||||||
func (priorityClassStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
|
func (priorityClassStrategy) PrepareForCreate(ctx context.Context, obj runtime.Object) {
|
||||||
pc := obj.(*scheduling.PriorityClass)
|
pc := obj.(*scheduling.PriorityClass)
|
||||||
pc.Generation = 1
|
pc.Generation = 1
|
||||||
|
schedulingutil.DropDisabledFields(pc, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
|
||||||
func (priorityClassStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
|
func (priorityClassStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
|
||||||
_ = obj.(*scheduling.PriorityClass)
|
newClass := obj.(*scheduling.PriorityClass)
|
||||||
_ = old.(*scheduling.PriorityClass)
|
oldClass := old.(*scheduling.PriorityClass)
|
||||||
|
|
||||||
|
schedulingutil.DropDisabledFields(newClass, oldClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate validates a new PriorityClass.
|
// Validate validates a new PriorityClass.
|
||||||
|
@ -32,7 +32,6 @@ go_library(
|
|||||||
"//staging/src/k8s.io/client-go/informers/apps/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/informers/apps/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/informers/policy/v1beta1:go_default_library",
|
"//staging/src/k8s.io/client-go/informers/policy/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/informers/scheduling/v1:go_default_library",
|
|
||||||
"//staging/src/k8s.io/client-go/informers/storage/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/informers/storage/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
||||||
|
@ -16,7 +16,6 @@ go_library(
|
|||||||
"//staging/src/k8s.io/api/apps/v1:go_default_library",
|
"//staging/src/k8s.io/api/apps/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
|
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -20,17 +20,10 @@ import (
|
|||||||
apps "k8s.io/api/apps/v1"
|
apps "k8s.io/api/apps/v1"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
policyv1beta1 "k8s.io/api/policy/v1beta1"
|
policyv1beta1 "k8s.io/api/policy/v1beta1"
|
||||||
scheduling "k8s.io/api/scheduling/v1"
|
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
|
schedulerapi "k8s.io/kubernetes/pkg/scheduler/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PriorityClassLister represents anything that can get PriorityClass object
|
|
||||||
type PriorityClassLister interface {
|
|
||||||
// Get retrieves the PriorityClass from the index for a given name.
|
|
||||||
Get(name string) (*scheduling.PriorityClass, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NodeFieldSelectorKeys is a map that: the key are node field selector keys; the values are
|
// NodeFieldSelectorKeys is a map that: the key are node field selector keys; the values are
|
||||||
// the functions to get the value of the node field.
|
// the functions to get the value of the node field.
|
||||||
var NodeFieldSelectorKeys = map[string]func(*v1.Node) string{
|
var NodeFieldSelectorKeys = map[string]func(*v1.Node) string{
|
||||||
|
@ -1109,7 +1109,6 @@ func TestCompatibility_v1_Scheduler(t *testing.T) {
|
|||||||
ServiceInformer: informerFactory.Core().V1().Services(),
|
ServiceInformer: informerFactory.Core().V1().Services(),
|
||||||
PdbInformer: informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
PdbInformer: informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||||
StorageClassInformer: informerFactory.Storage().V1().StorageClasses(),
|
StorageClassInformer: informerFactory.Storage().V1().StorageClasses(),
|
||||||
PriorityClassInformer: informerFactory.Scheduling().V1().PriorityClasses(),
|
|
||||||
HardPodAffinitySymmetricWeight: v1.DefaultHardPodAffinitySymmetricWeight,
|
HardPodAffinitySymmetricWeight: v1.DefaultHardPodAffinitySymmetricWeight,
|
||||||
DisablePreemption: false,
|
DisablePreemption: false,
|
||||||
PercentageOfNodesToScore: schedulerapi.DefaultPercentageOfNodesToScore,
|
PercentageOfNodesToScore: schedulerapi.DefaultPercentageOfNodesToScore,
|
||||||
|
@ -547,10 +547,10 @@ func TestGenericSchedulerWithExtenders(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
schedulertesting.FakePersistentVolumeClaimLister{},
|
schedulertesting.FakePersistentVolumeClaimLister{},
|
||||||
schedulertesting.FakePDBLister{},
|
schedulertesting.FakePDBLister{},
|
||||||
schedulertesting.FakePriorityClassLister{},
|
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
schedulerapi.DefaultPercentageOfNodesToScore)
|
schedulerapi.DefaultPercentageOfNodesToScore,
|
||||||
|
false)
|
||||||
podIgnored := &v1.Pod{}
|
podIgnored := &v1.Pod{}
|
||||||
result, err := scheduler.Schedule(podIgnored, schedulertesting.FakeNodeLister(makeNodeList(test.nodes)))
|
result, err := scheduler.Schedule(podIgnored, schedulertesting.FakeNodeLister(makeNodeList(test.nodes)))
|
||||||
if test.expectsErr {
|
if test.expectsErr {
|
||||||
|
@ -166,10 +166,10 @@ type genericScheduler struct {
|
|||||||
volumeBinder *volumebinder.VolumeBinder
|
volumeBinder *volumebinder.VolumeBinder
|
||||||
pvcLister corelisters.PersistentVolumeClaimLister
|
pvcLister corelisters.PersistentVolumeClaimLister
|
||||||
pdbLister algorithm.PDBLister
|
pdbLister algorithm.PDBLister
|
||||||
priorityClassLister algorithm.PriorityClassLister
|
|
||||||
disablePreemption bool
|
disablePreemption bool
|
||||||
lastIndex int
|
lastIndex int
|
||||||
percentageOfNodesToScore int32
|
percentageOfNodesToScore int32
|
||||||
|
enableNonPreempting bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// snapshot snapshots scheduler cache and node infos for all fit and priority
|
// snapshot snapshots scheduler cache and node infos for all fit and priority
|
||||||
@ -315,7 +315,7 @@ func (g *genericScheduler) Preempt(pod *v1.Pod, nodeLister algorithm.NodeLister,
|
|||||||
if !ok || fitError == nil {
|
if !ok || fitError == nil {
|
||||||
return nil, nil, nil, nil
|
return nil, nil, nil, nil
|
||||||
}
|
}
|
||||||
if !podEligibleToPreemptOthers(pod, g.nodeInfoSnapshot.NodeInfoMap) {
|
if !podEligibleToPreemptOthers(pod, g.nodeInfoSnapshot.NodeInfoMap, g.enableNonPreempting) {
|
||||||
klog.V(5).Infof("Pod %v/%v is not eligible for more preemption.", pod.Namespace, pod.Name)
|
klog.V(5).Infof("Pod %v/%v is not eligible for more preemption.", pod.Namespace, pod.Name)
|
||||||
return nil, nil, nil, nil
|
return nil, nil, nil, nil
|
||||||
}
|
}
|
||||||
@ -1163,9 +1163,9 @@ func nodesWherePreemptionMightHelp(nodes []*v1.Node, failedPredicatesMap FailedP
|
|||||||
// considered for preemption.
|
// considered for preemption.
|
||||||
// We look at the node that is nominated for this pod and as long as there are
|
// We look at the node that is nominated for this pod and as long as there are
|
||||||
// terminating pods on the node, we don't consider this for preempting more pods.
|
// terminating pods on the node, we don't consider this for preempting more pods.
|
||||||
func podEligibleToPreemptOthers(pod *v1.Pod, nodeNameToInfo map[string]*schedulernodeinfo.NodeInfo) bool {
|
func podEligibleToPreemptOthers(pod *v1.Pod, nodeNameToInfo map[string]*schedulernodeinfo.NodeInfo, enableNonPreempting bool) bool {
|
||||||
if pod.Spec.Preempting != nil && !*(pod.Spec.Preempting) {
|
if enableNonPreempting && pod.Spec.PreemptionPolicy != nil && *pod.Spec.PreemptionPolicy == v1.PreemptNever {
|
||||||
klog.V(5).Infof("Pod %v/%v with this Preempting could not start a preemption process.", pod.Namespace, pod.Name)
|
klog.V(5).Infof("Pod %v/%v is not eligible for preemption because it has a preemptionPolicy of %v", pod.Namespace, pod.Name, v1.PreemptNever)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
nomNodeName := pod.Status.NominatedNodeName
|
nomNodeName := pod.Status.NominatedNodeName
|
||||||
@ -1222,10 +1222,10 @@ func NewGenericScheduler(
|
|||||||
volumeBinder *volumebinder.VolumeBinder,
|
volumeBinder *volumebinder.VolumeBinder,
|
||||||
pvcLister corelisters.PersistentVolumeClaimLister,
|
pvcLister corelisters.PersistentVolumeClaimLister,
|
||||||
pdbLister algorithm.PDBLister,
|
pdbLister algorithm.PDBLister,
|
||||||
priorityClassLister algorithm.PriorityClassLister,
|
|
||||||
alwaysCheckAllPredicates bool,
|
alwaysCheckAllPredicates bool,
|
||||||
disablePreemption bool,
|
disablePreemption bool,
|
||||||
percentageOfNodesToScore int32,
|
percentageOfNodesToScore int32,
|
||||||
|
enableNonPreempting bool,
|
||||||
) ScheduleAlgorithm {
|
) ScheduleAlgorithm {
|
||||||
return &genericScheduler{
|
return &genericScheduler{
|
||||||
cache: cache,
|
cache: cache,
|
||||||
@ -1240,9 +1240,9 @@ func NewGenericScheduler(
|
|||||||
volumeBinder: volumeBinder,
|
volumeBinder: volumeBinder,
|
||||||
pvcLister: pvcLister,
|
pvcLister: pvcLister,
|
||||||
pdbLister: pdbLister,
|
pdbLister: pdbLister,
|
||||||
priorityClassLister: priorityClassLister,
|
|
||||||
alwaysCheckAllPredicates: alwaysCheckAllPredicates,
|
alwaysCheckAllPredicates: alwaysCheckAllPredicates,
|
||||||
disablePreemption: disablePreemption,
|
disablePreemption: disablePreemption,
|
||||||
percentageOfNodesToScore: percentageOfNodesToScore,
|
percentageOfNodesToScore: percentageOfNodesToScore,
|
||||||
|
enableNonPreempting: enableNonPreempting,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -462,10 +462,10 @@ func TestGenericScheduler(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
pvcLister,
|
pvcLister,
|
||||||
schedulertesting.FakePDBLister{},
|
schedulertesting.FakePDBLister{},
|
||||||
schedulertesting.FakePriorityClassLister{},
|
|
||||||
test.alwaysCheckAllPredicates,
|
test.alwaysCheckAllPredicates,
|
||||||
false,
|
false,
|
||||||
schedulerapi.DefaultPercentageOfNodesToScore)
|
schedulerapi.DefaultPercentageOfNodesToScore,
|
||||||
|
false)
|
||||||
result, err := scheduler.Schedule(test.pod, schedulertesting.FakeNodeLister(makeNodeList(test.nodes)))
|
result, err := scheduler.Schedule(test.pod, schedulertesting.FakeNodeLister(makeNodeList(test.nodes)))
|
||||||
|
|
||||||
if !reflect.DeepEqual(err, test.wErr) {
|
if !reflect.DeepEqual(err, test.wErr) {
|
||||||
@ -494,8 +494,8 @@ func makeScheduler(predicates map[string]algorithmpredicates.FitPredicate, nodes
|
|||||||
prioritizers,
|
prioritizers,
|
||||||
priorities.EmptyPriorityMetadataProducer,
|
priorities.EmptyPriorityMetadataProducer,
|
||||||
emptyFramework,
|
emptyFramework,
|
||||||
nil, nil, nil, nil, nil, false, false,
|
nil, nil, nil, nil, false, false,
|
||||||
schedulerapi.DefaultPercentageOfNodesToScore)
|
schedulerapi.DefaultPercentageOfNodesToScore, false)
|
||||||
cache.UpdateNodeInfoSnapshot(s.(*genericScheduler).nodeInfoSnapshot)
|
cache.UpdateNodeInfoSnapshot(s.(*genericScheduler).nodeInfoSnapshot)
|
||||||
return s.(*genericScheduler)
|
return s.(*genericScheduler)
|
||||||
|
|
||||||
@ -1333,6 +1333,10 @@ func TestPreempt(t *testing.T) {
|
|||||||
for i := 1; i < 4; i++ {
|
for i := 1; i < 4; i++ {
|
||||||
nodeNames = append(nodeNames, fmt.Sprintf("machine%d", i))
|
nodeNames = append(nodeNames, fmt.Sprintf("machine%d", i))
|
||||||
}
|
}
|
||||||
|
var (
|
||||||
|
preemptLowerPriority = v1.PreemptLowerPriority
|
||||||
|
preemptNever = v1.PreemptNever
|
||||||
|
)
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
pod *v1.Pod
|
pod *v1.Pod
|
||||||
@ -1345,7 +1349,8 @@ func TestPreempt(t *testing.T) {
|
|||||||
name: "basic preemption logic",
|
name: "basic preemption logic",
|
||||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
||||||
Containers: veryLargeContainers,
|
Containers: veryLargeContainers,
|
||||||
Priority: &highPriority},
|
Priority: &highPriority,
|
||||||
|
PreemptionPolicy: &preemptLowerPriority},
|
||||||
},
|
},
|
||||||
pods: []*v1.Pod{
|
pods: []*v1.Pod{
|
||||||
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &lowPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &lowPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
@ -1360,7 +1365,8 @@ func TestPreempt(t *testing.T) {
|
|||||||
name: "One node doesn't need any preemption",
|
name: "One node doesn't need any preemption",
|
||||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
||||||
Containers: veryLargeContainers,
|
Containers: veryLargeContainers,
|
||||||
Priority: &highPriority},
|
Priority: &highPriority,
|
||||||
|
PreemptionPolicy: &preemptLowerPriority},
|
||||||
},
|
},
|
||||||
pods: []*v1.Pod{
|
pods: []*v1.Pod{
|
||||||
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &lowPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &lowPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
@ -1375,7 +1381,8 @@ func TestPreempt(t *testing.T) {
|
|||||||
name: "Scheduler extenders allow only machine1, otherwise machine3 would have been chosen",
|
name: "Scheduler extenders allow only machine1, otherwise machine3 would have been chosen",
|
||||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
||||||
Containers: veryLargeContainers,
|
Containers: veryLargeContainers,
|
||||||
Priority: &highPriority},
|
Priority: &highPriority,
|
||||||
|
PreemptionPolicy: &preemptLowerPriority},
|
||||||
},
|
},
|
||||||
pods: []*v1.Pod{
|
pods: []*v1.Pod{
|
||||||
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &midPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &midPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
@ -1398,7 +1405,8 @@ func TestPreempt(t *testing.T) {
|
|||||||
name: "Scheduler extenders do not allow any preemption",
|
name: "Scheduler extenders do not allow any preemption",
|
||||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
||||||
Containers: veryLargeContainers,
|
Containers: veryLargeContainers,
|
||||||
Priority: &highPriority},
|
Priority: &highPriority,
|
||||||
|
PreemptionPolicy: &preemptLowerPriority},
|
||||||
},
|
},
|
||||||
pods: []*v1.Pod{
|
pods: []*v1.Pod{
|
||||||
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &midPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &midPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
@ -1418,7 +1426,8 @@ func TestPreempt(t *testing.T) {
|
|||||||
name: "One scheduler extender allows only machine1, the other returns error but ignorable. Only machine1 would be chosen",
|
name: "One scheduler extender allows only machine1, the other returns error but ignorable. Only machine1 would be chosen",
|
||||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
||||||
Containers: veryLargeContainers,
|
Containers: veryLargeContainers,
|
||||||
Priority: &highPriority},
|
Priority: &highPriority,
|
||||||
|
PreemptionPolicy: &preemptLowerPriority},
|
||||||
},
|
},
|
||||||
pods: []*v1.Pod{
|
pods: []*v1.Pod{
|
||||||
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &midPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &midPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
@ -1442,7 +1451,8 @@ func TestPreempt(t *testing.T) {
|
|||||||
name: "One scheduler extender allows only machine1, but it is not interested in given pod, otherwise machine1 would have been chosen",
|
name: "One scheduler extender allows only machine1, but it is not interested in given pod, otherwise machine1 would have been chosen",
|
||||||
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
||||||
Containers: veryLargeContainers,
|
Containers: veryLargeContainers,
|
||||||
Priority: &highPriority},
|
Priority: &highPriority,
|
||||||
|
PreemptionPolicy: &preemptLowerPriority},
|
||||||
},
|
},
|
||||||
pods: []*v1.Pod{
|
pods: []*v1.Pod{
|
||||||
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &midPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &midPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
@ -1462,6 +1472,38 @@ func TestPreempt(t *testing.T) {
|
|||||||
expectedNode: "machine3",
|
expectedNode: "machine3",
|
||||||
expectedPods: []string{},
|
expectedPods: []string{},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "no preempting in pod",
|
||||||
|
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
||||||
|
Containers: veryLargeContainers,
|
||||||
|
Priority: &highPriority,
|
||||||
|
PreemptionPolicy: &preemptNever},
|
||||||
|
},
|
||||||
|
pods: []*v1.Pod{
|
||||||
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &lowPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.2", UID: types.UID("m1.2")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &lowPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
|
{ObjectMeta: metav1.ObjectMeta{Name: "m2.1", UID: types.UID("m2.1")}, Spec: v1.PodSpec{Containers: largeContainers, Priority: &highPriority, NodeName: "machine2"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
|
{ObjectMeta: metav1.ObjectMeta{Name: "m3.1", UID: types.UID("m3.1")}, Spec: v1.PodSpec{Containers: mediumContainers, Priority: &midPriority, NodeName: "machine3"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
|
},
|
||||||
|
expectedNode: "",
|
||||||
|
expectedPods: nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "PreemptionPolicy is nil",
|
||||||
|
pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "pod1", UID: types.UID("pod1")}, Spec: v1.PodSpec{
|
||||||
|
Containers: veryLargeContainers,
|
||||||
|
Priority: &highPriority,
|
||||||
|
PreemptionPolicy: nil},
|
||||||
|
},
|
||||||
|
pods: []*v1.Pod{
|
||||||
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.1", UID: types.UID("m1.1")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &lowPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
|
{ObjectMeta: metav1.ObjectMeta{Name: "m1.2", UID: types.UID("m1.2")}, Spec: v1.PodSpec{Containers: smallContainers, Priority: &lowPriority, NodeName: "machine1"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
|
{ObjectMeta: metav1.ObjectMeta{Name: "m2.1", UID: types.UID("m2.1")}, Spec: v1.PodSpec{Containers: largeContainers, Priority: &highPriority, NodeName: "machine2"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
|
{ObjectMeta: metav1.ObjectMeta{Name: "m3.1", UID: types.UID("m3.1")}, Spec: v1.PodSpec{Containers: mediumContainers, Priority: &midPriority, NodeName: "machine3"}, Status: v1.PodStatus{Phase: v1.PodRunning}},
|
||||||
|
},
|
||||||
|
expectedNode: "machine1",
|
||||||
|
expectedPods: []string{"m1.1", "m1.2"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
@ -1500,10 +1542,10 @@ func TestPreempt(t *testing.T) {
|
|||||||
nil,
|
nil,
|
||||||
schedulertesting.FakePersistentVolumeClaimLister{},
|
schedulertesting.FakePersistentVolumeClaimLister{},
|
||||||
schedulertesting.FakePDBLister{},
|
schedulertesting.FakePDBLister{},
|
||||||
schedulertesting.FakePriorityClassLister{},
|
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
schedulerapi.DefaultPercentageOfNodesToScore)
|
schedulerapi.DefaultPercentageOfNodesToScore,
|
||||||
|
true)
|
||||||
scheduler.(*genericScheduler).snapshot()
|
scheduler.(*genericScheduler).snapshot()
|
||||||
// Call Preempt and check the expected results.
|
// Call Preempt and check the expected results.
|
||||||
node, victims, _, err := scheduler.Preempt(test.pod, schedulertesting.FakeNodeLister(makeNodeList(nodeNames)), error(&FitError{Pod: test.pod, FailedPredicates: failedPredMap}))
|
node, victims, _, err := scheduler.Preempt(test.pod, schedulertesting.FakeNodeLister(makeNodeList(nodeNames)), error(&FitError{Pod: test.pod, FailedPredicates: failedPredMap}))
|
||||||
@ -1589,7 +1631,6 @@ func TestNumFeasibleNodesToFind(t *testing.T) {
|
|||||||
wantNumNodes: 2400,
|
wantNumNodes: 2400,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
g := &genericScheduler{
|
g := &genericScheduler{
|
||||||
|
@ -10,6 +10,7 @@ go_library(
|
|||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
"//pkg/api/v1/pod:go_default_library",
|
"//pkg/api/v1/pod:go_default_library",
|
||||||
|
"//pkg/features:go_default_library",
|
||||||
"//pkg/scheduler/algorithm:go_default_library",
|
"//pkg/scheduler/algorithm:go_default_library",
|
||||||
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
"//pkg/scheduler/algorithm/predicates:go_default_library",
|
||||||
"//pkg/scheduler/algorithm/priorities:go_default_library",
|
"//pkg/scheduler/algorithm/priorities:go_default_library",
|
||||||
@ -32,16 +33,15 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/informers/apps/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/informers/apps/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/informers/policy/v1beta1:go_default_library",
|
"//staging/src/k8s.io/client-go/informers/policy/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/informers/scheduling/v1:go_default_library",
|
|
||||||
"//staging/src/k8s.io/client-go/informers/storage/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/informers/storage/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/listers/apps/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/listers/apps/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/listers/policy/v1beta1:go_default_library",
|
"//staging/src/k8s.io/client-go/listers/policy/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/listers/scheduling/v1:go_default_library",
|
|
||||||
"//staging/src/k8s.io/client-go/listers/storage/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/listers/storage/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
|
||||||
|
@ -32,21 +32,21 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/runtime"
|
"k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
appsinformers "k8s.io/client-go/informers/apps/v1"
|
appsinformers "k8s.io/client-go/informers/apps/v1"
|
||||||
coreinformers "k8s.io/client-go/informers/core/v1"
|
coreinformers "k8s.io/client-go/informers/core/v1"
|
||||||
policyinformers "k8s.io/client-go/informers/policy/v1beta1"
|
policyinformers "k8s.io/client-go/informers/policy/v1beta1"
|
||||||
schedulinginformers "k8s.io/client-go/informers/scheduling/v1"
|
|
||||||
storageinformers "k8s.io/client-go/informers/storage/v1"
|
storageinformers "k8s.io/client-go/informers/storage/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
appslisters "k8s.io/client-go/listers/apps/v1"
|
appslisters "k8s.io/client-go/listers/apps/v1"
|
||||||
corelisters "k8s.io/client-go/listers/core/v1"
|
corelisters "k8s.io/client-go/listers/core/v1"
|
||||||
policylisters "k8s.io/client-go/listers/policy/v1beta1"
|
policylisters "k8s.io/client-go/listers/policy/v1beta1"
|
||||||
schedulinglister "k8s.io/client-go/listers/scheduling/v1"
|
|
||||||
storagelisters "k8s.io/client-go/listers/storage/v1"
|
storagelisters "k8s.io/client-go/listers/storage/v1"
|
||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
|
||||||
|
"k8s.io/kubernetes/pkg/features"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm"
|
"k8s.io/kubernetes/pkg/scheduler/algorithm"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
|
||||||
"k8s.io/kubernetes/pkg/scheduler/algorithm/priorities"
|
"k8s.io/kubernetes/pkg/scheduler/algorithm/priorities"
|
||||||
@ -187,8 +187,6 @@ type configFactory struct {
|
|||||||
storageClassLister storagelisters.StorageClassLister
|
storageClassLister storagelisters.StorageClassLister
|
||||||
// framework has a set of plugins and the context used for running them.
|
// framework has a set of plugins and the context used for running them.
|
||||||
framework framework.Framework
|
framework framework.Framework
|
||||||
// a means to list all PriorityClass
|
|
||||||
priorityClassLister schedulinglister.PriorityClassLister
|
|
||||||
|
|
||||||
// Close this to stop all reflectors
|
// Close this to stop all reflectors
|
||||||
StopEverything <-chan struct{}
|
StopEverything <-chan struct{}
|
||||||
@ -221,6 +219,8 @@ type configFactory struct {
|
|||||||
bindTimeoutSeconds int64
|
bindTimeoutSeconds int64
|
||||||
// queue for pods that need scheduling
|
// queue for pods that need scheduling
|
||||||
podQueue internalqueue.SchedulingQueue
|
podQueue internalqueue.SchedulingQueue
|
||||||
|
|
||||||
|
enableNonPreempting bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfigFactoryArgs is a set arguments passed to NewConfigFactory.
|
// ConfigFactoryArgs is a set arguments passed to NewConfigFactory.
|
||||||
@ -237,7 +237,6 @@ type ConfigFactoryArgs struct {
|
|||||||
ServiceInformer coreinformers.ServiceInformer
|
ServiceInformer coreinformers.ServiceInformer
|
||||||
PdbInformer policyinformers.PodDisruptionBudgetInformer
|
PdbInformer policyinformers.PodDisruptionBudgetInformer
|
||||||
StorageClassInformer storageinformers.StorageClassInformer
|
StorageClassInformer storageinformers.StorageClassInformer
|
||||||
PriorityClassInformer schedulinginformers.PriorityClassInformer
|
|
||||||
HardPodAffinitySymmetricWeight int32
|
HardPodAffinitySymmetricWeight int32
|
||||||
DisablePreemption bool
|
DisablePreemption bool
|
||||||
PercentageOfNodesToScore int32
|
PercentageOfNodesToScore int32
|
||||||
@ -281,7 +280,6 @@ func NewConfigFactory(args *ConfigFactoryArgs) Configurator {
|
|||||||
pdbLister: args.PdbInformer.Lister(),
|
pdbLister: args.PdbInformer.Lister(),
|
||||||
storageClassLister: storageClassLister,
|
storageClassLister: storageClassLister,
|
||||||
framework: framework,
|
framework: framework,
|
||||||
priorityClassLister: args.PriorityClassInformer.Lister(),
|
|
||||||
schedulerCache: schedulerCache,
|
schedulerCache: schedulerCache,
|
||||||
StopEverything: stopEverything,
|
StopEverything: stopEverything,
|
||||||
schedulerName: args.SchedulerName,
|
schedulerName: args.SchedulerName,
|
||||||
@ -289,6 +287,7 @@ func NewConfigFactory(args *ConfigFactoryArgs) Configurator {
|
|||||||
disablePreemption: args.DisablePreemption,
|
disablePreemption: args.DisablePreemption,
|
||||||
percentageOfNodesToScore: args.PercentageOfNodesToScore,
|
percentageOfNodesToScore: args.PercentageOfNodesToScore,
|
||||||
bindTimeoutSeconds: args.BindTimeoutSeconds,
|
bindTimeoutSeconds: args.BindTimeoutSeconds,
|
||||||
|
enableNonPreempting: utilfeature.DefaultFeatureGate.Enabled(features.NonPreemptingPriority),
|
||||||
}
|
}
|
||||||
// Setup volume binder
|
// Setup volume binder
|
||||||
c.volumeBinder = volumebinder.NewVolumeBinder(args.Client, args.NodeInformer, args.PvcInformer, args.PvInformer, args.StorageClassInformer, time.Duration(args.BindTimeoutSeconds)*time.Second)
|
c.volumeBinder = volumebinder.NewVolumeBinder(args.Client, args.NodeInformer, args.PvcInformer, args.PvInformer, args.StorageClassInformer, time.Duration(args.BindTimeoutSeconds)*time.Second)
|
||||||
@ -469,10 +468,10 @@ func (c *configFactory) CreateFromKeys(predicateKeys, priorityKeys sets.String,
|
|||||||
c.volumeBinder,
|
c.volumeBinder,
|
||||||
c.pVCLister,
|
c.pVCLister,
|
||||||
c.pdbLister,
|
c.pdbLister,
|
||||||
c.priorityClassLister,
|
|
||||||
c.alwaysCheckAllPredicates,
|
c.alwaysCheckAllPredicates,
|
||||||
c.disablePreemption,
|
c.disablePreemption,
|
||||||
c.percentageOfNodesToScore,
|
c.percentageOfNodesToScore,
|
||||||
|
c.enableNonPreempting,
|
||||||
)
|
)
|
||||||
|
|
||||||
return &Config{
|
return &Config{
|
||||||
@ -571,7 +570,6 @@ func (c *configFactory) getPluginArgs() (*PluginFactoryArgs, error) {
|
|||||||
StorageClassInfo: &predicates.CachedStorageClassInfo{StorageClassLister: c.storageClassLister},
|
StorageClassInfo: &predicates.CachedStorageClassInfo{StorageClassLister: c.storageClassLister},
|
||||||
VolumeBinder: c.volumeBinder,
|
VolumeBinder: c.volumeBinder,
|
||||||
HardPodAffinitySymmetricWeight: c.hardPodAffinitySymmetricWeight,
|
HardPodAffinitySymmetricWeight: c.hardPodAffinitySymmetricWeight,
|
||||||
PriorityLister: c.priorityClassLister,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +491,6 @@ func newConfigFactory(client clientset.Interface, hardPodAffinitySymmetricWeight
|
|||||||
informerFactory.Core().V1().Services(),
|
informerFactory.Core().V1().Services(),
|
||||||
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||||
informerFactory.Storage().V1().StorageClasses(),
|
informerFactory.Storage().V1().StorageClasses(),
|
||||||
informerFactory.Scheduling().V1().PriorityClasses(),
|
|
||||||
hardPodAffinitySymmetricWeight,
|
hardPodAffinitySymmetricWeight,
|
||||||
disablePodPreemption,
|
disablePodPreemption,
|
||||||
schedulerapi.DefaultPercentageOfNodesToScore,
|
schedulerapi.DefaultPercentageOfNodesToScore,
|
||||||
|
@ -40,7 +40,6 @@ type PluginFactoryArgs struct {
|
|||||||
ControllerLister algorithm.ControllerLister
|
ControllerLister algorithm.ControllerLister
|
||||||
ReplicaSetLister algorithm.ReplicaSetLister
|
ReplicaSetLister algorithm.ReplicaSetLister
|
||||||
StatefulSetLister algorithm.StatefulSetLister
|
StatefulSetLister algorithm.StatefulSetLister
|
||||||
PriorityLister algorithm.PriorityClassLister
|
|
||||||
NodeLister algorithm.NodeLister
|
NodeLister algorithm.NodeLister
|
||||||
PDBLister algorithm.PDBLister
|
PDBLister algorithm.PDBLister
|
||||||
NodeInfo predicates.NodeInfo
|
NodeInfo predicates.NodeInfo
|
||||||
|
@ -31,7 +31,6 @@ import (
|
|||||||
appsinformers "k8s.io/client-go/informers/apps/v1"
|
appsinformers "k8s.io/client-go/informers/apps/v1"
|
||||||
coreinformers "k8s.io/client-go/informers/core/v1"
|
coreinformers "k8s.io/client-go/informers/core/v1"
|
||||||
policyinformers "k8s.io/client-go/informers/policy/v1beta1"
|
policyinformers "k8s.io/client-go/informers/policy/v1beta1"
|
||||||
schedulinginformers "k8s.io/client-go/informers/scheduling/v1"
|
|
||||||
storageinformers "k8s.io/client-go/informers/storage/v1"
|
storageinformers "k8s.io/client-go/informers/storage/v1"
|
||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
@ -130,7 +129,6 @@ func New(client clientset.Interface,
|
|||||||
serviceInformer coreinformers.ServiceInformer,
|
serviceInformer coreinformers.ServiceInformer,
|
||||||
pdbInformer policyinformers.PodDisruptionBudgetInformer,
|
pdbInformer policyinformers.PodDisruptionBudgetInformer,
|
||||||
storageClassInformer storageinformers.StorageClassInformer,
|
storageClassInformer storageinformers.StorageClassInformer,
|
||||||
priorityClassInformer schedulinginformers.PriorityClassInformer,
|
|
||||||
recorder record.EventRecorder,
|
recorder record.EventRecorder,
|
||||||
schedulerAlgorithmSource kubeschedulerconfig.SchedulerAlgorithmSource,
|
schedulerAlgorithmSource kubeschedulerconfig.SchedulerAlgorithmSource,
|
||||||
stopCh <-chan struct{},
|
stopCh <-chan struct{},
|
||||||
@ -157,7 +155,6 @@ func New(client clientset.Interface,
|
|||||||
ServiceInformer: serviceInformer,
|
ServiceInformer: serviceInformer,
|
||||||
PdbInformer: pdbInformer,
|
PdbInformer: pdbInformer,
|
||||||
StorageClassInformer: storageClassInformer,
|
StorageClassInformer: storageClassInformer,
|
||||||
PriorityClassInformer: priorityClassInformer,
|
|
||||||
HardPodAffinitySymmetricWeight: options.hardPodAffinitySymmetricWeight,
|
HardPodAffinitySymmetricWeight: options.hardPodAffinitySymmetricWeight,
|
||||||
DisablePreemption: options.disablePreemption,
|
DisablePreemption: options.disablePreemption,
|
||||||
PercentageOfNodesToScore: options.percentageOfNodesToScore,
|
PercentageOfNodesToScore: options.percentageOfNodesToScore,
|
||||||
|
@ -103,7 +103,6 @@ func (n *nodeLister) List() ([]*v1.Node, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func podWithID(id, desiredHost string) *v1.Pod {
|
func podWithID(id, desiredHost string) *v1.Pod {
|
||||||
Preempting := true
|
|
||||||
return &v1.Pod{
|
return &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: id,
|
Name: id,
|
||||||
@ -112,7 +111,6 @@ func podWithID(id, desiredHost string) *v1.Pod {
|
|||||||
},
|
},
|
||||||
Spec: v1.PodSpec{
|
Spec: v1.PodSpec{
|
||||||
NodeName: desiredHost,
|
NodeName: desiredHost,
|
||||||
Preempting: &Preempting,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +200,6 @@ func TestSchedulerCreation(t *testing.T) {
|
|||||||
informerFactory.Core().V1().Services(),
|
informerFactory.Core().V1().Services(),
|
||||||
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||||
informerFactory.Storage().V1().StorageClasses(),
|
informerFactory.Storage().V1().StorageClasses(),
|
||||||
informerFactory.Scheduling().V1().PriorityClasses(),
|
|
||||||
eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "scheduler"}),
|
eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "scheduler"}),
|
||||||
kubeschedulerconfig.SchedulerAlgorithmSource{Provider: &testSource},
|
kubeschedulerconfig.SchedulerAlgorithmSource{Provider: &testSource},
|
||||||
stopCh,
|
stopCh,
|
||||||
@ -661,10 +658,10 @@ func setupTestScheduler(queuedPodStore *clientcache.FIFO, scache internalcache.C
|
|||||||
nil,
|
nil,
|
||||||
informerFactory.Core().V1().PersistentVolumeClaims().Lister(),
|
informerFactory.Core().V1().PersistentVolumeClaims().Lister(),
|
||||||
informerFactory.Policy().V1beta1().PodDisruptionBudgets().Lister(),
|
informerFactory.Policy().V1beta1().PodDisruptionBudgets().Lister(),
|
||||||
informerFactory.Scheduling().V1().PriorityClasses().Lister(),
|
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
schedulerapi.DefaultPercentageOfNodesToScore,
|
schedulerapi.DefaultPercentageOfNodesToScore,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
bindingChan := make(chan *v1.Binding, 1)
|
bindingChan := make(chan *v1.Binding, 1)
|
||||||
errChan := make(chan error, 1)
|
errChan := make(chan error, 1)
|
||||||
@ -715,10 +712,10 @@ func setupTestSchedulerLongBindingWithRetry(queuedPodStore *clientcache.FIFO, sc
|
|||||||
nil,
|
nil,
|
||||||
informerFactory.Core().V1().PersistentVolumeClaims().Lister(),
|
informerFactory.Core().V1().PersistentVolumeClaims().Lister(),
|
||||||
informerFactory.Policy().V1beta1().PodDisruptionBudgets().Lister(),
|
informerFactory.Policy().V1beta1().PodDisruptionBudgets().Lister(),
|
||||||
informerFactory.Scheduling().V1().PriorityClasses().Lister(),
|
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
schedulerapi.DefaultPercentageOfNodesToScore,
|
schedulerapi.DefaultPercentageOfNodesToScore,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
bindingChan := make(chan *v1.Binding, 2)
|
bindingChan := make(chan *v1.Binding, 2)
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ go_library(
|
|||||||
"//staging/src/k8s.io/api/apps/v1:go_default_library",
|
"//staging/src/k8s.io/api/apps/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
|
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||||
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
|
||||||
|
@ -22,7 +22,6 @@ import (
|
|||||||
apps "k8s.io/api/apps/v1"
|
apps "k8s.io/api/apps/v1"
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
policy "k8s.io/api/policy/v1beta1"
|
policy "k8s.io/api/policy/v1beta1"
|
||||||
schedulingv1 "k8s.io/api/scheduling/v1"
|
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/labels"
|
"k8s.io/apimachinery/pkg/labels"
|
||||||
corelisters "k8s.io/client-go/listers/core/v1"
|
corelisters "k8s.io/client-go/listers/core/v1"
|
||||||
@ -223,12 +222,3 @@ type FakePDBLister []*policy.PodDisruptionBudget
|
|||||||
func (f FakePDBLister) List(labels.Selector) ([]*policy.PodDisruptionBudget, error) {
|
func (f FakePDBLister) List(labels.Selector) ([]*policy.PodDisruptionBudget, error) {
|
||||||
return f, nil
|
return f, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FakePriorityClassLister implements PriorityClassLister on a slice of Priority for test purposes.
|
|
||||||
type FakePriorityClassLister schedulingv1.PriorityClass
|
|
||||||
|
|
||||||
// Get returns a PriorityClass by name.
|
|
||||||
func (f FakePriorityClassLister) Get(name string) (*schedulingv1.PriorityClass, error) {
|
|
||||||
pc := schedulingv1.PriorityClass(f)
|
|
||||||
return &pc, nil
|
|
||||||
}
|
|
||||||
|
@ -37,6 +37,7 @@ go_library(
|
|||||||
"//pkg/apis/scheduling:go_default_library",
|
"//pkg/apis/scheduling:go_default_library",
|
||||||
"//pkg/features:go_default_library",
|
"//pkg/features:go_default_library",
|
||||||
"//pkg/kubelet/types:go_default_library",
|
"//pkg/kubelet/types:go_default_library",
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
|
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
schedulingv1 "k8s.io/api/scheduling/v1"
|
schedulingv1 "k8s.io/api/scheduling/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/errors"
|
"k8s.io/apimachinery/pkg/api/errors"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
@ -30,6 +31,7 @@ import (
|
|||||||
"k8s.io/client-go/informers"
|
"k8s.io/client-go/informers"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
schedulingv1listers "k8s.io/client-go/listers/scheduling/v1"
|
schedulingv1listers "k8s.io/client-go/listers/scheduling/v1"
|
||||||
|
"k8s.io/kubernetes/pkg/apis/core"
|
||||||
api "k8s.io/kubernetes/pkg/apis/core"
|
api "k8s.io/kubernetes/pkg/apis/core"
|
||||||
"k8s.io/kubernetes/pkg/apis/scheduling"
|
"k8s.io/kubernetes/pkg/apis/scheduling"
|
||||||
"k8s.io/kubernetes/pkg/features"
|
"k8s.io/kubernetes/pkg/features"
|
||||||
@ -179,7 +181,7 @@ func (p *priorityPlugin) admitPod(a admission.Attributes) error {
|
|||||||
|
|
||||||
if operation == admission.Create {
|
if operation == admission.Create {
|
||||||
var priority int32
|
var priority int32
|
||||||
var preempting *bool
|
var preemptionPolicy *apiv1.PreemptionPolicy
|
||||||
// TODO: @ravig - This is for backwards compatibility to ensure that critical pods with annotations just work fine.
|
// TODO: @ravig - This is for backwards compatibility to ensure that critical pods with annotations just work fine.
|
||||||
// Remove when no longer needed.
|
// Remove when no longer needed.
|
||||||
if len(pod.Spec.PriorityClassName) == 0 &&
|
if len(pod.Spec.PriorityClassName) == 0 &&
|
||||||
@ -190,7 +192,7 @@ func (p *priorityPlugin) admitPod(a admission.Attributes) error {
|
|||||||
if len(pod.Spec.PriorityClassName) == 0 {
|
if len(pod.Spec.PriorityClassName) == 0 {
|
||||||
var err error
|
var err error
|
||||||
var pcName string
|
var pcName string
|
||||||
pcName, priority, preempting, err = p.getDefaultPriority()
|
pcName, priority, preemptionPolicy, err = p.getDefaultPriority()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get default priority class: %v", err)
|
return fmt.Errorf("failed to get default priority class: %v", err)
|
||||||
}
|
}
|
||||||
@ -212,14 +214,24 @@ func (p *priorityPlugin) admitPod(a admission.Attributes) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
priority = pc.Value
|
priority = pc.Value
|
||||||
preempting = pc.Preempting
|
preemptionPolicy = pc.PreemptionPolicy
|
||||||
}
|
}
|
||||||
// if the pod contained a priority that differs from the one computed from the priority class, error
|
// if the pod contained a priority that differs from the one computed from the priority class, error
|
||||||
if pod.Spec.Priority != nil && *pod.Spec.Priority != priority {
|
if pod.Spec.Priority != nil && *pod.Spec.Priority != priority {
|
||||||
return admission.NewForbidden(a, fmt.Errorf("the integer value of priority (%d) must not be provided in pod spec; priority admission controller computed %d from the given PriorityClass name", *pod.Spec.Priority, priority))
|
return admission.NewForbidden(a, fmt.Errorf("the integer value of priority (%d) must not be provided in pod spec; priority admission controller computed %d from the given PriorityClass name", *pod.Spec.Priority, priority))
|
||||||
}
|
}
|
||||||
pod.Spec.Priority = &priority
|
pod.Spec.Priority = &priority
|
||||||
pod.Spec.Preempting = preempting
|
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.NonPreemptingPriority) {
|
||||||
|
var corePolicy core.PreemptionPolicy
|
||||||
|
if preemptionPolicy != nil {
|
||||||
|
corePolicy = core.PreemptionPolicy(*preemptionPolicy)
|
||||||
|
if pod.Spec.PreemptionPolicy != nil && *pod.Spec.PreemptionPolicy != corePolicy {
|
||||||
|
return admission.NewForbidden(a, fmt.Errorf("the string value of PreemptionPolicy (%s) must not be provided in pod spec; priority admission controller computed %s from the given PriorityClass name", *pod.Spec.PreemptionPolicy, corePolicy))
|
||||||
|
}
|
||||||
|
pod.Spec.PreemptionPolicy = &corePolicy
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -265,15 +277,14 @@ func (p *priorityPlugin) getDefaultPriorityClass() (*schedulingv1.PriorityClass,
|
|||||||
return defaultPC, nil
|
return defaultPC, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *priorityPlugin) getDefaultPriority() (string, int32, *bool, error) {
|
func (p *priorityPlugin) getDefaultPriority() (string, int32, *apiv1.PreemptionPolicy, error) {
|
||||||
dpc, err := p.getDefaultPriorityClass()
|
dpc, err := p.getDefaultPriorityClass()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", 0, nil, err
|
return "", 0, nil, err
|
||||||
}
|
}
|
||||||
if dpc != nil {
|
if dpc != nil {
|
||||||
return dpc.Name, dpc.Value, dpc.Preempting, nil
|
return dpc.Name, dpc.Value, dpc.PreemptionPolicy, nil
|
||||||
}
|
}
|
||||||
preempting := true
|
preemptLowerPriority := apiv1.PreemptLowerPriority
|
||||||
|
return "", int32(scheduling.DefaultPriorityWhenNoDefaultClassExists), &preemptLowerPriority, nil
|
||||||
return "", int32(scheduling.DefaultPriorityWhenNoDefaultClassExists), &preempting, nil
|
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,11 @@ func addPriorityClasses(ctrl *priorityPlugin, priorityClasses []*scheduling.Prio
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
preemptNever = api.PreemptNever
|
||||||
|
preemptLowerPriority = api.PreemptLowerPriority
|
||||||
|
)
|
||||||
|
|
||||||
var defaultClass1 = &scheduling.PriorityClass{
|
var defaultClass1 = &scheduling.PriorityClass{
|
||||||
TypeMeta: metav1.TypeMeta{
|
TypeMeta: metav1.TypeMeta{
|
||||||
Kind: "PriorityClass",
|
Kind: "PriorityClass",
|
||||||
@ -94,6 +99,32 @@ var systemClusterCritical = &scheduling.PriorityClass{
|
|||||||
GlobalDefault: true,
|
GlobalDefault: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var neverPreemptionPolicyClass = &scheduling.PriorityClass{
|
||||||
|
TypeMeta: metav1.TypeMeta{
|
||||||
|
Kind: "PriorityClass",
|
||||||
|
},
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "nopreemptionpolicy",
|
||||||
|
},
|
||||||
|
Value: 2000,
|
||||||
|
Description: "Just a test priority class",
|
||||||
|
GlobalDefault: true,
|
||||||
|
PreemptionPolicy: &preemptNever,
|
||||||
|
}
|
||||||
|
|
||||||
|
var preemptionPolicyClass = &scheduling.PriorityClass{
|
||||||
|
TypeMeta: metav1.TypeMeta{
|
||||||
|
Kind: "PriorityClass",
|
||||||
|
},
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "nopreemptionpolicy",
|
||||||
|
},
|
||||||
|
Value: 2000,
|
||||||
|
Description: "Just a test priority class",
|
||||||
|
GlobalDefault: true,
|
||||||
|
PreemptionPolicy: &preemptLowerPriority,
|
||||||
|
}
|
||||||
|
|
||||||
func TestPriorityClassAdmission(t *testing.T) {
|
func TestPriorityClassAdmission(t *testing.T) {
|
||||||
var systemClass = &scheduling.PriorityClass{
|
var systemClass = &scheduling.PriorityClass{
|
||||||
TypeMeta: metav1.TypeMeta{
|
TypeMeta: metav1.TypeMeta{
|
||||||
@ -468,11 +499,64 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
Priority: &systemClusterCritical.Value,
|
Priority: &systemClusterCritical.Value,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// pod[12]: Pod without a preemption policy that matches the resolved preemption policy
|
||||||
|
{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "pod-never-preemption-policy-matching-resolved-preemption-policy",
|
||||||
|
Namespace: metav1.NamespaceSystem,
|
||||||
|
},
|
||||||
|
Spec: api.PodSpec{
|
||||||
|
Containers: []api.Container{
|
||||||
|
{
|
||||||
|
Name: containerName,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PriorityClassName: neverPreemptionPolicyClass.Name,
|
||||||
|
Priority: &neverPreemptionPolicyClass.Value,
|
||||||
|
PreemptionPolicy: nil,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// pod[13]: Pod with a preemption policy that matches the resolved preemption policy
|
||||||
|
{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "pod-preemption-policy-matching-resolved-preemption-policy",
|
||||||
|
Namespace: metav1.NamespaceSystem,
|
||||||
|
},
|
||||||
|
Spec: api.PodSpec{
|
||||||
|
Containers: []api.Container{
|
||||||
|
{
|
||||||
|
Name: containerName,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PriorityClassName: preemptionPolicyClass.Name,
|
||||||
|
Priority: &preemptionPolicyClass.Value,
|
||||||
|
PreemptionPolicy: &preemptLowerPriority,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// pod[14]: Pod with a preemption policy that does't match the resolved preemption policy
|
||||||
|
{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "pod-preemption-policy-not-matching-resolved-preemption-policy",
|
||||||
|
Namespace: metav1.NamespaceSystem,
|
||||||
|
},
|
||||||
|
Spec: api.PodSpec{
|
||||||
|
Containers: []api.Container{
|
||||||
|
{
|
||||||
|
Name: containerName,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PriorityClassName: preemptionPolicyClass.Name,
|
||||||
|
Priority: &preemptionPolicyClass.Value,
|
||||||
|
PreemptionPolicy: &preemptNever,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
// Enable PodPriority feature gate.
|
// Enable PodPriority feature gate.
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PodPriority, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PodPriority, true)()
|
||||||
// Enable ExperimentalCriticalPodAnnotation feature gate.
|
// Enable ExperimentalCriticalPodAnnotation feature gate.
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ExperimentalCriticalPodAnnotation, true)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ExperimentalCriticalPodAnnotation, true)()
|
||||||
|
// Enable NonPreemptingPriority feature gate.
|
||||||
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.NonPreemptingPriority, true)()
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
existingClasses []*scheduling.PriorityClass
|
existingClasses []*scheduling.PriorityClass
|
||||||
@ -481,6 +565,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
pod api.Pod
|
pod api.Pod
|
||||||
expectedPriority int32
|
expectedPriority int32
|
||||||
expectError bool
|
expectError bool
|
||||||
|
expectPreemptionPolicy *api.PreemptionPolicy
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
"Pod with priority class",
|
"Pod with priority class",
|
||||||
@ -488,6 +573,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[0],
|
*pods[0],
|
||||||
1000,
|
1000,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -496,6 +582,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[1],
|
*pods[1],
|
||||||
1000,
|
1000,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pod without priority class and no existing priority class",
|
"pod without priority class and no existing priority class",
|
||||||
@ -503,6 +590,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[1],
|
*pods[1],
|
||||||
scheduling.DefaultPriorityWhenNoDefaultClassExists,
|
scheduling.DefaultPriorityWhenNoDefaultClassExists,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pod without priority class and no default class",
|
"pod without priority class and no default class",
|
||||||
@ -510,6 +598,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[1],
|
*pods[1],
|
||||||
scheduling.DefaultPriorityWhenNoDefaultClassExists,
|
scheduling.DefaultPriorityWhenNoDefaultClassExists,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pod with a system priority class",
|
"pod with a system priority class",
|
||||||
@ -517,6 +606,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[4],
|
*pods[4],
|
||||||
scheduling.SystemCriticalPriority,
|
scheduling.SystemCriticalPriority,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Pod with non-existing priority class",
|
"Pod with non-existing priority class",
|
||||||
@ -524,6 +614,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[2],
|
*pods[2],
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pod with integer priority",
|
"pod with integer priority",
|
||||||
@ -531,6 +622,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[3],
|
*pods[3],
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mirror pod with system priority class",
|
"mirror pod with system priority class",
|
||||||
@ -538,6 +630,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[5],
|
*pods[5],
|
||||||
scheduling.SystemCriticalPriority,
|
scheduling.SystemCriticalPriority,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mirror pod with integer priority",
|
"mirror pod with integer priority",
|
||||||
@ -545,6 +638,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[6],
|
*pods[6],
|
||||||
0,
|
0,
|
||||||
true,
|
true,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pod with critical pod annotation",
|
"pod with critical pod annotation",
|
||||||
@ -552,6 +646,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[7],
|
*pods[7],
|
||||||
scheduling.SystemCriticalPriority,
|
scheduling.SystemCriticalPriority,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pod with system critical priority in non-system namespace",
|
"pod with system critical priority in non-system namespace",
|
||||||
@ -559,6 +654,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[8],
|
*pods[8],
|
||||||
scheduling.SystemCriticalPriority,
|
scheduling.SystemCriticalPriority,
|
||||||
true,
|
true,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pod with priority that matches computed priority",
|
"pod with priority that matches computed priority",
|
||||||
@ -566,6 +662,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[9],
|
*pods[9],
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pod with priority that matches default priority",
|
"pod with priority that matches default priority",
|
||||||
@ -573,6 +670,7 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[10],
|
*pods[10],
|
||||||
defaultClass2.Value,
|
defaultClass2.Value,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"pod with priority that matches resolved priority",
|
"pod with priority that matches resolved priority",
|
||||||
@ -580,6 +678,31 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
*pods[11],
|
*pods[11],
|
||||||
systemClusterCritical.Value,
|
systemClusterCritical.Value,
|
||||||
false,
|
false,
|
||||||
|
nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pod with nil preemtpion policy",
|
||||||
|
[]*scheduling.PriorityClass{preemptionPolicyClass},
|
||||||
|
*pods[12],
|
||||||
|
preemptionPolicyClass.Value,
|
||||||
|
false,
|
||||||
|
nil,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pod with preemtpion policy that matches resolved preemtpion policy",
|
||||||
|
[]*scheduling.PriorityClass{preemptionPolicyClass},
|
||||||
|
*pods[13],
|
||||||
|
preemptionPolicyClass.Value,
|
||||||
|
false,
|
||||||
|
&preemptLowerPriority,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pod with preemtpion policy that does't matches resolved preemtpion policy",
|
||||||
|
[]*scheduling.PriorityClass{preemptionPolicyClass},
|
||||||
|
*pods[14],
|
||||||
|
preemptionPolicyClass.Value,
|
||||||
|
true,
|
||||||
|
&preemptLowerPriority,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,6 +736,8 @@ func TestPodAdmission(t *testing.T) {
|
|||||||
t.Errorf("Test %q: unexpected error received: %v", test.name, err)
|
t.Errorf("Test %q: unexpected error received: %v", test.name, err)
|
||||||
} else if *test.pod.Spec.Priority != test.expectedPriority {
|
} else if *test.pod.Spec.Priority != test.expectedPriority {
|
||||||
t.Errorf("Test %q: expected priority is %d, but got %d.", test.name, test.expectedPriority, *test.pod.Spec.Priority)
|
t.Errorf("Test %q: expected priority is %d, but got %d.", test.name, test.expectedPriority, *test.pod.Spec.Priority)
|
||||||
|
} else if test.pod.Spec.PreemptionPolicy != nil && test.expectPreemptionPolicy != nil && *test.pod.Spec.PreemptionPolicy != *test.expectPreemptionPolicy {
|
||||||
|
t.Errorf("Test %q: expected preemption policy is %s, but got %s.", test.name, *test.expectPreemptionPolicy, *test.pod.Spec.PreemptionPolicy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err == nil && test.expectError {
|
if err == nil && test.expectError {
|
||||||
|
@ -48,7 +48,6 @@ const (
|
|||||||
extensionsGroup = "extensions"
|
extensionsGroup = "extensions"
|
||||||
policyGroup = "policy"
|
policyGroup = "policy"
|
||||||
rbacGroup = "rbac.authorization.k8s.io"
|
rbacGroup = "rbac.authorization.k8s.io"
|
||||||
schedulingGroup = "scheduling.k8s.io"
|
|
||||||
storageGroup = "storage.k8s.io"
|
storageGroup = "storage.k8s.io"
|
||||||
resMetricsGroup = "metrics.k8s.io"
|
resMetricsGroup = "metrics.k8s.io"
|
||||||
customMetricsGroup = "custom.metrics.k8s.io"
|
customMetricsGroup = "custom.metrics.k8s.io"
|
||||||
@ -443,7 +442,6 @@ func ClusterRoles() []rbacv1.ClusterRole {
|
|||||||
// Needed to check API access. These creates are non-mutating
|
// Needed to check API access. These creates are non-mutating
|
||||||
rbacv1helpers.NewRule("create").Groups(authenticationGroup).Resources("tokenreviews").RuleOrDie(),
|
rbacv1helpers.NewRule("create").Groups(authenticationGroup).Resources("tokenreviews").RuleOrDie(),
|
||||||
rbacv1helpers.NewRule("create").Groups(authorizationGroup).Resources("subjectaccessreviews").RuleOrDie(),
|
rbacv1helpers.NewRule("create").Groups(authorizationGroup).Resources("subjectaccessreviews").RuleOrDie(),
|
||||||
rbacv1helpers.NewRule(Read...).Groups(schedulingGroup).Resources("priorityclasses").RuleOrDie(),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -801,14 +801,6 @@ items:
|
|||||||
- subjectaccessreviews
|
- subjectaccessreviews
|
||||||
verbs:
|
verbs:
|
||||||
- create
|
- create
|
||||||
- apiGroups:
|
|
||||||
- scheduling.k8s.io
|
|
||||||
resources:
|
|
||||||
- priorityclasses
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiVersion: rbac.authorization.k8s.io/v1
|
- apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRole
|
kind: ClusterRole
|
||||||
metadata:
|
metadata:
|
||||||
|
1677
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
1677
staging/src/k8s.io/api/core/v1/generated.pb.go
generated
File diff suppressed because it is too large
Load Diff
@ -3181,11 +3181,6 @@ message PodSpec {
|
|||||||
// +optional
|
// +optional
|
||||||
optional int32 priority = 25;
|
optional int32 priority = 25;
|
||||||
|
|
||||||
// Preempting specifies whether a pod with this PriorityClass could start a preemption process.
|
|
||||||
// If this field is missing, the PriorityClass is considered a Preempting class by default.
|
|
||||||
// +optional
|
|
||||||
optional bool preempting = 31;
|
|
||||||
|
|
||||||
// Specifies the DNS parameters of a pod.
|
// Specifies the DNS parameters of a pod.
|
||||||
// Parameters specified here will be merged to the generated DNS
|
// Parameters specified here will be merged to the generated DNS
|
||||||
// configuration based on DNSPolicy.
|
// configuration based on DNSPolicy.
|
||||||
@ -3213,6 +3208,13 @@ message PodSpec {
|
|||||||
// Optional: Defaults to true.
|
// Optional: Defaults to true.
|
||||||
// +optional
|
// +optional
|
||||||
optional bool enableServiceLinks = 30;
|
optional bool enableServiceLinks = 30;
|
||||||
|
|
||||||
|
// PreemptionPolicy is the Policy for preempting pods with lower priority.
|
||||||
|
// One of Never, PreemptLowerPriority.
|
||||||
|
// Defaults to PreemptLowerPriority if unset.
|
||||||
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
|
// +optional
|
||||||
|
optional string preemptionPolicy = 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PodStatus represents information about the status of a pod. Status may trail the actual
|
// PodStatus represents information about the status of a pod. Status may trail the actual
|
||||||
|
@ -2046,6 +2046,16 @@ const (
|
|||||||
PullIfNotPresent PullPolicy = "IfNotPresent"
|
PullIfNotPresent PullPolicy = "IfNotPresent"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// PreemptionPolicy describes a policy for if/when to preempt a pod.
|
||||||
|
type PreemptionPolicy string
|
||||||
|
|
||||||
|
const (
|
||||||
|
// PreemptLowerPriority means that pod can preempt other pods with lower priority.
|
||||||
|
PreemptLowerPriority PreemptionPolicy = "PreemptLowerPriority"
|
||||||
|
// PreemptNever means that pod never preempts other pods with lower priority.
|
||||||
|
PreemptNever PreemptionPolicy = "Never"
|
||||||
|
)
|
||||||
|
|
||||||
// TerminationMessagePolicy describes how termination messages are retrieved from a container.
|
// TerminationMessagePolicy describes how termination messages are retrieved from a container.
|
||||||
type TerminationMessagePolicy string
|
type TerminationMessagePolicy string
|
||||||
|
|
||||||
@ -2961,16 +2971,11 @@ type PodSpec struct {
|
|||||||
// The higher the value, the higher the priority.
|
// The higher the value, the higher the priority.
|
||||||
// +optional
|
// +optional
|
||||||
Priority *int32 `json:"priority,omitempty" protobuf:"bytes,25,opt,name=priority"`
|
Priority *int32 `json:"priority,omitempty" protobuf:"bytes,25,opt,name=priority"`
|
||||||
// Preempting specifies whether a pod with this PriorityClass could start a preemption process.
|
|
||||||
// If this field is missing, the PriorityClass is considered a Preempting class by default.
|
|
||||||
// +optional
|
|
||||||
Preempting *bool `json:"preempting,omitempty" protobuf:"bytes,31,opt,name=preempting"`
|
|
||||||
// Specifies the DNS parameters of a pod.
|
// Specifies the DNS parameters of a pod.
|
||||||
// Parameters specified here will be merged to the generated DNS
|
// Parameters specified here will be merged to the generated DNS
|
||||||
// configuration based on DNSPolicy.
|
// configuration based on DNSPolicy.
|
||||||
// +optional
|
// +optional
|
||||||
DNSConfig *PodDNSConfig `json:"dnsConfig,omitempty" protobuf:"bytes,26,opt,name=dnsConfig"`
|
DNSConfig *PodDNSConfig `json:"dnsConfig,omitempty" protobuf:"bytes,26,opt,name=dnsConfig"`
|
||||||
|
|
||||||
// If specified, all readiness gates will be evaluated for pod readiness.
|
// If specified, all readiness gates will be evaluated for pod readiness.
|
||||||
// A pod is ready when all its containers are ready AND
|
// A pod is ready when all its containers are ready AND
|
||||||
// all conditions specified in the readiness gates have status equal to "True"
|
// all conditions specified in the readiness gates have status equal to "True"
|
||||||
@ -2990,14 +2995,17 @@ type PodSpec struct {
|
|||||||
// Optional: Defaults to true.
|
// Optional: Defaults to true.
|
||||||
// +optional
|
// +optional
|
||||||
EnableServiceLinks *bool `json:"enableServiceLinks,omitempty" protobuf:"varint,30,opt,name=enableServiceLinks"`
|
EnableServiceLinks *bool `json:"enableServiceLinks,omitempty" protobuf:"varint,30,opt,name=enableServiceLinks"`
|
||||||
|
// PreemptionPolicy is the Policy for preempting pods with lower priority.
|
||||||
|
// One of Never, PreemptLowerPriority.
|
||||||
|
// Defaults to PreemptLowerPriority if unset.
|
||||||
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
|
// +optional
|
||||||
|
PreemptionPolicy *PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,31,opt,name=preemptionPolicy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// The default value for enableServiceLinks attribute.
|
// The default value for enableServiceLinks attribute.
|
||||||
DefaultEnableServiceLinks = true
|
DefaultEnableServiceLinks = true
|
||||||
|
|
||||||
// The default value for preempting attribute.
|
|
||||||
DefaultPreempting = true
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
|
// HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the
|
||||||
|
@ -1552,11 +1552,11 @@ var map_PodSpec = map[string]string{
|
|||||||
"hostAliases": "HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods.",
|
"hostAliases": "HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods.",
|
||||||
"priorityClassName": "If specified, indicates the pod's priority. \"system-node-critical\" and \"system-cluster-critical\" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.",
|
"priorityClassName": "If specified, indicates the pod's priority. \"system-node-critical\" and \"system-cluster-critical\" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be default or zero if there is no default.",
|
||||||
"priority": "The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.",
|
"priority": "The priority value. Various system components use this field to find the priority of the pod. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority.",
|
||||||
"preempting": "Preempting specifies whether a pod with this PriorityClass could start a preemption process. If this field is missing, the PriorityClass is considered a Preempting class by default.",
|
|
||||||
"dnsConfig": "Specifies the DNS parameters of a pod. Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy.",
|
"dnsConfig": "Specifies the DNS parameters of a pod. Parameters specified here will be merged to the generated DNS configuration based on DNSPolicy.",
|
||||||
"readinessGates": "If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to \"True\" More info: https://git.k8s.io/enhancements/keps/sig-network/0007-pod-ready%2B%2B.md",
|
"readinessGates": "If specified, all readiness gates will be evaluated for pod readiness. A pod is ready when all its containers are ready AND all conditions specified in the readiness gates have status equal to \"True\" More info: https://git.k8s.io/enhancements/keps/sig-network/0007-pod-ready%2B%2B.md",
|
||||||
"runtimeClassName": "RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the \"legacy\" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md This is a beta feature as of Kubernetes v1.14.",
|
"runtimeClassName": "RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this pod. If no RuntimeClass resource matches the named class, the pod will not be run. If unset or empty, the \"legacy\" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://git.k8s.io/enhancements/keps/sig-node/runtime-class.md This is a beta feature as of Kubernetes v1.14.",
|
||||||
"enableServiceLinks": "EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.",
|
"enableServiceLinks": "EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.",
|
||||||
|
"preemptionPolicy": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (PodSpec) SwaggerDoc() map[string]string {
|
func (PodSpec) SwaggerDoc() map[string]string {
|
||||||
|
@ -3608,11 +3608,6 @@ func (in *PodSpec) DeepCopyInto(out *PodSpec) {
|
|||||||
*out = new(int32)
|
*out = new(int32)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
if in.Preempting != nil {
|
|
||||||
in, out := &in.Preempting, &out.Preempting
|
|
||||||
*out = new(bool)
|
|
||||||
**out = **in
|
|
||||||
}
|
|
||||||
if in.DNSConfig != nil {
|
if in.DNSConfig != nil {
|
||||||
in, out := &in.DNSConfig, &out.DNSConfig
|
in, out := &in.DNSConfig, &out.DNSConfig
|
||||||
*out = new(PodDNSConfig)
|
*out = new(PodDNSConfig)
|
||||||
@ -3633,6 +3628,11 @@ func (in *PodSpec) DeepCopyInto(out *PodSpec) {
|
|||||||
*out = new(bool)
|
*out = new(bool)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
|
if in.PreemptionPolicy != nil {
|
||||||
|
in, out := &in.PreemptionPolicy, &out.PreemptionPolicy
|
||||||
|
*out = new(PreemptionPolicy)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ go_library(
|
|||||||
importpath = "k8s.io/api/scheduling/v1",
|
importpath = "k8s.io/api/scheduling/v1",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
104
staging/src/k8s.io/api/scheduling/v1/generated.pb.go
generated
104
staging/src/k8s.io/api/scheduling/v1/generated.pb.go
generated
@ -33,6 +33,8 @@ import proto "github.com/gogo/protobuf/proto"
|
|||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
import math "math"
|
import math "math"
|
||||||
|
|
||||||
|
import k8s_io_api_core_v1 "k8s.io/api/core/v1"
|
||||||
|
|
||||||
import strings "strings"
|
import strings "strings"
|
||||||
import reflect "reflect"
|
import reflect "reflect"
|
||||||
|
|
||||||
@ -99,15 +101,11 @@ func (m *PriorityClass) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
i++
|
i++
|
||||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description)))
|
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description)))
|
||||||
i += copy(dAtA[i:], m.Description)
|
i += copy(dAtA[i:], m.Description)
|
||||||
if m.Preempting != nil {
|
if m.PreemptionPolicy != nil {
|
||||||
dAtA[i] = 0x28
|
dAtA[i] = 0x2a
|
||||||
i++
|
|
||||||
if *m.Preempting {
|
|
||||||
dAtA[i] = 1
|
|
||||||
} else {
|
|
||||||
dAtA[i] = 0
|
|
||||||
}
|
|
||||||
i++
|
i++
|
||||||
|
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy)))
|
||||||
|
i += copy(dAtA[i:], *m.PreemptionPolicy)
|
||||||
}
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
@ -168,8 +166,9 @@ func (m *PriorityClass) Size() (n int) {
|
|||||||
n += 2
|
n += 2
|
||||||
l = len(m.Description)
|
l = len(m.Description)
|
||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
if m.Preempting != nil {
|
if m.PreemptionPolicy != nil {
|
||||||
n += 2
|
l = len(*m.PreemptionPolicy)
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
}
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
@ -210,7 +209,7 @@ func (this *PriorityClass) String() string {
|
|||||||
`Value:` + fmt.Sprintf("%v", this.Value) + `,`,
|
`Value:` + fmt.Sprintf("%v", this.Value) + `,`,
|
||||||
`GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`,
|
`GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`,
|
||||||
`Description:` + fmt.Sprintf("%v", this.Description) + `,`,
|
`Description:` + fmt.Sprintf("%v", this.Description) + `,`,
|
||||||
`Preempting:` + valueToStringGenerated(this.Preempting) + `,`,
|
`PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@ -362,10 +361,10 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error {
|
|||||||
m.Description = string(dAtA[iNdEx:postIndex])
|
m.Description = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
case 5:
|
case 5:
|
||||||
if wireType != 0 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Preempting", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType)
|
||||||
}
|
}
|
||||||
var v int
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
if shift >= 64 {
|
if shift >= 64 {
|
||||||
return ErrIntOverflowGenerated
|
return ErrIntOverflowGenerated
|
||||||
@ -375,13 +374,22 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
b := dAtA[iNdEx]
|
b := dAtA[iNdEx]
|
||||||
iNdEx++
|
iNdEx++
|
||||||
v |= (int(b) & 0x7F) << shift
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
if b < 0x80 {
|
if b < 0x80 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b := bool(v != 0)
|
intStringLen := int(stringLen)
|
||||||
m.Preempting = &b
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
s := k8s_io_api_core_v1.PreemptionPolicy(dAtA[iNdEx:postIndex])
|
||||||
|
m.PreemptionPolicy = &s
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
@ -624,34 +632,36 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptorGenerated = []byte{
|
var fileDescriptorGenerated = []byte{
|
||||||
// 464 bytes of a gzipped FileDescriptorProto
|
// 488 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x3f, 0x6f, 0xd3, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x3f, 0x8f, 0xd3, 0x30,
|
||||||
0x18, 0xc6, 0x73, 0x29, 0x96, 0xc2, 0x45, 0x41, 0x60, 0x84, 0x64, 0x65, 0x70, 0xad, 0x32, 0xe0,
|
0x18, 0xc6, 0xeb, 0x1e, 0x95, 0x0e, 0x57, 0x95, 0x4a, 0x10, 0x52, 0xd4, 0x21, 0xad, 0x7a, 0x03,
|
||||||
0x85, 0x3b, 0x52, 0x01, 0x42, 0x62, 0xc2, 0x54, 0x42, 0x48, 0x45, 0x54, 0x1e, 0x18, 0x10, 0x03,
|
0x59, 0xb0, 0xe9, 0x09, 0x10, 0xd2, 0x4d, 0x84, 0x93, 0x10, 0xd2, 0x21, 0xaa, 0x0c, 0x0c, 0x88,
|
||||||
0x67, 0xfb, 0xad, 0x73, 0xc4, 0xf6, 0x59, 0x77, 0x67, 0x4b, 0xdd, 0xf8, 0x08, 0x7c, 0x1e, 0x16,
|
0x01, 0x27, 0x79, 0x2f, 0x35, 0x4d, 0xe2, 0xc8, 0x76, 0x22, 0x75, 0xe3, 0x23, 0xf0, 0x8d, 0x58,
|
||||||
0xd6, 0x8c, 0x1d, 0x3b, 0x55, 0xc4, 0x7c, 0x11, 0x74, 0x8e, 0x89, 0x13, 0x4a, 0x45, 0x37, 0xdf,
|
0x3b, 0xde, 0x78, 0x53, 0x45, 0xc3, 0x47, 0x60, 0x63, 0x42, 0x49, 0xc3, 0xa5, 0x7f, 0xee, 0x04,
|
||||||
0xf3, 0x3e, 0xbf, 0xf7, 0xcf, 0x23, 0xe3, 0x57, 0x8b, 0x17, 0x8a, 0x70, 0x41, 0x17, 0x55, 0x04,
|
0x5b, 0xfc, 0x3e, 0xcf, 0xef, 0xb1, 0xfd, 0x24, 0xc1, 0xaf, 0xe6, 0x2f, 0x15, 0xe1, 0x82, 0xce,
|
||||||
0xb2, 0x00, 0x0d, 0x8a, 0xd6, 0x50, 0x24, 0x42, 0xd2, 0xae, 0xc0, 0x4a, 0x4e, 0x55, 0x3c, 0x87,
|
0x33, 0x0f, 0x64, 0x02, 0x1a, 0x14, 0xcd, 0x21, 0x09, 0x84, 0xa4, 0xb5, 0xc0, 0x52, 0x4e, 0x95,
|
||||||
0xa4, 0xca, 0x78, 0x91, 0xd2, 0x7a, 0x46, 0x53, 0x28, 0x40, 0x32, 0x0d, 0x09, 0x29, 0xa5, 0xd0,
|
0x3f, 0x83, 0x20, 0x8b, 0x78, 0x12, 0xd2, 0x7c, 0x42, 0x43, 0x48, 0x40, 0x32, 0x0d, 0x01, 0x49,
|
||||||
0xc2, 0x76, 0xd6, 0x4e, 0xc2, 0x4a, 0x4e, 0x7a, 0x27, 0xa9, 0x67, 0xd3, 0xc7, 0x29, 0xd7, 0xf3,
|
0xa5, 0xd0, 0xc2, 0x30, 0x37, 0x4e, 0xc2, 0x52, 0x4e, 0x1a, 0x27, 0xc9, 0x27, 0x83, 0x27, 0x21,
|
||||||
0x2a, 0x22, 0xb1, 0xc8, 0x69, 0x2a, 0x52, 0x41, 0x5b, 0x20, 0xaa, 0x4e, 0xdb, 0x57, 0xfb, 0x68,
|
0xd7, 0xb3, 0xcc, 0x23, 0xbe, 0x88, 0x69, 0x28, 0x42, 0x41, 0x2b, 0xc0, 0xcb, 0x2e, 0xab, 0x55,
|
||||||
0xbf, 0xd6, 0x8d, 0xa6, 0x4f, 0xfb, 0x91, 0x39, 0x8b, 0xe7, 0xbc, 0x00, 0x79, 0x46, 0xcb, 0x45,
|
0xb5, 0xa8, 0x9e, 0x36, 0x41, 0x83, 0xf1, 0xd6, 0x96, 0xbe, 0x90, 0x70, 0xcb, 0x66, 0x83, 0x67,
|
||||||
0x6a, 0x04, 0x45, 0x73, 0xd0, 0xec, 0x1f, 0xe3, 0xa7, 0xf4, 0x3a, 0x4a, 0x56, 0x85, 0xe6, 0x39,
|
0x8d, 0x27, 0x66, 0xfe, 0x8c, 0x27, 0x20, 0x17, 0x34, 0x9d, 0x87, 0xe5, 0x40, 0xd1, 0x18, 0x34,
|
||||||
0x5c, 0x01, 0x9e, 0xff, 0x0f, 0x30, 0x47, 0xe4, 0xec, 0x6f, 0xee, 0xe0, 0xfb, 0x10, 0x4f, 0x4e,
|
0xbb, 0x8d, 0xa2, 0x77, 0x51, 0x32, 0x4b, 0x34, 0x8f, 0xe1, 0x00, 0x78, 0xf1, 0x2f, 0xa0, 0xbc,
|
||||||
0x24, 0x17, 0x92, 0xeb, 0xb3, 0xd7, 0x19, 0x53, 0xca, 0xfe, 0x8c, 0x47, 0x66, 0xab, 0x84, 0x69,
|
0x68, 0xcc, 0xf6, 0xb9, 0xf1, 0xaf, 0x36, 0xee, 0x4d, 0x25, 0x17, 0x92, 0xeb, 0xc5, 0xeb, 0x88,
|
||||||
0xe6, 0x20, 0x0f, 0xf9, 0xe3, 0xc3, 0x27, 0xa4, 0x0f, 0x63, 0xd3, 0x9c, 0x94, 0x8b, 0xd4, 0x08,
|
0x29, 0x65, 0x7c, 0xc6, 0xc7, 0xe5, 0xa9, 0x02, 0xa6, 0x99, 0x89, 0x46, 0xc8, 0xee, 0x9e, 0x3e,
|
||||||
0x8a, 0x18, 0x37, 0xa9, 0x67, 0xe4, 0x7d, 0xf4, 0x05, 0x62, 0xfd, 0x0e, 0x34, 0x0b, 0xec, 0xe5,
|
0x25, 0x4d, 0x61, 0x37, 0xe1, 0x24, 0x9d, 0x87, 0xe5, 0x40, 0x91, 0xd2, 0x4d, 0xf2, 0x09, 0x79,
|
||||||
0xe5, 0xfe, 0xa0, 0xb9, 0xdc, 0xc7, 0xbd, 0x16, 0x6e, 0xba, 0xda, 0x0f, 0xb1, 0x55, 0xb3, 0xac,
|
0xef, 0x7d, 0x01, 0x5f, 0xbf, 0x03, 0xcd, 0x1c, 0x63, 0xb9, 0x1a, 0xb6, 0x8a, 0xd5, 0x10, 0x37,
|
||||||
0x02, 0x67, 0xe8, 0x21, 0xdf, 0x0a, 0x26, 0x9d, 0xd9, 0xfa, 0x60, 0xc4, 0x70, 0x5d, 0xb3, 0x5f,
|
0x33, 0xf7, 0x26, 0xd5, 0x38, 0xc1, 0x9d, 0x9c, 0x45, 0x19, 0x98, 0xed, 0x11, 0xb2, 0x3b, 0x4e,
|
||||||
0xe2, 0x49, 0x9a, 0x89, 0x88, 0x65, 0x47, 0x70, 0xca, 0xaa, 0x4c, 0x3b, 0x7b, 0x1e, 0xf2, 0x47,
|
0xaf, 0x36, 0x77, 0x3e, 0x94, 0x43, 0x77, 0xa3, 0x19, 0x67, 0xb8, 0x17, 0x46, 0xc2, 0x63, 0xd1,
|
||||||
0xc1, 0x83, 0xce, 0x3c, 0x79, 0xb3, 0x5d, 0x0c, 0x77, 0xbd, 0xf6, 0x33, 0x3c, 0x4e, 0x40, 0xc5,
|
0x39, 0x5c, 0xb2, 0x2c, 0xd2, 0xe6, 0xd1, 0x08, 0xd9, 0xc7, 0xce, 0xa3, 0xda, 0xdc, 0x7b, 0xb3,
|
||||||
0x92, 0x97, 0x9a, 0x8b, 0xc2, 0xb9, 0xe5, 0x21, 0xff, 0x76, 0x70, 0xbf, 0x43, 0xc7, 0x47, 0x7d,
|
0x2d, 0xba, 0xbb, 0x5e, 0xe3, 0x39, 0xee, 0x06, 0xa0, 0x7c, 0xc9, 0x53, 0xcd, 0x45, 0x62, 0xde,
|
||||||
0x29, 0xdc, 0xf6, 0xd9, 0x04, 0xe3, 0x52, 0x02, 0xe4, 0xa5, 0xe6, 0x45, 0xea, 0x58, 0xed, 0xc0,
|
0x1b, 0x21, 0xfb, 0xbe, 0xf3, 0xb0, 0x46, 0xbb, 0xe7, 0x8d, 0xe4, 0x6e, 0xfb, 0x8c, 0x10, 0xf7,
|
||||||
0x3b, 0xe6, 0x8c, 0x93, 0x8d, 0x1a, 0x6e, 0x39, 0x0e, 0x7e, 0x20, 0x7c, 0x6f, 0x27, 0xbc, 0x63,
|
0x53, 0x09, 0x10, 0x57, 0xab, 0xa9, 0x88, 0xb8, 0xbf, 0x30, 0x3b, 0x15, 0x7b, 0x56, 0xac, 0x86,
|
||||||
0xae, 0xb4, 0xfd, 0xe9, 0x4a, 0x80, 0xe4, 0x66, 0x01, 0x1a, 0xba, 0x8d, 0xef, 0x6e, 0xb7, 0xe9,
|
0xfd, 0xe9, 0x9e, 0xf6, 0x7b, 0x35, 0x3c, 0x39, 0xfc, 0x02, 0xc8, 0xbe, 0xcd, 0x3d, 0x08, 0x1d,
|
||||||
0xe8, 0x8f, 0xb2, 0x15, 0xde, 0x31, 0xb6, 0xb8, 0x86, 0x5c, 0x39, 0x43, 0x6f, 0xcf, 0x1f, 0x1f,
|
0x7f, 0x47, 0xf8, 0xc1, 0x4e, 0xeb, 0x17, 0x5c, 0x69, 0xe3, 0xd3, 0x41, 0xf3, 0xe4, 0xff, 0x9a,
|
||||||
0x3e, 0x22, 0xd7, 0xfd, 0xa8, 0x64, 0x67, 0xb3, 0x3e, 0xe5, 0xb7, 0x86, 0x0e, 0xd7, 0x4d, 0x02,
|
0x2f, 0xe9, 0xaa, 0xf7, 0x7e, 0x7d, 0xc5, 0xe3, 0xbf, 0x93, 0xad, 0xd6, 0x2f, 0x70, 0x87, 0x6b,
|
||||||
0x7f, 0xb9, 0x72, 0x07, 0xe7, 0x2b, 0x77, 0x70, 0xb1, 0x72, 0x07, 0x5f, 0x1b, 0x17, 0x2d, 0x1b,
|
0x88, 0x95, 0xd9, 0x1e, 0x1d, 0xd9, 0xdd, 0xd3, 0xc7, 0xe4, 0xae, 0xbf, 0x80, 0xec, 0x9c, 0xac,
|
||||||
0x17, 0x9d, 0x37, 0x2e, 0xba, 0x68, 0x5c, 0xf4, 0xb3, 0x71, 0xd1, 0xb7, 0x5f, 0xee, 0xe0, 0xe3,
|
0x79, 0x3d, 0x6f, 0x4b, 0xda, 0xdd, 0x84, 0x38, 0xf6, 0x72, 0x6d, 0xb5, 0xae, 0xd6, 0x56, 0xeb,
|
||||||
0xb0, 0x9e, 0xfd, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xe3, 0x15, 0x16, 0x54, 0x03, 0x00, 0x00,
|
0x7a, 0x6d, 0xb5, 0xbe, 0x16, 0x16, 0x5a, 0x16, 0x16, 0xba, 0x2a, 0x2c, 0x74, 0x5d, 0x58, 0xe8,
|
||||||
|
0x47, 0x61, 0xa1, 0x6f, 0x3f, 0xad, 0xd6, 0xc7, 0x76, 0x3e, 0xf9, 0x13, 0x00, 0x00, 0xff, 0xff,
|
||||||
|
0x53, 0xd9, 0x28, 0x30, 0xb1, 0x03, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ syntax = 'proto2';
|
|||||||
|
|
||||||
package k8s.io.api.scheduling.v1;
|
package k8s.io.api.scheduling.v1;
|
||||||
|
|
||||||
|
import "k8s.io/api/core/v1/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||||
@ -53,10 +54,12 @@ message PriorityClass {
|
|||||||
// +optional
|
// +optional
|
||||||
optional string description = 4;
|
optional string description = 4;
|
||||||
|
|
||||||
// Preempting specifies whether a pod with this PriorityClass could trigger a preemption process.
|
// PreemptionPolicy is the Policy for preempting pods with lower priority.
|
||||||
// If this field is unset, the PriorityClass is considered a Preempting class by default.
|
// One of Never, PreemptLowerPriority.
|
||||||
|
// Defaults to PreemptLowerPriority if unset.
|
||||||
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
// +optional
|
// +optional
|
||||||
optional bool preempting = 5;
|
optional string preemptionPolicy = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PriorityClassList is a collection of priority classes.
|
// PriorityClassList is a collection of priority classes.
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,10 +51,12 @@ type PriorityClass struct {
|
|||||||
// +optional
|
// +optional
|
||||||
Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"`
|
Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"`
|
||||||
|
|
||||||
// Preempting specifies whether a pod with this PriorityClass could trigger a preemption process.
|
// PreemptionPolicy is the Policy for preempting pods with lower priority.
|
||||||
// If this field is unset, the PriorityClass is considered a Preempting class by default.
|
// One of Never, PreemptLowerPriority.
|
||||||
|
// Defaults to PreemptLowerPriority if unset.
|
||||||
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
// +optional
|
// +optional
|
||||||
Preempting *bool `json:"preempting,omitempty" protobuf:"bytes,5,opt,name=preempting"`
|
PreemptionPolicy *apiv1.PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,5,opt,name=preemptionPolicy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
@ -33,7 +33,7 @@ var map_PriorityClass = map[string]string{
|
|||||||
"value": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
"value": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
||||||
"globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.",
|
"globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.",
|
||||||
"description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.",
|
"description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.",
|
||||||
"preempting": "Preempting specifies whether a pod with this PriorityClass could trigger a preemption process. If this field is unset, the PriorityClass is considered a Preempting class by default.",
|
"preemptionPolicy": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (PriorityClass) SwaggerDoc() map[string]string {
|
func (PriorityClass) SwaggerDoc() map[string]string {
|
||||||
|
@ -21,6 +21,7 @@ limitations under the License.
|
|||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
corev1 "k8s.io/api/core/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,9 +30,9 @@ func (in *PriorityClass) DeepCopyInto(out *PriorityClass) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
if in.Preempting != nil {
|
if in.PreemptionPolicy != nil {
|
||||||
in, out := &in.Preempting, &out.Preempting
|
in, out := &in.PreemptionPolicy, &out.PreemptionPolicy
|
||||||
*out = new(bool)
|
*out = new(corev1.PreemptionPolicy)
|
||||||
**out = **in
|
**out = **in
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -18,6 +18,7 @@ go_library(
|
|||||||
importmap = "k8s.io/kubernetes/vendor/k8s.io/api/scheduling/v1alpha1",
|
importmap = "k8s.io/kubernetes/vendor/k8s.io/api/scheduling/v1alpha1",
|
||||||
importpath = "k8s.io/api/scheduling/v1alpha1",
|
importpath = "k8s.io/api/scheduling/v1alpha1",
|
||||||
deps = [
|
deps = [
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
@ -33,6 +33,8 @@ import proto "github.com/gogo/protobuf/proto"
|
|||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
import math "math"
|
import math "math"
|
||||||
|
|
||||||
|
import k8s_io_api_core_v1 "k8s.io/api/core/v1"
|
||||||
|
|
||||||
import strings "strings"
|
import strings "strings"
|
||||||
import reflect "reflect"
|
import reflect "reflect"
|
||||||
|
|
||||||
@ -99,6 +101,12 @@ func (m *PriorityClass) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
i++
|
i++
|
||||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description)))
|
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description)))
|
||||||
i += copy(dAtA[i:], m.Description)
|
i += copy(dAtA[i:], m.Description)
|
||||||
|
if m.PreemptionPolicy != nil {
|
||||||
|
dAtA[i] = 0x2a
|
||||||
|
i++
|
||||||
|
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy)))
|
||||||
|
i += copy(dAtA[i:], *m.PreemptionPolicy)
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +166,10 @@ func (m *PriorityClass) Size() (n int) {
|
|||||||
n += 2
|
n += 2
|
||||||
l = len(m.Description)
|
l = len(m.Description)
|
||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
if m.PreemptionPolicy != nil {
|
||||||
|
l = len(*m.PreemptionPolicy)
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,6 +209,7 @@ func (this *PriorityClass) String() string {
|
|||||||
`Value:` + fmt.Sprintf("%v", this.Value) + `,`,
|
`Value:` + fmt.Sprintf("%v", this.Value) + `,`,
|
||||||
`GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`,
|
`GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`,
|
||||||
`Description:` + fmt.Sprintf("%v", this.Description) + `,`,
|
`Description:` + fmt.Sprintf("%v", this.Description) + `,`,
|
||||||
|
`PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@ -347,6 +360,36 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
m.Description = string(dAtA[iNdEx:postIndex])
|
m.Description = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 5:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
s := k8s_io_api_core_v1.PreemptionPolicy(dAtA[iNdEx:postIndex])
|
||||||
|
m.PreemptionPolicy = &s
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
@ -589,33 +632,36 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptorGenerated = []byte{
|
var fileDescriptorGenerated = []byte{
|
||||||
// 447 bytes of a gzipped FileDescriptorProto
|
// 494 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x4f, 0x8b, 0xd3, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x4f, 0x8b, 0xd3, 0x40,
|
||||||
0x18, 0xc6, 0x33, 0x5d, 0x0b, 0x75, 0x4a, 0x41, 0x23, 0x42, 0xe8, 0x61, 0x36, 0xac, 0x97, 0x5c,
|
0x18, 0xc6, 0x3b, 0x5d, 0x0b, 0x75, 0x4a, 0xa1, 0x46, 0x84, 0xd0, 0xc3, 0xb4, 0x74, 0x2f, 0xbd,
|
||||||
0x76, 0xc6, 0x2e, 0x2a, 0x82, 0xb7, 0xb8, 0xb0, 0x08, 0x8a, 0x92, 0x83, 0x07, 0xf1, 0xe0, 0x24,
|
0xec, 0x8c, 0x5d, 0x54, 0x84, 0xbd, 0xd5, 0x85, 0x45, 0x50, 0x2c, 0x39, 0x78, 0x10, 0x0f, 0x4e,
|
||||||
0x79, 0x37, 0x1d, 0x9b, 0x64, 0xc2, 0xcc, 0x24, 0xb0, 0x37, 0xcf, 0x9e, 0xfc, 0x52, 0x42, 0x8f,
|
0xd3, 0x77, 0xd3, 0xb1, 0x49, 0x26, 0xcc, 0x4c, 0x02, 0xbd, 0xf9, 0x11, 0xfc, 0x52, 0x42, 0x8f,
|
||||||
0x7b, 0xdc, 0xd3, 0x62, 0xe3, 0x17, 0x91, 0xa4, 0x69, 0xd3, 0x5a, 0xfc, 0x73, 0xcb, 0x3c, 0xef,
|
0x7b, 0xdc, 0x53, 0xb1, 0xf1, 0x23, 0x78, 0xf3, 0x24, 0x49, 0xd3, 0x4d, 0xdb, 0xf8, 0x67, 0x6f,
|
||||||
0xef, 0x79, 0xe6, 0xcd, 0xc3, 0xe0, 0x8b, 0xc5, 0x73, 0x4d, 0x85, 0x64, 0x8b, 0x32, 0x04, 0x95,
|
0x99, 0xf7, 0xf9, 0x3d, 0xcf, 0xcc, 0x3c, 0x49, 0xf0, 0xd5, 0xe2, 0xa5, 0xa6, 0x42, 0xb2, 0x45,
|
||||||
0x83, 0x01, 0xcd, 0x2a, 0xc8, 0x63, 0xa9, 0x58, 0x37, 0xe0, 0x85, 0x60, 0x3a, 0x9a, 0x43, 0x5c,
|
0x3c, 0x05, 0x15, 0x82, 0x01, 0xcd, 0x12, 0x08, 0x67, 0x52, 0xb1, 0x42, 0xe0, 0x91, 0x60, 0xda,
|
||||||
0xa6, 0x22, 0x4f, 0x58, 0x35, 0xe3, 0x69, 0x31, 0xe7, 0x33, 0x96, 0x40, 0x0e, 0x8a, 0x1b, 0x88,
|
0x9d, 0xc3, 0x2c, 0xf6, 0x45, 0xe8, 0xb1, 0x64, 0xc4, 0xfd, 0x68, 0xce, 0x47, 0xcc, 0x83, 0x10,
|
||||||
0x69, 0xa1, 0xa4, 0x91, 0x36, 0x59, 0xf3, 0x94, 0x17, 0x82, 0xf6, 0x3c, 0xdd, 0xf0, 0xd3, 0xd3,
|
0x14, 0x37, 0x30, 0xa3, 0x91, 0x92, 0x46, 0x5a, 0x64, 0xcb, 0x53, 0x1e, 0x09, 0x5a, 0xf2, 0x74,
|
||||||
0x44, 0x98, 0x79, 0x19, 0xd2, 0x48, 0x66, 0x2c, 0x91, 0x89, 0x64, 0xad, 0x2d, 0x2c, 0x2f, 0xdb,
|
0xc7, 0x77, 0xcf, 0x3c, 0x61, 0xe6, 0xf1, 0x94, 0xba, 0x32, 0x60, 0x9e, 0xf4, 0x24, 0xcb, 0x6d,
|
||||||
0x53, 0x7b, 0x68, 0xbf, 0xd6, 0x71, 0xd3, 0x27, 0xfd, 0xf5, 0x19, 0x8f, 0xe6, 0x22, 0x07, 0x75,
|
0xd3, 0xf8, 0x3a, 0x5f, 0xe5, 0x8b, 0xfc, 0x69, 0x1b, 0xd7, 0x1d, 0xec, 0x6d, 0xef, 0x4a, 0x05,
|
||||||
0xc5, 0x8a, 0x45, 0xd2, 0x08, 0x9a, 0x65, 0x60, 0x38, 0xab, 0x0e, 0x96, 0x98, 0xb2, 0x3f, 0xb9,
|
0x2c, 0xa9, 0x6c, 0xd9, 0x7d, 0x56, 0x32, 0x01, 0x77, 0xe7, 0x22, 0x04, 0xb5, 0x64, 0xd1, 0xc2,
|
||||||
0x54, 0x99, 0x1b, 0x91, 0xc1, 0x81, 0xe1, 0xd9, 0xbf, 0x0c, 0xcd, 0xaf, 0x64, 0xfc, 0x77, 0xdf,
|
0xcb, 0x06, 0x9a, 0x05, 0x60, 0xf8, 0x9f, 0x5c, 0xec, 0x6f, 0x2e, 0x15, 0x87, 0x46, 0x04, 0x50,
|
||||||
0xc9, 0xd7, 0x01, 0x9e, 0xbc, 0x53, 0x42, 0x2a, 0x61, 0xae, 0x5e, 0xa6, 0x5c, 0x6b, 0xfb, 0x13,
|
0x31, 0xbc, 0xf8, 0x9f, 0x21, 0xbb, 0x6e, 0xc0, 0x8f, 0x7d, 0x83, 0x9f, 0x75, 0xdc, 0x9e, 0x28,
|
||||||
0x1e, 0x35, 0x5b, 0xc5, 0xdc, 0x70, 0x07, 0xb9, 0xc8, 0x1b, 0x9f, 0x3d, 0xa6, 0x7d, 0x25, 0xdb,
|
0x21, 0x95, 0x30, 0xcb, 0x57, 0x3e, 0xd7, 0xda, 0xfa, 0x84, 0x9b, 0xd9, 0xa9, 0x66, 0xdc, 0x70,
|
||||||
0x70, 0x5a, 0x2c, 0x92, 0x46, 0xd0, 0xb4, 0xa1, 0x69, 0x35, 0xa3, 0x6f, 0xc3, 0xcf, 0x10, 0x99,
|
0x1b, 0xf5, 0xd1, 0xb0, 0x75, 0xfe, 0x94, 0x96, 0xb5, 0xdd, 0x85, 0xd3, 0x68, 0xe1, 0x65, 0x03,
|
||||||
0x37, 0x60, 0xb8, 0x6f, 0x2f, 0x6f, 0x8f, 0xad, 0xfa, 0xf6, 0x18, 0xf7, 0x5a, 0xb0, 0x4d, 0xb5,
|
0x4d, 0x33, 0x9a, 0x26, 0x23, 0xfa, 0x6e, 0xfa, 0x19, 0x5c, 0xf3, 0x16, 0x0c, 0x1f, 0x5b, 0xab,
|
||||||
0x1f, 0xe1, 0x61, 0xc5, 0xd3, 0x12, 0x9c, 0x81, 0x8b, 0xbc, 0xa1, 0x3f, 0xe9, 0xe0, 0xe1, 0xfb,
|
0x75, 0xaf, 0x96, 0xae, 0x7b, 0xb8, 0x9c, 0x39, 0x77, 0xa9, 0xd6, 0x29, 0x6e, 0x24, 0xdc, 0x8f,
|
||||||
0x46, 0x0c, 0xd6, 0x33, 0xfb, 0x05, 0x9e, 0x24, 0xa9, 0x0c, 0x79, 0x7a, 0x0e, 0x97, 0xbc, 0x4c,
|
0xc1, 0xae, 0xf7, 0xd1, 0xb0, 0x31, 0x6e, 0x17, 0x70, 0xe3, 0x7d, 0x36, 0x74, 0xb6, 0x9a, 0x75,
|
||||||
0x8d, 0x73, 0xe4, 0x22, 0x6f, 0xe4, 0x3f, 0xec, 0xe0, 0xc9, 0xc5, 0xee, 0x30, 0xd8, 0x67, 0xed,
|
0x81, 0xdb, 0x9e, 0x2f, 0xa7, 0xdc, 0xbf, 0x84, 0x6b, 0x1e, 0xfb, 0xc6, 0x3e, 0xe9, 0xa3, 0x61,
|
||||||
0xa7, 0x78, 0x1c, 0x83, 0x8e, 0x94, 0x28, 0x8c, 0x90, 0xb9, 0x73, 0xc7, 0x45, 0xde, 0x5d, 0xff,
|
0x73, 0xfc, 0xa4, 0x80, 0xdb, 0x57, 0xfb, 0xa2, 0x73, 0xc8, 0x5a, 0xcf, 0x71, 0x6b, 0x06, 0xda,
|
||||||
0x41, 0x67, 0x1d, 0x9f, 0xf7, 0xa3, 0x60, 0x97, 0x3b, 0xf9, 0x8e, 0xf0, 0xfd, 0xbd, 0x32, 0x5e,
|
0x55, 0x22, 0x32, 0x42, 0x86, 0xf6, 0x83, 0x3e, 0x1a, 0x3e, 0x1c, 0x3f, 0x2e, 0xac, 0xad, 0xcb,
|
||||||
0x0b, 0x6d, 0xec, 0x8f, 0x07, 0x85, 0xd0, 0xff, 0x2b, 0xa4, 0x71, 0xb7, 0x75, 0xdc, 0xeb, 0x6e,
|
0x52, 0x72, 0xf6, 0x39, 0xcb, 0xc3, 0x9d, 0x48, 0x01, 0x04, 0xf9, 0x6a, 0x22, 0x7d, 0xe1, 0x2e,
|
||||||
0x1e, 0x6d, 0x94, 0x9d, 0x32, 0x02, 0x3c, 0x14, 0x06, 0x32, 0xed, 0x0c, 0xdc, 0x23, 0x6f, 0x7c,
|
0xed, 0x46, 0xee, 0xbd, 0x48, 0xd7, 0xbd, 0xce, 0xe4, 0x48, 0xfb, 0xb5, 0xee, 0x9d, 0x56, 0xbf,
|
||||||
0x76, 0x4a, 0xff, 0xfe, 0xfc, 0xe8, 0xde, 0x7e, 0x7d, 0x77, 0xaf, 0x9a, 0x8c, 0x60, 0x1d, 0xe5,
|
0x00, 0x7a, 0x8c, 0x39, 0x95, 0xd0, 0xc1, 0x37, 0x84, 0x1f, 0x1d, 0xb4, 0xfe, 0x46, 0x68, 0x63,
|
||||||
0xd3, 0xe5, 0x8a, 0x58, 0xd7, 0x2b, 0x62, 0xdd, 0xac, 0x88, 0xf5, 0xa5, 0x26, 0x68, 0x59, 0x13,
|
0x7d, 0xac, 0x34, 0x4f, 0xef, 0xd7, 0x7c, 0xe6, 0xce, 0x7b, 0xef, 0x14, 0x57, 0x6c, 0xee, 0x26,
|
||||||
0x74, 0x5d, 0x13, 0x74, 0x53, 0x13, 0xf4, 0xa3, 0x26, 0xe8, 0xdb, 0x4f, 0x62, 0x7d, 0x18, 0x6d,
|
0x7b, 0xad, 0x3b, 0xb8, 0x21, 0x0c, 0x04, 0xda, 0xae, 0xf7, 0x4f, 0x86, 0xad, 0xf3, 0x33, 0xfa,
|
||||||
0x32, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xab, 0x20, 0x12, 0x63, 0x3c, 0x03, 0x00, 0x00,
|
0xef, 0x7f, 0x81, 0x1e, 0x9c, 0xaf, 0x7c, 0x49, 0xaf, 0xb3, 0x0c, 0x67, 0x1b, 0x35, 0xa6, 0xab,
|
||||||
|
0x0d, 0xa9, 0xdd, 0x6c, 0x48, 0xed, 0x76, 0x43, 0x6a, 0x5f, 0x52, 0x82, 0x56, 0x29, 0x41, 0x37,
|
||||||
|
0x29, 0x41, 0xb7, 0x29, 0x41, 0xdf, 0x53, 0x82, 0xbe, 0xfe, 0x20, 0xb5, 0x0f, 0xcd, 0x5d, 0xe6,
|
||||||
|
0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x55, 0x5c, 0x1a, 0x39, 0xc9, 0x03, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ syntax = 'proto2';
|
|||||||
|
|
||||||
package k8s.io.api.scheduling.v1alpha1;
|
package k8s.io.api.scheduling.v1alpha1;
|
||||||
|
|
||||||
|
import "k8s.io/api/core/v1/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||||
@ -53,6 +54,13 @@ message PriorityClass {
|
|||||||
// when this priority class should be used.
|
// when this priority class should be used.
|
||||||
// +optional
|
// +optional
|
||||||
optional string description = 4;
|
optional string description = 4;
|
||||||
|
|
||||||
|
// PreemptionPolicy is the Policy for preempting pods with lower priority.
|
||||||
|
// One of Never, PreemptLowerPriority.
|
||||||
|
// Defaults to PreemptLowerPriority if unset.
|
||||||
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
|
// +optional
|
||||||
|
optional string preemptionPolicy = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PriorityClassList is a collection of priority classes.
|
// PriorityClassList is a collection of priority classes.
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,6 +51,13 @@ type PriorityClass struct {
|
|||||||
// when this priority class should be used.
|
// when this priority class should be used.
|
||||||
// +optional
|
// +optional
|
||||||
Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"`
|
Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"`
|
||||||
|
|
||||||
|
// PreemptionPolicy is the Policy for preempting pods with lower priority.
|
||||||
|
// One of Never, PreemptLowerPriority.
|
||||||
|
// Defaults to PreemptLowerPriority if unset.
|
||||||
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
|
// +optional
|
||||||
|
PreemptionPolicy *apiv1.PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,5,opt,name=preemptionPolicy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
@ -33,6 +33,7 @@ var map_PriorityClass = map[string]string{
|
|||||||
"value": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
"value": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
||||||
"globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.",
|
"globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.",
|
||||||
"description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.",
|
"description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.",
|
||||||
|
"preemptionPolicy": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (PriorityClass) SwaggerDoc() map[string]string {
|
func (PriorityClass) SwaggerDoc() map[string]string {
|
||||||
|
@ -21,6 +21,7 @@ limitations under the License.
|
|||||||
package v1alpha1
|
package v1alpha1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
v1 "k8s.io/api/core/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,6 +30,11 @@ func (in *PriorityClass) DeepCopyInto(out *PriorityClass) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
if in.PreemptionPolicy != nil {
|
||||||
|
in, out := &in.PreemptionPolicy, &out.PreemptionPolicy
|
||||||
|
*out = new(v1.PreemptionPolicy)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ go_library(
|
|||||||
importmap = "k8s.io/kubernetes/vendor/k8s.io/api/scheduling/v1beta1",
|
importmap = "k8s.io/kubernetes/vendor/k8s.io/api/scheduling/v1beta1",
|
||||||
importpath = "k8s.io/api/scheduling/v1beta1",
|
importpath = "k8s.io/api/scheduling/v1beta1",
|
||||||
deps = [
|
deps = [
|
||||||
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
|
@ -33,6 +33,8 @@ import proto "github.com/gogo/protobuf/proto"
|
|||||||
import fmt "fmt"
|
import fmt "fmt"
|
||||||
import math "math"
|
import math "math"
|
||||||
|
|
||||||
|
import k8s_io_api_core_v1 "k8s.io/api/core/v1"
|
||||||
|
|
||||||
import strings "strings"
|
import strings "strings"
|
||||||
import reflect "reflect"
|
import reflect "reflect"
|
||||||
|
|
||||||
@ -99,6 +101,12 @@ func (m *PriorityClass) MarshalTo(dAtA []byte) (int, error) {
|
|||||||
i++
|
i++
|
||||||
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description)))
|
i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description)))
|
||||||
i += copy(dAtA[i:], m.Description)
|
i += copy(dAtA[i:], m.Description)
|
||||||
|
if m.PreemptionPolicy != nil {
|
||||||
|
dAtA[i] = 0x2a
|
||||||
|
i++
|
||||||
|
i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy)))
|
||||||
|
i += copy(dAtA[i:], *m.PreemptionPolicy)
|
||||||
|
}
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +166,10 @@ func (m *PriorityClass) Size() (n int) {
|
|||||||
n += 2
|
n += 2
|
||||||
l = len(m.Description)
|
l = len(m.Description)
|
||||||
n += 1 + l + sovGenerated(uint64(l))
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
if m.PreemptionPolicy != nil {
|
||||||
|
l = len(*m.PreemptionPolicy)
|
||||||
|
n += 1 + l + sovGenerated(uint64(l))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,6 +209,7 @@ func (this *PriorityClass) String() string {
|
|||||||
`Value:` + fmt.Sprintf("%v", this.Value) + `,`,
|
`Value:` + fmt.Sprintf("%v", this.Value) + `,`,
|
||||||
`GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`,
|
`GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`,
|
||||||
`Description:` + fmt.Sprintf("%v", this.Description) + `,`,
|
`Description:` + fmt.Sprintf("%v", this.Description) + `,`,
|
||||||
|
`PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`,
|
||||||
`}`,
|
`}`,
|
||||||
}, "")
|
}, "")
|
||||||
return s
|
return s
|
||||||
@ -347,6 +360,36 @@ func (m *PriorityClass) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
m.Description = string(dAtA[iNdEx:postIndex])
|
m.Description = string(dAtA[iNdEx:postIndex])
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
|
case 5:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenerated
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= (uint64(b) & 0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenerated
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
s := k8s_io_api_core_v1.PreemptionPolicy(dAtA[iNdEx:postIndex])
|
||||||
|
m.PreemptionPolicy = &s
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipGenerated(dAtA[iNdEx:])
|
skippy, err := skipGenerated(dAtA[iNdEx:])
|
||||||
@ -589,33 +632,36 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptorGenerated = []byte{
|
var fileDescriptorGenerated = []byte{
|
||||||
// 448 bytes of a gzipped FileDescriptorProto
|
// 494 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x8b, 0xd3, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x3f, 0x8f, 0xd3, 0x30,
|
||||||
0x18, 0xc5, 0x33, 0x5d, 0x8b, 0x75, 0x4a, 0x41, 0x23, 0x42, 0x28, 0x38, 0x1b, 0xd6, 0x4b, 0x0e,
|
0x18, 0xc6, 0xeb, 0x1e, 0x15, 0xc5, 0x55, 0xa5, 0x12, 0x84, 0x14, 0x55, 0x22, 0xad, 0x7a, 0x4b,
|
||||||
0xee, 0x8c, 0x5d, 0x54, 0x04, 0x6f, 0x71, 0x51, 0x04, 0x45, 0xcd, 0xc1, 0x83, 0x78, 0x70, 0x92,
|
0x07, 0xce, 0xa6, 0x27, 0x40, 0x48, 0xb7, 0x95, 0x13, 0x08, 0x09, 0x44, 0xc9, 0xc0, 0x80, 0x18,
|
||||||
0x7c, 0x9b, 0x8e, 0x4d, 0x32, 0x61, 0x66, 0x12, 0xd8, 0x9b, 0x67, 0x4f, 0xfe, 0x51, 0x1e, 0x7a,
|
0x70, 0x92, 0xf7, 0x52, 0xd3, 0x24, 0x8e, 0x6c, 0x27, 0x52, 0x37, 0x3e, 0x02, 0x1f, 0x8a, 0xa1,
|
||||||
0xdc, 0xe3, 0x9e, 0x16, 0x1b, 0xff, 0x11, 0x49, 0x1a, 0x37, 0xad, 0x45, 0xdd, 0x5b, 0xe6, 0x7d,
|
0xe3, 0x8d, 0x37, 0x55, 0x34, 0x7c, 0x04, 0x36, 0x26, 0x94, 0x34, 0x5c, 0xda, 0x86, 0x7f, 0x5b,
|
||||||
0xbf, 0xf7, 0xe6, 0xcb, 0x63, 0xf0, 0xf3, 0xc5, 0x13, 0x4d, 0x85, 0x64, 0x8b, 0x32, 0x04, 0x95,
|
0xfc, 0x3e, 0xbf, 0xe7, 0xb1, 0xfd, 0x24, 0xc1, 0xcf, 0x16, 0x4f, 0x14, 0xe1, 0x82, 0x2e, 0x12,
|
||||||
0x83, 0x01, 0xcd, 0x2a, 0xc8, 0x63, 0xa9, 0x58, 0x37, 0xe0, 0x85, 0x60, 0x3a, 0x9a, 0x43, 0x5c,
|
0x07, 0x64, 0x04, 0x1a, 0x14, 0x4d, 0x21, 0xf2, 0x84, 0xa4, 0xa5, 0xc0, 0x62, 0x4e, 0x95, 0x3b,
|
||||||
0xa6, 0x22, 0x4f, 0x58, 0x35, 0x0b, 0xc1, 0xf0, 0x19, 0x4b, 0x20, 0x07, 0xc5, 0x0d, 0xc4, 0xb4,
|
0x07, 0x2f, 0x09, 0x78, 0xe4, 0xd3, 0x74, 0xe2, 0x80, 0x66, 0x13, 0xea, 0x43, 0x04, 0x92, 0x69,
|
||||||
0x50, 0xd2, 0x48, 0xfb, 0xee, 0x1a, 0xa7, 0xbc, 0x10, 0xb4, 0xc7, 0x69, 0x87, 0x4f, 0x0f, 0x13,
|
0xf0, 0x48, 0x2c, 0x85, 0x16, 0xc6, 0xbd, 0x2d, 0x4e, 0x58, 0xcc, 0x49, 0x85, 0x93, 0x12, 0xef,
|
||||||
0x61, 0xe6, 0x65, 0x48, 0x23, 0x99, 0xb1, 0x44, 0x26, 0x92, 0xb5, 0xae, 0xb0, 0x3c, 0x69, 0x4f,
|
0x9f, 0xf8, 0x5c, 0xcf, 0x13, 0x87, 0xb8, 0x22, 0xa4, 0xbe, 0xf0, 0x05, 0x2d, 0x5c, 0x4e, 0x72,
|
||||||
0xed, 0xa1, 0xfd, 0x5a, 0xa7, 0x4d, 0x1f, 0xf6, 0x97, 0x67, 0x3c, 0x9a, 0x8b, 0x1c, 0xd4, 0x29,
|
0x51, 0xac, 0x8a, 0x45, 0xf1, 0xb4, 0x4d, 0xeb, 0x8f, 0x76, 0x36, 0x77, 0x85, 0x04, 0x9a, 0xd6,
|
||||||
0x2b, 0x16, 0x49, 0x23, 0x68, 0x96, 0x81, 0xe1, 0xac, 0xda, 0xd9, 0x61, 0xca, 0xfe, 0xe6, 0x52,
|
0x76, 0xec, 0x3f, 0xac, 0x98, 0x90, 0xb9, 0x73, 0x1e, 0x81, 0x5c, 0xd2, 0x78, 0xe1, 0xe7, 0x03,
|
||||||
0x65, 0x6e, 0x44, 0x06, 0x3b, 0x86, 0xc7, 0xff, 0x33, 0x34, 0x7f, 0x92, 0xf1, 0x3f, 0x7d, 0x07,
|
0x45, 0x43, 0xd0, 0xec, 0x77, 0x2e, 0xfa, 0x27, 0x97, 0x4c, 0x22, 0xcd, 0x43, 0xa8, 0x19, 0x1e,
|
||||||
0x5f, 0x07, 0x78, 0xf2, 0x56, 0x09, 0xa9, 0x84, 0x39, 0x7d, 0x96, 0x72, 0xad, 0xed, 0x4f, 0x78,
|
0xff, 0xcb, 0x90, 0xdf, 0x36, 0x64, 0x87, 0xbe, 0xd1, 0xf7, 0x26, 0xee, 0xce, 0x24, 0x17, 0x92,
|
||||||
0xd4, 0x6c, 0x15, 0x73, 0xc3, 0x1d, 0xe4, 0x22, 0x6f, 0x7c, 0xf4, 0x80, 0xf6, 0x8d, 0x5c, 0x86,
|
0xeb, 0xe5, 0xd3, 0x80, 0x29, 0x65, 0x7c, 0xc0, 0xed, 0xfc, 0x54, 0x1e, 0xd3, 0xcc, 0x44, 0x43,
|
||||||
0xd3, 0x62, 0x91, 0x34, 0x82, 0xa6, 0x0d, 0x4d, 0xab, 0x19, 0x7d, 0x13, 0x7e, 0x86, 0xc8, 0xbc,
|
0x34, 0xee, 0x9c, 0x3e, 0x20, 0x55, 0x6b, 0xd7, 0xe1, 0x24, 0x5e, 0xf8, 0xf9, 0x40, 0x91, 0x9c,
|
||||||
0x06, 0xc3, 0x7d, 0x7b, 0x79, 0xb1, 0x6f, 0xd5, 0x17, 0xfb, 0xb8, 0xd7, 0x82, 0xcb, 0x54, 0xfb,
|
0x26, 0xe9, 0x84, 0xbc, 0x76, 0x3e, 0x82, 0xab, 0x5f, 0x81, 0x66, 0x53, 0x63, 0xb5, 0x1e, 0x34,
|
||||||
0x1e, 0x1e, 0x56, 0x3c, 0x2d, 0xc1, 0x19, 0xb8, 0xc8, 0x1b, 0xfa, 0x93, 0x0e, 0x1e, 0xbe, 0x6f,
|
0xb2, 0xf5, 0x00, 0x57, 0x33, 0xfb, 0x3a, 0xd5, 0x38, 0xc6, 0xad, 0x94, 0x05, 0x09, 0x98, 0xcd,
|
||||||
0xc4, 0x60, 0x3d, 0xb3, 0x9f, 0xe2, 0x49, 0x92, 0xca, 0x90, 0xa7, 0xc7, 0x70, 0xc2, 0xcb, 0xd4,
|
0x21, 0x1a, 0xb7, 0xa6, 0xdd, 0x12, 0x6e, 0xbd, 0xcd, 0x87, 0xf6, 0x56, 0x33, 0xce, 0x70, 0xd7,
|
||||||
0x38, 0x7b, 0x2e, 0xf2, 0x46, 0xfe, 0x9d, 0x0e, 0x9e, 0xbc, 0xd8, 0x1c, 0x06, 0xdb, 0xac, 0xfd,
|
0x0f, 0x84, 0xc3, 0x82, 0x73, 0xb8, 0x60, 0x49, 0xa0, 0xcd, 0xa3, 0x21, 0x1a, 0xb7, 0xa7, 0x77,
|
||||||
0x08, 0x8f, 0x63, 0xd0, 0x91, 0x12, 0x85, 0x11, 0x32, 0x77, 0xae, 0xb9, 0xc8, 0xbb, 0xe1, 0xdf,
|
0x4b, 0xb8, 0xfb, 0x7c, 0x57, 0xb4, 0xf7, 0x59, 0xe3, 0x11, 0xee, 0x78, 0xa0, 0x5c, 0xc9, 0x63,
|
||||||
0xee, 0xac, 0xe3, 0xe3, 0x7e, 0x14, 0x6c, 0x72, 0x07, 0xdf, 0x11, 0xbe, 0xb5, 0x55, 0xc6, 0x2b,
|
0xcd, 0x45, 0x64, 0xde, 0x18, 0xa2, 0xf1, 0xad, 0xe9, 0x9d, 0xd2, 0xda, 0x39, 0xaf, 0x24, 0x7b,
|
||||||
0xa1, 0x8d, 0xfd, 0x71, 0xa7, 0x10, 0x7a, 0xb5, 0x42, 0x1a, 0x77, 0x5b, 0xc7, 0xcd, 0xee, 0xe6,
|
0x97, 0x33, 0x7c, 0xdc, 0x8b, 0x25, 0x40, 0x58, 0xac, 0x66, 0x22, 0xe0, 0xee, 0xd2, 0x6c, 0x15,
|
||||||
0xd1, 0x6f, 0x65, 0xa3, 0x8c, 0x77, 0x78, 0x28, 0x0c, 0x64, 0xda, 0x19, 0xb8, 0x7b, 0xde, 0xf8,
|
0xde, 0xb3, 0x6c, 0x3d, 0xe8, 0xcd, 0x0e, 0xb4, 0x1f, 0xeb, 0xc1, 0x71, 0xfd, 0x0b, 0x20, 0x87,
|
||||||
0xe8, 0x3e, 0xfd, 0xe7, 0xeb, 0xa3, 0x5b, 0xeb, 0xf5, 0xd5, 0xbd, 0x6c, 0x22, 0x82, 0x75, 0x92,
|
0x98, 0x5d, 0x0b, 0x1d, 0x7d, 0x41, 0xf8, 0xf6, 0x5e, 0xeb, 0x2f, 0xb9, 0xd2, 0xc6, 0xfb, 0x5a,
|
||||||
0x7f, 0xb8, 0x5c, 0x11, 0xeb, 0x6c, 0x45, 0xac, 0xf3, 0x15, 0xb1, 0xbe, 0xd4, 0x04, 0x2d, 0x6b,
|
0xf3, 0xe4, 0xff, 0x9a, 0xcf, 0xdd, 0x45, 0xef, 0xbd, 0xf2, 0x8a, 0xed, 0x5f, 0x93, 0x9d, 0xd6,
|
||||||
0x82, 0xce, 0x6a, 0x82, 0xce, 0x6b, 0x82, 0x7e, 0xd4, 0x04, 0x7d, 0xfb, 0x49, 0xac, 0x0f, 0xd7,
|
0xdf, 0xe0, 0x16, 0xd7, 0x10, 0x2a, 0xb3, 0x39, 0x3c, 0x1a, 0x77, 0x4e, 0xef, 0x93, 0xbf, 0xfe,
|
||||||
0xbb, 0xc8, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x41, 0x74, 0x8a, 0x60, 0x38, 0x03, 0x00, 0x00,
|
0x0a, 0x64, 0xef, 0x78, 0xd5, 0x3b, 0x7a, 0x91, 0x47, 0xd8, 0xdb, 0xa4, 0xe9, 0xc9, 0x6a, 0x63,
|
||||||
|
0x35, 0x2e, 0x37, 0x56, 0xe3, 0x6a, 0x63, 0x35, 0x3e, 0x65, 0x16, 0x5a, 0x65, 0x16, 0xba, 0xcc,
|
||||||
|
0x2c, 0x74, 0x95, 0x59, 0xe8, 0x6b, 0x66, 0xa1, 0xcf, 0xdf, 0xac, 0xc6, 0xbb, 0x9b, 0x65, 0xe4,
|
||||||
|
0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, 0xc2, 0xc0, 0x1f, 0xc5, 0x03, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ syntax = 'proto2';
|
|||||||
|
|
||||||
package k8s.io.api.scheduling.v1beta1;
|
package k8s.io.api.scheduling.v1beta1;
|
||||||
|
|
||||||
|
import "k8s.io/api/core/v1/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
|
||||||
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
|
||||||
@ -53,6 +54,13 @@ message PriorityClass {
|
|||||||
// when this priority class should be used.
|
// when this priority class should be used.
|
||||||
// +optional
|
// +optional
|
||||||
optional string description = 4;
|
optional string description = 4;
|
||||||
|
|
||||||
|
// PreemptionPolicy is the Policy for preempting pods with lower priority.
|
||||||
|
// One of Never, PreemptLowerPriority.
|
||||||
|
// Defaults to PreemptLowerPriority if unset.
|
||||||
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
|
// +optional
|
||||||
|
optional string preemptionPolicy = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PriorityClassList is a collection of priority classes.
|
// PriorityClassList is a collection of priority classes.
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
apiv1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,6 +51,13 @@ type PriorityClass struct {
|
|||||||
// when this priority class should be used.
|
// when this priority class should be used.
|
||||||
// +optional
|
// +optional
|
||||||
Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"`
|
Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"`
|
||||||
|
|
||||||
|
// PreemptionPolicy is the Policy for preempting pods with lower priority.
|
||||||
|
// One of Never, PreemptLowerPriority.
|
||||||
|
// Defaults to PreemptLowerPriority if unset.
|
||||||
|
// This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.
|
||||||
|
// +optional
|
||||||
|
PreemptionPolicy *apiv1.PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,5,opt,name=preemptionPolicy"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
@ -33,6 +33,7 @@ var map_PriorityClass = map[string]string{
|
|||||||
"value": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
"value": "The value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.",
|
||||||
"globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.",
|
"globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.",
|
||||||
"description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.",
|
"description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.",
|
||||||
|
"preemptionPolicy": "PreemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset. This field is alpha-level and is only honored by servers that enable the NonPreemptingPriority feature.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (PriorityClass) SwaggerDoc() map[string]string {
|
func (PriorityClass) SwaggerDoc() map[string]string {
|
||||||
|
@ -21,6 +21,7 @@ limitations under the License.
|
|||||||
package v1beta1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
v1 "k8s.io/api/core/v1"
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,6 +30,11 @@ func (in *PriorityClass) DeepCopyInto(out *PriorityClass) {
|
|||||||
*out = *in
|
*out = *in
|
||||||
out.TypeMeta = in.TypeMeta
|
out.TypeMeta = in.TypeMeta
|
||||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||||
|
if in.PreemptionPolicy != nil {
|
||||||
|
in, out := &in.PreemptionPolicy, &out.PreemptionPolicy
|
||||||
|
*out = new(v1.PreemptionPolicy)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,9 +120,6 @@ func roundTripTypes(t *testing.T, scheme *runtime.Scheme, codecFactory runtimese
|
|||||||
internalKindToGoType := scheme.KnownTypes(internalVersion)
|
internalKindToGoType := scheme.KnownTypes(internalVersion)
|
||||||
|
|
||||||
for kind := range internalKindToGoType {
|
for kind := range internalKindToGoType {
|
||||||
if kind != "PriorityClassList" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if globalNonRoundTrippableTypes.Has(kind) {
|
if globalNonRoundTrippableTypes.Has(kind) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,6 @@ func setupScheduler(
|
|||||||
ServiceInformer: informerFactory.Core().V1().Services(),
|
ServiceInformer: informerFactory.Core().V1().Services(),
|
||||||
PdbInformer: informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
PdbInformer: informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||||
StorageClassInformer: informerFactory.Storage().V1().StorageClasses(),
|
StorageClassInformer: informerFactory.Storage().V1().StorageClasses(),
|
||||||
PriorityClassInformer: informerFactory.Scheduling().V1().PriorityClasses(),
|
|
||||||
HardPodAffinitySymmetricWeight: v1.DefaultHardPodAffinitySymmetricWeight,
|
HardPodAffinitySymmetricWeight: v1.DefaultHardPodAffinitySymmetricWeight,
|
||||||
DisablePreemption: false,
|
DisablePreemption: false,
|
||||||
PercentageOfNodesToScore: 100,
|
PercentageOfNodesToScore: 100,
|
||||||
|
@ -254,7 +254,6 @@ priorities: []
|
|||||||
informerFactory.Core().V1().Services(),
|
informerFactory.Core().V1().Services(),
|
||||||
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||||
informerFactory.Storage().V1().StorageClasses(),
|
informerFactory.Storage().V1().StorageClasses(),
|
||||||
informerFactory.Scheduling().V1().PriorityClasses(),
|
|
||||||
eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: v1.DefaultSchedulerName}),
|
eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: v1.DefaultSchedulerName}),
|
||||||
kubeschedulerconfig.SchedulerAlgorithmSource{
|
kubeschedulerconfig.SchedulerAlgorithmSource{
|
||||||
Policy: &kubeschedulerconfig.SchedulerPolicySource{
|
Policy: &kubeschedulerconfig.SchedulerPolicySource{
|
||||||
@ -326,7 +325,6 @@ func TestSchedulerCreationFromNonExistentConfigMap(t *testing.T) {
|
|||||||
informerFactory.Core().V1().Services(),
|
informerFactory.Core().V1().Services(),
|
||||||
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||||
informerFactory.Storage().V1().StorageClasses(),
|
informerFactory.Storage().V1().StorageClasses(),
|
||||||
informerFactory.Scheduling().V1().PriorityClasses(),
|
|
||||||
eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: v1.DefaultSchedulerName}),
|
eventBroadcaster.NewRecorder(legacyscheme.Scheme, v1.EventSource{Component: v1.DefaultSchedulerName}),
|
||||||
kubeschedulerconfig.SchedulerAlgorithmSource{
|
kubeschedulerconfig.SchedulerAlgorithmSource{
|
||||||
Policy: &kubeschedulerconfig.SchedulerPolicySource{
|
Policy: &kubeschedulerconfig.SchedulerPolicySource{
|
||||||
|
@ -97,7 +97,6 @@ func createConfiguratorWithPodInformer(
|
|||||||
ServiceInformer: informerFactory.Core().V1().Services(),
|
ServiceInformer: informerFactory.Core().V1().Services(),
|
||||||
PdbInformer: informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
PdbInformer: informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
|
||||||
StorageClassInformer: informerFactory.Storage().V1().StorageClasses(),
|
StorageClassInformer: informerFactory.Storage().V1().StorageClasses(),
|
||||||
PriorityClassInformer: informerFactory.Scheduling().V1().PriorityClasses(),
|
|
||||||
Registry: pluginRegistry,
|
Registry: pluginRegistry,
|
||||||
Plugins: plugins,
|
Plugins: plugins,
|
||||||
PluginConfig: pluginConfig,
|
PluginConfig: pluginConfig,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user