Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
cybergeek2077 authored Dec 24, 2024
2 parents 4576c36 + b54431c commit b92df5e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions pkg/plugin/vgpu/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ 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")
}

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
}
Expand All @@ -96,6 +96,13 @@ func getOldestPod(pods []v1.Pod) *v1.Pod {
continue
}
}
if assignedNodeAnnotations, ok := pod.Annotations[AssignedNodeAnnotations]; !ok {
continue
} else {
if strings.Compare(assignedNodeAnnotations, nodename) != 0 {
continue
}
}
klog.V(4).Infof("pod %s, predicate time: %s", pod.Name, pod.Annotations[AssignedTimeAnnotations])
if oldest == nil || getPredicateTimeFromPodAnnotation(oldest) > getPredicateTimeFromPodAnnotation(&pod) {
oldest = &pods[i]
Expand Down

0 comments on commit b92df5e

Please sign in to comment.