mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 05:14:13 +01:00
refactor: add SetMirrorPodAnnotation helper function
This commit is contained in:
@@ -156,9 +156,7 @@ func TestDeletePodsViolatingNodeTaints(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
p10 := buildTestPodWithNormalOwnerRef("p10", nodeName2, func(pod *v1.Pod) {
|
p10 := buildTestPodWithNormalOwnerRef("p10", nodeName2, test.SetMirrorPodAnnotation)
|
||||||
pod.Annotations = test.GetMirrorPodAnnotation()
|
|
||||||
})
|
|
||||||
p11 := buildTestPodWithNormalOwnerRef("p11", nodeName2, nil)
|
p11 := buildTestPodWithNormalOwnerRef("p11", nodeName2, nil)
|
||||||
p12 := buildTestPodWithNormalOwnerRef("p11", nodeName2, func(pod *v1.Pod) {
|
p12 := buildTestPodWithNormalOwnerRef("p11", nodeName2, func(pod *v1.Pod) {
|
||||||
pod.Spec.NodeSelector = map[string]string{
|
pod.Spec.NodeSelector = map[string]string{
|
||||||
|
|||||||
@@ -252,6 +252,11 @@ func SetNormalOwnerRef(pod *v1.Pod) {
|
|||||||
pod.ObjectMeta.OwnerReferences = GetNormalPodOwnerRefList()
|
pod.ObjectMeta.OwnerReferences = GetNormalPodOwnerRefList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetMirrorPodAnnotation sets the given pod's annotations to mirror pod annotations
|
||||||
|
func SetMirrorPodAnnotation(pod *v1.Pod) {
|
||||||
|
pod.Annotations = GetMirrorPodAnnotation()
|
||||||
|
}
|
||||||
|
|
||||||
// SetPodPriority sets the given pod's priority
|
// SetPodPriority sets the given pod's priority
|
||||||
func SetPodPriority(pod *v1.Pod, priority int32) {
|
func SetPodPriority(pod *v1.Pod, priority int32) {
|
||||||
pod.Spec.Priority = &priority
|
pod.Spec.Priority = &priority
|
||||||
|
|||||||
Reference in New Issue
Block a user