-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore(efa-device-plugin): add latest EFA instance types #1278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Update EFA Device Plugin Instance Types | ||
|
|
||
| on: | ||
| workflow_dispatch: {} | ||
| schedule: | ||
| - cron: "0 17 * * 1-5" # Every Mon-Friday at 09:00 PST | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| generate-limits: | ||
| environment: efa-updater | ||
| if: github.repository == 'aws/eks-charts' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # refs/tags/v4.1.7 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Set up AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@5579c002bb4778aa43395ef1df492868a9a1c83f # refs/tags/v4.0.2 | ||
| with: | ||
| role-to-assume: ${{ secrets.UPDATE_CHARTS_AWS_ROLE_ARN }} | ||
| role-duration-seconds: 900 | ||
| aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | ||
| - name: Run ./hack/update-efa-instance-types.sh | ||
| run: | | ||
| YQ_VERSION=v4.2.0 | ||
| YQ_PLATFORM=linux_amd64 | ||
| wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_${YQ_PLATFORM} -O /usr/local/bin/yq &&\ | ||
| chmod +x /usr/local/bin/yq | ||
|
|
||
| ./hack/update-efa-instance-types.sh | ||
|
|
||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # refs/tags/v7.0.9 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| commit-message: "chore(efa-device-plugin): add latest EFA instance types" | ||
| title: "chore(efa-device-plugin): add latest EFA instance types" | ||
| body: | | ||
| This PR updates adds the latest EFA supported instance types to the EFA device plugin chart by running `./hack/update-efa-instance-types.sh`. | ||
|
|
||
| ## Testing | ||
| Please verify that the chart version is correctly bumped and no in-use instance types are removed. | ||
| branch: automated/update-efa-instance-types | ||
| base: master | ||
| delete-branch: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # This script requires yq >= v4, install it here: | ||
| # https://github.com/mikefarah/yq/?tab=readme-ov-file#install | ||
|
|
||
| PROJECT_ROOT=$(git rev-parse --show-toplevel) | ||
| EFA_CHART_DIRECTORY="${PROJECT_ROOT}/stable/aws-efa-k8s-device-plugin" | ||
|
|
||
| CHART_FILE="${EFA_CHART_DIRECTORY}/Chart.yaml" | ||
| if git diff --quiet --exit-code -- "$CHART_FILE" || \ | ||
| ! git diff "$CHART_FILE" | grep -q '^[-+]version:'; then | ||
| # Increment patch version if version hasn't already been incremented | ||
| VERSION=$(yq eval '.version' "$CHART_FILE") | ||
| BARE="${VERSION#v}" | ||
| IFS='.' read -r MAJOR MINOR PATCH <<< "$BARE" | ||
| NEW_VERSION="v${MAJOR}.${MINOR}.$((PATCH + 1))" | ||
| yq eval -i ".version = \"${NEW_VERSION}\"" "$CHART_FILE" | ||
| else | ||
| echo "Version already changed; skipping increment" | ||
| fi | ||
|
|
||
| # Get list of opted-in regions | ||
| mapfile -t REGIONS < <( | ||
| aws ec2 describe-regions \ | ||
| --query 'Regions[?OptInStatus==`opt-in-not-required` || OptInStatus==`opted-in`].RegionName' \ | ||
| --output text \ | ||
| | tr '\t' '\n' | ||
| ) | ||
|
|
||
| # Hard code just preview instance types or ones that may not show up in Describe responses | ||
| ALL_TYPES=("p6e-gb200.36xlarge" "trn2-ac.24xlarge" "trn2u-ac.24xlarge" "trn2u.48xlarge") | ||
|
|
||
| # Fetch instance types from each region | ||
| for REGION in "${REGIONS[@]}"; do | ||
| echo "Getting EFA instance types in $REGION" | ||
| mapfile -t TYPES < <( | ||
| aws ec2 describe-instance-types \ | ||
| --region "$REGION" \ | ||
| --filters "Name=network-info.efa-supported,Values=true" \ | ||
| --query 'InstanceTypes[*].InstanceType' \ | ||
| --output text \ | ||
| | tr '\t' '\n' \ | ||
| | sed '/^$/d') | ||
|
|
||
| ALL_TYPES+=("${TYPES[@]}") | ||
| done | ||
|
|
||
| # Deduplicate + sort, then build a yq array expression | ||
| YQ_ARRAY=$(printf '%s\n' "${ALL_TYPES[@]}" | sort -u | sed 's/.*/"&"/' | paste -sd, -) | ||
|
|
||
| VALUES_FILE="${EFA_CHART_DIRECTORY}/values.yaml" | ||
| yq eval -i ".supportedInstanceLabels.values = [${YQ_ARRAY}]" "$VALUES_FILE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.