1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 05:14:13 +01:00

Update CriticalPod unit test

The kubelet used to only determine critical pods by the namespace and an annotation (see [1], where our code switched from only checking the annotation to using the kubelet package helper, which at that revision also only checked for an annotation and namespace). However, now the kubelet uses Pod Priority to check for critical pods[3], which is controlled by an admission plugin[4]. Given that testing the functioning of the admission plugin is out of the scope of this repository, it is probably sufficient to manually set the pod priority to critical, to ensure that our Descheduler code behaves properly in response.

[1] 062b8698c7 (diff-094ac8507e224603239ce19592b518f5)
[2] https://github.com/kubernetes/kubernetes/blob/release-1.9/pkg/kubelet/types/pod_update.go#L151
[3] https://github.com/kubernetes/kubernetes/blob/a847874655/pkg/kubelet/types/pod_update.go#L153
[4] https://github.com/kubernetes/kubernetes/blob/a847874655/plugin/pkg/admission/priority/admission.go
This commit is contained in:
Mike Dame
2019-10-11 16:54:45 -04:00
parent bd2c217010
commit 9ea6aa536e

View File

@@ -21,6 +21,7 @@ import (
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/kubernetes/pkg/apis/scheduling"
"sigs.k8s.io/descheduler/test"
)
@@ -208,6 +209,8 @@ func TestPodTypes(t *testing.T) {
// A Critical Pod.
p5.Namespace = "kube-system"
p5.Annotations = test.GetCriticalPodAnnotation()
systemCriticalPriority := scheduling.SystemCriticalPriority
p5.Spec.Priority = &systemCriticalPriority
if !IsMirrorPod(p4) {
t.Errorf("Expected p4 to be a mirror pod.")
}