Skip to content

Commit 8aa70f9

Browse files
djnalluridekobon
authored andcommitted
Add code comments
1 parent 64b5e18 commit 8aa70f9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

common/etc/nginx/include/s3gateway.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,15 +1045,24 @@ async function _fetchWebIdentityCredentials(r) {
10451045

10461046
var sts_endpoint = process.env['STS_ENDPOINT'];
10471047
if (!sts_endpoint) {
1048+
// On EKS, the ServiceAccount can be annotated with 'eks.amazonaws.com/sts-regional-endpoints' to control
1049+
// the usage of regional endpoints. We are using the same standard environment variable here as
1050+
// the AWS SDK. This is with the exception of replacing the value `legacy` with `global` to match
1051+
// what EKS sets the variable to.
1052+
// https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html
1053+
// https://docs.aws.amazon.com/eks/latest/userguide/configure-sts-endpoint.html
10481054
var sts_regional = process.env['AWS_STS_REGIONAL_ENDPOINTS'] || 'global';
10491055
if (sts_regional === 'regional') {
1056+
// STS regional endpoints can be derived from the region's name.
1057+
// https://docs.aws.amazon.com/general/latest/gr/sts.html
10501058
var region = process.env['AWS_REGION'];
10511059
if (region) {
10521060
sts_endpoint = `https://sts.${region}.amazonaws.com`;
10531061
} else {
10541062
throw 'Missing required AWS_REGION env variable';
10551063
}
10561064
} else {
1065+
// This is the default global endpoint
10571066
sts_endpoint = 'https://sts.amazonaws.com';
10581067
}
10591068
}

docs/getting_started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ modified.
268268
aws cloudformation delete-stack \
269269
--stack-name nginx-s3-gateway
270270
```
271+
271272
## Running on EKS with IAM roles for service accounts
272273

273274
If you are planning to use the container image on an EKS cluster, you can use a [service account]((https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html)) which can assume a role using [AWS Security Token Service](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html).

0 commit comments

Comments
 (0)