From 135aac3e3ad96338c0ab34a7c53222579eb5266f Mon Sep 17 00:00:00 2001 From: googs1025 Date: Thu, 28 Nov 2024 10:03:57 +0800 Subject: [PATCH 1/2] chore: fix README support volcano version Signed-off-by: googs1025 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f741515..ef46cfd 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The list of prerequisites for running the Volcano device plugin is described bel * nvidia-docker version > 2.0 (see how to [install](https://github.com/NVIDIA/nvidia-docker) and it's [prerequisites](https://github.com/nvidia/nvidia-docker/wiki/Installation-\(version-2.0\)#prerequisites)) * docker configured with nvidia as the [default runtime](https://github.com/NVIDIA/nvidia-docker/wiki/Advanced-topics#default-runtime). * Kubernetes version >= 1.16 -* Volcano verison >= 1.19 +* Volcano verison >= 1.9 ## Quick Start From 24ab2f15f8b6ad38c36a231d5a8cd2a4e24a7664 Mon Sep 17 00:00:00 2001 From: limengxuan <391013634@qq.com> Date: Fri, 13 Dec 2024 10:12:17 +0800 Subject: [PATCH 2/2] fix find pending pod error on multi nodes scenario Signed-off-by: limengxuan <391013634@qq.com> --- go.mod | 1 + pkg/plugin/vgpu/util/util.go | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 129e741..4c800f8 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/NVIDIA/go-nvml v0.12.4-0 github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20201109160820-d08ea3cdcce4 github.com/fsnotify/fsnotify v1.4.9 + github.com/mitchellh/gox v1.0.1 // indirect github.com/prometheus/client_golang v1.0.0 github.com/prometheus/common v0.4.1 github.com/spf13/cobra v0.0.5 diff --git a/pkg/plugin/vgpu/util/util.go b/pkg/plugin/vgpu/util/util.go index 9f8aac2..4f6f3d1 100644 --- a/pkg/plugin/vgpu/util/util.go +++ b/pkg/plugin/vgpu/util/util.go @@ -64,7 +64,7 @@ func GetPendingPod(node string) (*v1.Pod, error) { return nil, err } - oldestPod := getOldestPod(podList.Items) + oldestPod := getOldestPod(podList.Items, node) if oldestPod == nil { return nil, fmt.Errorf("cannot get valid pod") } @@ -72,15 +72,17 @@ func GetPendingPod(node string) (*v1.Pod, error) { return oldestPod, nil } -func getOldestPod(pods []v1.Pod) *v1.Pod { +func getOldestPod(pods []v1.Pod, nodename string) *v1.Pod { if len(pods) == 0 { return nil } oldest := pods[0] for _, pod := range pods { - klog.V(4).Infof("pod %s, predicate time: %s", pod.Name, pod.Annotations[AssignedTimeAnnotations]) - if getPredicateTimeFromPodAnnotation(&oldest) > getPredicateTimeFromPodAnnotation(&pod) { - oldest = pod + if pod.Annotations[AssignedNodeAnnotations] == nodename { + klog.V(4).Infof("pod %s, predicate time: %s", pod.Name, pod.Annotations[AssignedTimeAnnotations]) + if getPredicateTimeFromPodAnnotation(&oldest) > getPredicateTimeFromPodAnnotation(&pod) { + oldest = pod + } } } klog.V(4).Infof("oldest pod %#v, predicate time: %#v", oldest.Name,