ci: use aws IAM roles for AWS access #2192
<!-- devin-review-comment {"id": "BUG_pr-review-job-0b4cd0a886ce4c848efd4cf1a2a9fa8e_0001", "file_path": ".github/workflows/e2e.yaml", "start_line": 45, "end_line": 48, "side": "RIGHT", "based_on_repo_rules": false, "kind": "bug"} -->
🔴 Missing OIDC grant blocks GPU tests
When CI invokes the end-to-end job, configure-aws-credentials cannot request a GitHub OIDC token because neither workflow grants id-token: write. Without preconfigured AWS credentials, the job stops before provisioning the GPU cluster.
<details>
<summary>Learn more</summary>
GitHub’s OIDC token lets a CI job assume an AWS role without a long-lived access key. The end-to-end caller inherits secrets, but that does not grant permission to request an OIDC token. The new AWS step supplies a role ARN and no source keys. Without an OIDC token, the action tries the runner’s existing AWS credential chain and fails when that chain is empty.
Example: After the image build succeeds on a push to main, the AWS setup step fails on a runner with no AWS credentials, even with a valid AWS_ROLE_ARN. Holodeck never starts.
Recommended fix: Set id-token: write and contents: read under permissions on the e2e-test caller job. The first grants token issuance; the second preserves checkout access when the job uses an explicit permission set.
</details>
<!-- devin-review-badge-begin -->
<a href="https://nvidia-cloud.devinenterprise.com/review/nvidia/k8s-device-plugin/pull/2192" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
---
Was this helpful? React with 👍 or 👎 to provide feedback.
<!-- devin-review-comment {"id": "ANALYSIS_pr-review-job-0b4cd0a886ce4c848efd4cf1a2a9fa8e_0001", "file_path": ".github/workflows/e2e.yaml", "start_line": 56, "end_line": 56, "side": "RIGHT", "kind": "analysis"} -->
🔍 Two-hour session exceeds IAM default
role-duration-seconds requests two hours. AWS rejects that request when the role retains IAM’s default one-hour maximum. Verify the deployed role allows two-hour sessions.
<!-- devin-review-badge-begin -->
<a href="https://nvidia-cloud.devinenterprise.com/review/nvidia/k8s-device-plugin/pull/2192" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
---
Was this helpful? React with 👍 or 👎 to provide feedback.
Devin Review found 2 potential issues.
<!-- devin-review-badge-begin -->
<a href="https://nvidia-cloud.devinenterprise.com/review/nvidia/k8s-device-plugin/pull/2192" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
✅ Resolved: Resolved: the current reusable workflow declares top-level id-token: write and contents: read, granting OIDC token access to the called workflow. The reported missing permission no longer applies.
The 2 hour configuration is intentional.
Question -- where is env.AWS_SESSION_TOKEN defined? Is this populated in the prior step?
Correct, all the three AWS values are now envars set by the github action aws-actions/configure-aws-credentials
Ack. And do we need to wait for https://github.com/NVIDIA/holodeck/pull/965 to land, or will this PR work as is? Edit: CI passed so I assume this works as is.
It looks like it's working as-is. I am a bit surprised.
do we need to wait for https://github.com/NVIDIA/holodeck/pull/965 to land
Initially, I thought this was required. The CI passing here suggests that it's not the case
Could it be because AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are still defined as project level secrets, and therefore, are still being populated in this CI job and used by holodeck?
I can remove the secrets and re-run the e2e job.
e2e re-run in progress - https://github.com/NVIDIA/k8s-device-plugin/actions/runs/47229644365/job/144716083122?pr=2192
The e2e re-run seems to have passed.
Approved these changes.
/cherry-pick release-0.20
❌ Failed to create backport PR for release-0.20
Error: Command failed: git push --force-with-lease origin backport-2192-to-release-0.20
Please backport manually.
cdesiniotis
tariq1890
This PR introduces support for AWS IAM roles as the means for accessing AWS resources replacing AWS IAM access keys.
Suggested reading: https://builder.aws.com/content/3KgNjGwC0aqjNb6gdBo2Bkpgbud/aws-iam-roles-vs-access-keys-understanding-secure-access