Skip to content
Merged
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
51 changes: 51 additions & 0 deletions .github/workflows/update-eks-chart.yaml
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:
Comment thread
mselim00 marked this conversation as resolved.
- 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
53 changes: 53 additions & 0 deletions hack/update-efa-instance-types.sh
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"
2 changes: 1 addition & 1 deletion stable/aws-efa-k8s-device-plugin/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: aws-efa-k8s-device-plugin
description: A Helm chart for EFA device plugin.
version: v0.5.22
version: v0.5.23
appVersion: "v0.5.16"
home: https://github.com/aws/eks-charts
icon: https://raw.githubusercontent.com/aws/eks-charts/master/docs/logo/aws.png
Expand Down
Loading
Loading