Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
Signed-off-by: MohammedAbdi <[email protected]>
  • Loading branch information
mamy-CS committed Feb 20, 2025
1 parent ea415f4 commit a503cd4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/controller/instaslice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,13 @@ func (r *InstasliceReconciler) removeInstasliceAllocation(ctx context.Context, a
return err
}
}
allocRequest := instaslice.Spec.PodAllocationRequests[podUid]
allocRequest, exists := instaslice.Spec.PodAllocationRequests[podUid]
// prevents using an empty allocRequest and logs an error when it's missing
if !exists {
log.Error(fmt.Errorf("podUid not found"), "Pod UID not found in Instaslice PodAllocationRequests", "podUid", podUid)
return fmt.Errorf("podUid %s not found in Instaslice PodAllocationRequests", podUid)
}

// update DeployedPodTotal Metrics by setting value to 0 as pod allocation is deleted
if err := r.UpdateDeployedPodTotalMetrics(string(allocation.Nodename), allocation.GPUUUID, allocRequest.PodRef.Namespace, allocRequest.PodRef.Name, allocRequest.Profile, 0); err != nil {
log.Error(err, "Failed to update deployed pod metrics", "nodeName", allocation.Nodename)
Expand Down

0 comments on commit a503cd4

Please sign in to comment.