Skip to content

Commit 9a8d1ad

Browse files
committed
fix gracePeriodEnabled
1 parent ad9a20a commit 9a8d1ad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/handler/handler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,10 @@ func (m *Modifier) buildPodPatchConfig(pod *corev1.Pod) *podPatchConfig {
433433
}
434434

435435
// Use the STS WebIdentity method if set
436-
request := cache.Request{Namespace: pod.Namespace, Name: pod.Spec.ServiceAccountName, RequestNotification: true}
436+
gracePeriodEnabled := m.saLookupGraceTime > 0
437+
request := cache.Request{Namespace: pod.Namespace, Name: pod.Spec.ServiceAccountName, RequestNotification: gracePeriodEnabled}
437438
response := m.Cache.Get(request)
438-
if !response.FoundInCache && m.saLookupGraceTime > 0 {
439+
if !response.FoundInCache && gracePeriodEnabled {
439440
klog.Warningf("Service account %s not found in the cache. Waiting up to %s to be notified", request.CacheKey(), m.saLookupGraceTime)
440441
select {
441442
case <-response.Notifier:

0 commit comments

Comments
 (0)