Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/v1beta1"
_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
12 changes: 12 additions & 0 deletions providers/amazon/tests/unit/amazon/aws/hooks/test_eks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,3 +1318,15 @@ def assert_is_valid_uri(value: str) -> None:

assert all([result.scheme, result.netloc, result.path])
assert REGION in value


class TestEksHookShellCompatibility:
"""Test shell compatibility for EKS credential loading."""

def test_command_template_is_posix_compliant(self):
"""Verify the COMMAND template uses POSIX-compliant dot operator, not bash-specific source."""
from airflow.providers.amazon.aws.hooks.eks import COMMAND

# The command should use '.' (dot operator) not 'source'
assert ". {credentials_file}" in COMMAND
assert "source {credentials_file}" not in COMMAND
Loading