Skip to content

Commit

Permalink
Merge pull request #8 from quobyte/fix_sticky_cache
Browse files Browse the repository at this point in the history
Fix sticky cache
  • Loading branch information
venkatsc authored Jun 20, 2024
2 parents fe6b42f + 44eab50 commit 7ce73b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM ubuntu:22.04

RUN apt-get -y update && apt-get -y upgrade && apt-get install -y attr
RUN apt-get -y update && apt-get -y upgrade && apt-get install -y attr \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

ADD pod_killer /bin

Expand Down
15 changes: 15 additions & 0 deletions csi_mounts_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,27 @@ func (csiMountMonitor *CsiMountMonitor) resolvePodsWithStaleMounts(
}
}
if resolvedPods, err := csiMountMonitor.resolvePods(batch); err != nil {
podDeduplicatorMux.Lock()
for _, staleMount := range batch { // remove and let it be requeued for resolution
delete(podDeduplicator, staleMount.PodUid)
}
podDeduplicatorMux.Unlock()
klog.Errorf("Could not resolve pod(s) to name/namespace due to %s. Will retry later again.", err)
} else {
resolvedPodUids := make(map[string]bool)
for _, pod := range resolvedPods.Pods {
klog.Infof("Resolved pod uid %s to %s/%s", pod.Uid, pod.Namespace, pod.Name)
resolvedPodsChannel <- pod
resolvedPodUids[pod.Uid] = true
}
podDeduplicatorMux.Lock()
for _, staleMount := range batch {
if _, ok := resolvedPodUids[staleMount.PodUid]; !ok {
// Pod was not resolved, so let it be requeued again
delete(podDeduplicator, staleMount.PodUid)
}
}
podDeduplicatorMux.Unlock()
}
}
}
Expand Down

0 comments on commit 7ce73b3

Please sign in to comment.