Skip to content

Commit 2d71c78

Browse files
authored
Fixes usage with EKS Pod Identity (#374)
1 parent 62ac698 commit 2d71c78

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

common/docker-entrypoint.d/00-check-for-required-env.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ elif [[ -v AWS_WEB_IDENTITY_TOKEN_FILE ]]; then
5757
AWS_ROLE_SESSION_NAME="nginx-s3-gateway"
5858
fi
5959

60+
# d) Using EKS pod identity. This is indicated by AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE being set.
61+
# See https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html.
62+
# Example: We are running inside an EKS cluster with a pod identity configured.
63+
elif [[ -v AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE ]]; then
64+
echo "Running inside EKS with EKS pod identity"
65+
if [[ ! -v AWS_ROLE_SESSION_NAME ]]; then
66+
# The default value is set as a nginx-s3-gateway unless the value is defined.
67+
AWS_ROLE_SESSION_NAME="nginx-s3-gateway"
68+
fi
69+
6070
elif [[ -v S3_ACCESS_KEY_ID ]]; then
6171
echo "Deprecated the S3_ACCESS_KEY_ID! Use the environment variable of AWS_ACCESS_KEY_ID instead"
6272
failed=1

0 commit comments

Comments
 (0)