Skip to content

Commit

Permalink
Adds step to get RDS DB Cluster Identifier per each cluster (#136)
Browse files Browse the repository at this point in the history
This commit adds a step that maps from the EKS
cluster to the RDS DB cluster identifier, so that we can get the
endpoint and the credentials that are going to be used by the sample app
in both Python and Java.
  • Loading branch information
georgeboc authored Jul 26, 2024
1 parent af5bff3 commit 8cdc51d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/java-eks-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,24 @@ jobs:
- name: Get RDS database cluster metadata
continue-on-error: true
run: |
RDS_MYSQL_CLUSTER_ENDPOINT=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier "rdsaurorajavaclusterformysql" --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].Endpoint" --output text)
if [ "${{ env.CLUSTER_NAME }}" = "e2e-enablement-script-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraenablementscriptpythone2eclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-cw-agent-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroracwagente2eclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-adot-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraadote2eclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-cw-agent-operator-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroracwagentoperatore2eclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-canary-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsaurorajavaclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-playground" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraplaygroundclusterformysql"
else
echo "${{ env.CLUSTER_NAME }} is not a known cluster name"
exit 1
fi
RDS_MYSQL_CLUSTER_ENDPOINT=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier $RDS_MYSQL_CLUSTER_IDENTIFIER --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].Endpoint" --output text)
echo RDS_MYSQL_CLUSTER_ENDPOINT="$RDS_MYSQL_CLUSTER_ENDPOINT" >> $GITHUB_ENV
RDS_MYSQL_CLUSTER_IDENTIFIER=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier "rdsaurorajavaclusterformysql" --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].DBClusterIdentifier" --output text)
RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME=$(aws secretsmanager list-secrets --region ${{inputs.aws-region}} --query "SecretList[?Tags[?Value=='arn:aws:rds:${{inputs.aws-region}}:${{env.ACCOUNT_ID}}:cluster:$RDS_MYSQL_CLUSTER_IDENTIFIER']].Name" --output text)
echo RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME="$RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME" >> $GITHUB_ENV
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/python-eks-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,24 @@ jobs:
- name: Get RDS database cluster metadata
continue-on-error: true
run: |
RDS_MYSQL_CLUSTER_ENDPOINT=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier "rdsaurorapythonclusterformysql" --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].Endpoint | [0]" --output text)
if [ "${{ env.CLUSTER_NAME }}" = "e2e-enablement-script-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraenablementscriptpythone2eclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-cw-agent-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroracwagente2eclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-python-adot-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraadotpythone2eclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-cw-agent-operator-python-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroracwagentoperatorpythone2eclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-python-canary-test" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsaurorapythonclusterformysql"
elif [ "${{ env.CLUSTER_NAME }}" = "e2e-playground" ]; then
RDS_MYSQL_CLUSTER_IDENTIFIER="rdsauroraplaygroundclusterformysql"
else
echo "${{ env.CLUSTER_NAME }} is not a known cluster name"
exit 1
fi
RDS_MYSQL_CLUSTER_ENDPOINT=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier $RDS_MYSQL_CLUSTER_IDENTIFIER --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].Endpoint | [0]" --output text)
echo RDS_MYSQL_CLUSTER_ENDPOINT="$RDS_MYSQL_CLUSTER_ENDPOINT" >> $GITHUB_ENV
RDS_MYSQL_CLUSTER_IDENTIFIER=$(aws rds describe-db-cluster-endpoints --db-cluster-identifier "rdsaurorapythonclusterformysql" --region ${{inputs.aws-region}} --query "DBClusterEndpoints[?EndpointType=='WRITER'].DBClusterIdentifier | [0]" --output text)
RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME=$(aws secretsmanager list-secrets --region ${{inputs.aws-region}} --query "SecretList[?Tags[?Value=='arn:aws:rds:${{inputs.aws-region}}:${{env.ACCOUNT_ID}}:cluster:$RDS_MYSQL_CLUSTER_IDENTIFIER']].Name | [0]" --output text)
echo RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME="$RDS_MYSQL_CLUSTER_CREDENTIAL_SECRET_NAME" >> $GITHUB_ENV
Expand Down

0 comments on commit 8cdc51d

Please sign in to comment.