Skip to content

Commit

Permalink
fix gracePeriodEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
modulitos committed Nov 26, 2024
1 parent 1b19f6f commit 2c19173
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2c19173

Please sign in to comment.