SameerMesiah97 commented on code in PR #63020:
URL: https://github.com/apache/airflow/pull/63020#discussion_r2963052874


##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py:
##########
@@ -620,11 +619,11 @@ def generate_config_file(
         cluster_cert = cluster["cluster"]["certificateAuthority"]["data"]
         cluster_ep = cluster["cluster"]["endpoint"]
 
-        os.environ["AWS_STS_REGIONAL_ENDPOINTS"] = "regional"
-        try:
-            sts_url = 
f"{StsHook(region_name=session.region_name).conn_client_meta.endpoint_url}/?Action=GetCallerIdentity&Version=2011-06-15"
-        finally:
-            del os.environ["AWS_STS_REGIONAL_ENDPOINTS"]
+        # Construct regional STS URL directly to avoid modifying 
process-global os.environ.
+        # EKS token generation requires a regional STS endpoint.
+        sts_url = (
+            
f"https://sts.{session.region_name}.amazonaws.com/?Action=GetCallerIdentity&Version=2011-06-15";
+        )

Review Comment:
   > You're reintroducing a bug that was fixed very intentionally. Please do 
not hardcode `amazonaws.com` this ignores different endpoints for china. Also 
some global endpoints don't default to regional so you need this environment 
variable set. 
   
   I think this should be explained in a comment.
   
   > If you're very concerned we could store the original value and set that 
back.
    
   IMO, this should make be done as well for added safety.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to