From 115208217de5ba25bbe3e5159219b20c7000b8fc Mon Sep 17 00:00:00 2001 From: JU4N98 Date: Tue, 24 Oct 2023 16:20:57 -0300 Subject: [PATCH] Uses expiry time to renew JWT svid. Signed-off-by: JU4N98 --- pkg/sidecar/sidecar.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/sidecar/sidecar.go b/pkg/sidecar/sidecar.go index 0ef0b159..30e91492 100644 --- a/pkg/sidecar/sidecar.go +++ b/pkg/sidecar/sidecar.go @@ -270,6 +270,7 @@ func (s *Sidecar) updateJWTSVID(ctx context.Context, options ...workloadapi.Clie s.config.Log.Infof("Updating JWT SVID") jwtSVID, err := s.fetchJWTSVID(options...) if err != nil { + time.Sleep(time.Second) continue } @@ -278,8 +279,7 @@ func (s *Sidecar) updateJWTSVID(ctx context.Context, options ...workloadapi.Clie s.writeJSON(certs) s.config.Log.Infof("JWT SVID updated") - - time.Sleep(time.Minute) + time.Sleep(time.Until(jwtSVID.Expiry)/2 + 1*time.Second) } } }