Skip to content

Commit 66cab24

Browse files
mohsenmottaghiscottrigby
authored andcommitted
fix: use namespace-scoped watching to avoid cluster-wide LIST permissions
Signed-off-by: Mohsen Mottaghi <[email protected]> (cherry picked from commit 3dd54ed)
1 parent abf2007 commit 66cab24

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/kube/statuswait.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ func (w *statusWaiter) waitForDelete(ctx context.Context, resourceList ResourceL
113113
}
114114
resources = append(resources, obj)
115115
}
116-
eventCh := sw.Watch(cancelCtx, resources, watcher.Options{})
116+
eventCh := sw.Watch(cancelCtx, resources, watcher.Options{
117+
RESTScopeStrategy: watcher.RESTScopeNamespace,
118+
})
117119
statusCollector := collector.NewResourceStatusCollector(resources)
118120
done := statusCollector.ListenWithObserver(eventCh, statusObserver(cancel, status.NotFoundStatus))
119121
<-done
@@ -156,7 +158,9 @@ func (w *statusWaiter) wait(ctx context.Context, resourceList ResourceList, sw w
156158
resources = append(resources, obj)
157159
}
158160

159-
eventCh := sw.Watch(cancelCtx, resources, watcher.Options{})
161+
eventCh := sw.Watch(cancelCtx, resources, watcher.Options{
162+
RESTScopeStrategy: watcher.RESTScopeNamespace,
163+
})
160164
statusCollector := collector.NewResourceStatusCollector(resources)
161165
done := statusCollector.ListenWithObserver(eventCh, statusObserver(cancel, status.CurrentStatus))
162166
<-done

0 commit comments

Comments
 (0)