switch system priority class to versioned (v1) api

move all the helpers to scheduling v1 helpers

less explicit conversion
This commit is contained in:
yue9944882
2019-04-10 13:10:09 +08:00
parent ea4570a412
commit 09cf42d67c
14 changed files with 60 additions and 54 deletions

View File

@@ -35,6 +35,7 @@ go_library(
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/apis/scheduling:go_default_library",
"//pkg/apis/scheduling/v1: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",

View File

@@ -35,6 +35,7 @@ import (
"k8s.io/kubernetes/pkg/apis/core"
api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/apis/scheduling"
schedulingapiv1 "k8s.io/kubernetes/pkg/apis/scheduling/v1"
"k8s.io/kubernetes/pkg/features"
)
@@ -144,7 +145,7 @@ func priorityClassPermittedInNamespace(priorityClassName string, namespace strin
// Only allow system priorities in the system namespace. This is to prevent abuse or incorrect
// usage of these priorities. Pods created at these priorities could preempt system critical
// components.
for _, spc := range scheduling.SystemPriorityClasses() {
for _, spc := range schedulingapiv1.SystemPriorityClasses() {
if spc.Name == priorityClassName && namespace != metav1.NamespaceSystem {
return false
}