From 2c19173a2d63e2097b9dc34bce1d5516e55e23fe Mon Sep 17 00:00:00 2001 From: modulitos Date: Tue, 26 Nov 2024 01:53:09 -0800 Subject: [PATCH] fix gracePeriodEnabled --- pkg/handler/handler.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/handler/handler.go b/pkg/handler/handler.go index a5df98090..3dee3ccbd 100644 --- a/pkg/handler/handler.go +++ b/pkg/handler/handler.go @@ -433,9 +433,10 @@ func (m *Modifier) buildPodPatchConfig(pod *corev1.Pod) *podPatchConfig { } // Use the STS WebIdentity method if set - request := cache.Request{Namespace: pod.Namespace, Name: pod.Spec.ServiceAccountName, RequestNotification: true} + gracePeriodEnabled := m.saLookupGraceTime > 0 + request := cache.Request{Namespace: pod.Namespace, Name: pod.Spec.ServiceAccountName, RequestNotification: gracePeriodEnabled} response := m.Cache.Get(request) - if !response.FoundInCache && m.saLookupGraceTime > 0 { + if !response.FoundInCache && gracePeriodEnabled { klog.Warningf("Service account %s not found in the cache. Waiting up to %s to be notified", request.CacheKey(), m.saLookupGraceTime) select { case <-response.Notifier: