Skip to content

Commit d1232e0

Browse files
jinglinliangk8s-infra-cherrypick-robot
authored andcommitted
Add unit test to allow draining when StatefulSet kind has custom API Group
1 parent 292bf72 commit d1232e0

File tree

1 file changed

+24
-0
lines changed
  • cluster-autoscaler/simulator/drainability/rules/replicacount

1 file changed

+24
-0
lines changed

cluster-autoscaler/simulator/drainability/rules/replicacount/rule_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,30 @@ func TestDrainable(t *testing.T) {
243243
wantReason: drain.ControllerNotFound,
244244
wantError: true,
245245
},
246+
"SS-managed pod by a custom API Group": {
247+
pod: &apiv1.Pod{
248+
ObjectMeta: metav1.ObjectMeta{
249+
Name: "bar",
250+
Namespace: "default",
251+
OwnerReferences: test.GenerateOwnerReferences(statefulset.Name, "StatefulSet", "kruise/v1", ""),
252+
},
253+
Spec: apiv1.PodSpec{
254+
NodeName: "node",
255+
},
256+
},
257+
},
258+
"SS-managed pod by a custom API Group with missing reference": {
259+
pod: &apiv1.Pod{
260+
ObjectMeta: metav1.ObjectMeta{
261+
Name: "bar",
262+
Namespace: "default",
263+
OwnerReferences: test.GenerateOwnerReferences("missing", "StatefulSet", "kruise/v1", ""),
264+
},
265+
Spec: apiv1.PodSpec{
266+
NodeName: "node",
267+
},
268+
},
269+
},
246270
"RS-managed pod": {
247271
pod: &apiv1.Pod{
248272
ObjectMeta: metav1.ObjectMeta{

0 commit comments

Comments
 (0)