File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change 1515
1616SA_TOKEN_PATH = os .environ .get ("SA_TOKEN_PATH" , "/var/run/secrets/eks.amazonaws.com/serviceaccount/token" )
1717AWS_ASSUME_ROLE = os .environ .get ("AWS_ASSUME_ROLE" )
18+ AWS_REFRESH_CREDS_SEC = int (os .environ .get ("AWS_REFRESH_CREDS_SEC" , "900" )) # 15 minutes
1819
1920class AWSPrometheusConnect (CustomPrometheusConnect ):
2021 def __init__ (
@@ -99,7 +100,7 @@ def _assume_role(self, role_arn: str) -> None:
99100 def _build_auth (self ) -> SigV4Auth :
100101 """Builds fresh SigV4 auth with current credentials (handles rotation)."""
101102 try :
102- if self ._last_init_at is None or (datetime .utcnow () - self ._last_init_at ).total_seconds () >= 900 :
103+ if self ._last_init_at is None or (datetime .utcnow () - self ._last_init_at ).total_seconds () >= AWS_REFRESH_CREDS_SEC :
103104 logging .debug ("Fifteen minutes passed; re-initializing AWS credentials" )
104105 self .init_credentials ()
105106 except Exception :
You can’t perform that action at this time.
0 commit comments