Skip to content

Commit

Permalink
Refactor setReservationPodGpuIdxAnnotation to setReservationPodGpuIdx…
Browse files Browse the repository at this point in the history
…AnnotationIfNeeded
  • Loading branch information
gshaibi committed Mar 31, 2024
1 parent 03d580c commit 7b1e8e6
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ func (p *PodHandler) handleGpuReservationPodAddition(pod *v1.Pod, nodeTopology *
return nil
}

err := p.setReservationPodGpuIdxAnnotation(pod, nodeTopology)
err := p.setReservationPodGpuIdxAnnotationIfNeeded(pod, nodeTopology)
if err != nil {
return fmt.Errorf("failed to set GPU index annotation for reservation pod %s: %w", pod.Name, err)
}

return nil
}

func (p *PodHandler) setReservationPodGpuIdxAnnotation(pod *v1.Pod, nodeTopology *topology.NodeTopology) error {
func (p *PodHandler) setReservationPodGpuIdxAnnotationIfNeeded(pod *v1.Pod, nodeTopology *topology.NodeTopology) error {
// DEPRECATED: Prior to 2.17, the scheduler had set the GPU index annotation for the reservation pod,
// therefore we skip setting the annotation if it already exists to support backward compatibility.
if _, ok := pod.Annotations[constants.ReservationPodGpuIdxAnnotation]; ok {
Expand Down

0 comments on commit 7b1e8e6

Please sign in to comment.