ramitkataria commented on code in PR #77163:
URL: https://github.com/apache/airflow/pull/77163#discussion_r4648082112
##########
providers/amazon/src/airflow/providers/amazon/aws/hooks/eks.py:
##########
@@ -669,11 +669,10 @@ 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"]
+ # EKS needs the regional STS endpoint, which botocore uses by default
since 1.40. Do not set
+ # AWS_STS_REGIONAL_ENDPOINTS here: the environment is shared by every
trigger in the triggerer.
+ sts_endpoint =
StsHook(region_name=session.region_name).conn_client_meta.endpoint_url
Review Comment:
Thanks! The session-scoped setting works. I checked the merged version with
`AWS_STS_REGIONAL_ENDPOINTS=legacy` and with `sts_regional_endpoints = legacy`
in the AWS config file, and the kubeconfig gets the regional endpoint in both
cases.
One side effect of building the STS client from the hook's connection: a
connection-wide `endpoint_url` on the EKS connection now ends up as the STS
URL, and EKS rejects the token. I just opened a PR for a fix is in #77419.
Agreed on `AwsEksExecutor`: this one is merged now so let me know if you
would like to take that in a separate PR, otherwise I can go ahead and make one
instead
--
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]