Tighten validation on the qosClass field of pod status

This commit is contained in:
carlory
2024-10-30 10:43:06 +08:00
parent 1af81c223d
commit 9cb7d58b3c
3 changed files with 34 additions and 0 deletions

View File

@@ -14454,6 +14454,32 @@ func TestValidatePodStatusUpdate(t *testing.T) {
),
"",
"restartable init container can restart if RestartPolicyAlways",
}, {
*podtest.MakePod("foo",
podtest.SetStatus(core.PodStatus{
QOSClass: core.PodQOSBurstable,
}),
),
*podtest.MakePod("foo",
podtest.SetStatus(core.PodStatus{
QOSClass: core.PodQOSGuaranteed,
}),
),
"tatus.qosClass: Invalid value: \"Burstable\": field is immutable",
"qosClass can not be changed",
}, {
*podtest.MakePod("foo",
podtest.SetStatus(core.PodStatus{
QOSClass: core.PodQOSBurstable,
}),
),
*podtest.MakePod("foo",
podtest.SetStatus(core.PodStatus{
QOSClass: core.PodQOSBurstable,
}),
),
"",
"qosClass no change",
},
}