Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: Viktor Kramarenko <viktor.kramarenko@flant.com>
  • Loading branch information
ViktorKram committed Apr 10, 2024
1 parent 81da1db commit 7defc29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (c *Cache) AddPVC(lvgName string, pvc *v1.PersistentVolumeClaim) error {
return err
}

// this case might be triggered if the controller recovers after fail and finds some pending pvcs with selected nodes
// this case might be triggered if the extender recovers after fail and finds some pending pvcs with selected nodes
c.log.Trace(fmt.Sprintf("[AddPVC] PVC %s/%s annotations: %v", pvc.Namespace, pvc.Name, pvc.Annotations))
if pvc.Annotations[SelectedNodeAnnotation] != "" {
c.log.Debug(fmt.Sprintf("[AddPVC] PVC %s/%s has selected node anotation, selected node: %s", pvc.Namespace, pvc.Name, pvc.Annotations[SelectedNodeAnnotation]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ func (s *scheduler) filter(w http.ResponseWriter, r *http.Request) {
for _, pvc := range pvcs {
s.log.Trace(fmt.Sprintf("[filter] Pod %s/%s uses PVC: %s", input.Pod.Namespace, input.Pod.Name, pvc.Name))

// this might happen when the extender-scheduler recovers after failure, populates the cache with PVC-watcher controller and then
// the kube scheduler post a request to schedule the pod with the PVC.
if s.cache.CheckIsPVCCached(pvc) {
s.log.Debug(fmt.Sprintf("[filter] PVC %s/%s has been already stored in the cache. It will be removed due the conflicts", pvc.Namespace, pvc.Name))
s.cache.RemovePVCSpaceReservationForced(pvc)
Expand Down Expand Up @@ -636,8 +638,7 @@ func getUsedPVC(ctx context.Context, cl client.Client, log logger.Logger, pod *c
return nil, err
}

for pvcName, pvc := range pvcMap {
log.Trace(fmt.Sprintf("KEY NAME: %s, VALUE NAME: %s", pvcName, pvc.Name))
for pvcName := range pvcMap {
log.Trace(fmt.Sprintf("[getUsedPVC] PVC %s is in namespace %s", pod.Namespace, pvcName))
}

Expand All @@ -650,8 +651,6 @@ func getUsedPVC(ctx context.Context, cl client.Client, log logger.Logger, pod *c
}
}

log.Trace(fmt.Sprintf("[getUsedPVC] HERE Pod %s/%s uses PVC: %v", pod.Namespace, pod.Name, usedPvc))

return usedPvc, err
}

Expand Down

0 comments on commit 7defc29

Please sign in to comment.