Skip to content

Commit

Permalink
Preserve "flavor/color" in EKS cluster name abbreviation (#956)
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] authored Sep 9, 2024
1 parent 7b77797 commit a42555c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.ECR_AWS_ROLE }}
role-to-assume: ${{ vars.ECR_AWS_ROLE }}
aws-region: ${{ env.AWS_REGION }}
role-session-name: ${{ env.IAM_ROLE_SESSION_NAME }}

Expand Down
2 changes: 1 addition & 1 deletion os/alpine/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cryptography==42.0.7
cryptography==43.0.1
PyYAML==6.0.1
awscli==1.33.10
boto3==1.34.128
9 changes: 7 additions & 2 deletions rootfs/etc/profile.d/geodesic.kube-ps1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ function short_cluster_name_from_eks() {
local full_name=$(printf "%s" "$1" | cut -d/ -f2)
# remove namespace prefix if present
full_name=${full_name#${NAMESPACE}-}
# remove eks and everything after it, if present
full_name=${full_name%-eks-*}
# remove "-eks" and "-cluster" if present, leave the rest
full_name=${full_name/-eks-/-}
if [[ "$full_name" =~ -cluster(-.*)?$ ]]; then
# If true, remove '-cluster'
full_name="${full_name/-cluster/}"
fi

printf "%s" "${full_name}"
# If NAMESPACE is unset, delete everything before and including the first dash
# printf "%s" "$1" | sed -e 's%arn.*:cluster/'"${NAMESPACE:-[^-]\+}"'-\([^-]\+\)-eks-.*$%\1%'
Expand Down

0 comments on commit a42555c

Please sign in to comment.