Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from airflow.utils import yaml

DEFAULT_PAGINATION_TOKEN = ""
AUTHENTICATION_API_VERSION = "client.authentication.k8s.io/v1alpha1"
AUTHENTICATION_API_VERSION = "client.authentication.k8s.io/v1"
_POD_USERNAME = "aws"
_CONTEXT_NAME = "aws"

Expand Down Expand Up @@ -79,8 +79,8 @@ class NodegroupStates(Enum):
COMMAND = """
export PYTHON_OPERATORS_VIRTUAL_ENV_MODE=1

# Source credentials from secure file
source {credentials_file}
# Load credentials from secure file using (POSIX-compliant dot operator)
. {credentials_file}

output=$({python_executable} -m airflow.providers.amazon.aws.utils.eks_get_token \
--cluster-name {eks_cluster_name} --sts-url '{sts_url}' {args} 2>&1)
Expand Down
4 changes: 2 additions & 2 deletions providers/amazon/tests/unit/amazon/aws/hooks/test_eks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,13 +1261,13 @@ def test_generate_config_file(self, mock_conn, aws_conn_id, region_name, expecte
user = config["users"][0]
assert user["name"] == "aws"
exec_config = user["user"]["exec"]
assert exec_config["apiVersion"] == "client.authentication.k8s.io/v1alpha1"
assert exec_config["apiVersion"] == "client.authentication.k8s.io/v1"
assert exec_config["command"] == "sh"
assert exec_config["interactiveMode"] == "Never"

# Verify the command references a credential file (not inline creds)
command_arg = exec_config["args"][1] # The -c argument content
assert f"source {credentials_file}" in command_arg
assert f". {credentials_file}" in command_arg # The dot operator is used for POSIX-compliance

# Verify region arguments are properly included
if expected_region_args:
Expand Down