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

refactor: replace pod.Spec.Volumes with test.SetHostPathEmptyDirVolumeSource in plugin tests

This commit is contained in:
Jan Chaloupka
2025-12-21 18:04:15 +01:00
parent fc8ae3b4e8
commit 988e0b8868
7 changed files with 36 additions and 248 deletions

View File

@@ -262,6 +262,20 @@ func SetPodPriority(pod *v1.Pod, priority int32) {
pod.Spec.Priority = &priority
}
func SetHostPathEmptyDirVolumeSource(pod *v1.Pod) {
pod.Spec.Volumes = []v1.Volume{
{
Name: "sample",
VolumeSource: v1.VolumeSource{
HostPath: &v1.HostPathVolumeSource{Path: "somePath"},
EmptyDir: &v1.EmptyDirVolumeSource{
SizeLimit: resource.NewQuantity(int64(10), resource.BinarySI),
},
},
},
}
}
// SetNodeUnschedulable sets the given node unschedulable
func SetNodeUnschedulable(node *v1.Node) {
node.Spec.Unschedulable = true