Skip to content

Commit

Permalink
ci: Tag OIDC using cluster name for clean-up (aws#4387)
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam authored Aug 7, 2023
1 parent 61a05bb commit d035561
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions .github/actions/e2e/create-cluster/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,10 @@ runs:
if: always()
shell: bash
run: |
for arn in $(aws iam list-open-id-connect-providers --query "OpenIDConnectProviderList[*].{ARN:Arn}" --output text); do
tags=$(aws iam list-open-id-connect-provider-tags --open-id-connect-provider-arn $arn --output json)
if [[ $(echo $tags | jq -r '.Tags[] | select(.Key == "alpha.eksctl.io/cluster-name") | .Value') == "${{ inputs.cluster_name }}" ]]; then
aws iam tag-open-id-connect-provider --open-id-connect-provider-arn $arn \
--tags Key=testing.karpenter.sh/type,Value=e2e Key=github.com/run-url,Value=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
break
fi
done
oidc_id=$(aws eks describe-cluster --name ${{ inputs.cluster_name }} --query "cluster.identity.oidc.issuer" --output text | cut -d '/' -f 3,4,5)
arn="arn:aws:iam::${{ inputs.account_id }}:oidc-provider/${oidc_id}"
aws iam tag-open-id-connect-provider --open-id-connect-provider-arn $arn \
--tags Key=testing.karpenter.sh/type,Value=e2e Key=github.com/run-url,Value=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: give KarpenterNodeRole permission to bootstrap
shell: bash
run: |
Expand Down

0 comments on commit d035561

Please sign in to comment.