@@ -27,6 +27,7 @@ import (
27
27
"github.com/onsi/gomega"
28
28
appsv1 "k8s.io/api/apps/v1"
29
29
corev1 "k8s.io/api/core/v1"
30
+ schedulingv1 "k8s.io/api/scheduling/v1"
30
31
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31
32
"k8s.io/apimachinery/pkg/runtime"
32
33
"k8s.io/apimachinery/pkg/types"
@@ -1036,6 +1037,14 @@ var _ = SIGDescribe("workloadspread", func() {
1036
1037
})
1037
1038
1038
1039
framework .ConformanceIt ("only one subset, zone-a=nil" , func () {
1040
+ priorityClass := & schedulingv1.PriorityClass {
1041
+ ObjectMeta : metav1.ObjectMeta {
1042
+ Name : "test-priority-class" ,
1043
+ },
1044
+ Value : 100 ,
1045
+ GlobalDefault : false ,
1046
+ }
1047
+ tester .CreatePriorityClass (priorityClass )
1039
1048
cloneSet := tester .NewBaseCloneSet (ns )
1040
1049
// create workloadSpread
1041
1050
targetRef := appsv1alpha1.TargetReference {
@@ -1056,7 +1065,7 @@ var _ = SIGDescribe("workloadspread", func() {
1056
1065
},
1057
1066
MaxReplicas : nil ,
1058
1067
Patch : runtime.RawExtension {
1059
- Raw : []byte (`{"metadata":{"annotations":{"subset":"zone-a"}}}` ),
1068
+ Raw : []byte (`{"metadata":{"annotations":{"subset":"zone-a"}},"spec":{"priorityClassName":"test-priority-class"} }` ),
1060
1069
},
1061
1070
}
1062
1071
@@ -1083,6 +1092,8 @@ var _ = SIGDescribe("workloadspread", func() {
1083
1092
gomega .Expect (injectWorkloadSpread .Name ).To (gomega .Equal (workloadSpread .Name ))
1084
1093
gomega .Expect (pod .Spec .Affinity ).NotTo (gomega .BeNil ())
1085
1094
gomega .Expect (pod .Spec .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution .NodeSelectorTerms [0 ].MatchExpressions ).To (gomega .Equal (subset1 .RequiredNodeSelectorTerm .MatchExpressions ))
1095
+ gomega .Expect (pod .Spec .PriorityClassName ).To (gomega .Equal ("test-priority-class" ))
1096
+ gomega .Expect (* pod .Spec .Priority ).To (gomega .BeEquivalentTo (100 ))
1086
1097
gomega .Expect (pod .Annotations [workloadspread .PodDeletionCostAnnotation ]).To (gomega .Equal ("100" ))
1087
1098
}
1088
1099
} else {
@@ -1123,6 +1134,8 @@ var _ = SIGDescribe("workloadspread", func() {
1123
1134
gomega .Expect (injectWorkloadSpread .Name ).To (gomega .Equal (workloadSpread .Name ))
1124
1135
gomega .Expect (pod .Spec .Affinity ).NotTo (gomega .BeNil ())
1125
1136
gomega .Expect (pod .Spec .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution .NodeSelectorTerms [0 ].MatchExpressions ).To (gomega .Equal (subset1 .RequiredNodeSelectorTerm .MatchExpressions ))
1137
+ gomega .Expect (pod .Spec .PriorityClassName ).To (gomega .Equal ("test-priority-class" ))
1138
+ gomega .Expect (* pod .Spec .Priority ).To (gomega .BeEquivalentTo (100 ))
1126
1139
gomega .Expect (pod .Annotations [workloadspread .PodDeletionCostAnnotation ]).To (gomega .Equal ("100" ))
1127
1140
}
1128
1141
} else {
@@ -1163,6 +1176,8 @@ var _ = SIGDescribe("workloadspread", func() {
1163
1176
gomega .Expect (injectWorkloadSpread .Name ).To (gomega .Equal (workloadSpread .Name ))
1164
1177
gomega .Expect (pod .Spec .Affinity ).NotTo (gomega .BeNil ())
1165
1178
gomega .Expect (pod .Spec .Affinity .NodeAffinity .RequiredDuringSchedulingIgnoredDuringExecution .NodeSelectorTerms [0 ].MatchExpressions ).To (gomega .Equal (subset1 .RequiredNodeSelectorTerm .MatchExpressions ))
1179
+ gomega .Expect (pod .Spec .PriorityClassName ).To (gomega .Equal ("test-priority-class" ))
1180
+ gomega .Expect (* pod .Spec .Priority ).To (gomega .BeEquivalentTo (100 ))
1166
1181
gomega .Expect (pod .Annotations [workloadspread .PodDeletionCostAnnotation ]).To (gomega .Equal ("100" ))
1167
1182
}
1168
1183
} else {
0 commit comments