Skip to content

Commit

Permalink
Create Traffic Generator for Calling Sample App Endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
harrryr committed Jul 25, 2024
1 parent b3d7e7c commit c77e52e
Show file tree
Hide file tree
Showing 170 changed files with 40,655 additions and 230 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/java-eks-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,28 @@ jobs:
working-directory: terraform/java/eks
run: echo "APP_ENDPOINT=$(terraform output sample_app_endpoint)" >> $GITHUB_ENV

# This steps increases the speed of the validation by creating the telemetry data in advance
- name: Call all test APIs
continue-on-error: true
# - name: Deploy the traffic generator
# working-directory: traffic-generator/deployments
# run: |
# sed -e "s/111122223333.dkr.ecr.us-west-2/${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}/g" -e "s/MAIN_SAMPLE_APP_ENDPOINT/${{ env.APP_ENDPOINT }}/g" -e "s/REMOTE_SAMPLE_APP_ENDPOINT/${{ env.REMOTE_SERVICE_POD_IP }}/g" -e "s/TESTING_ID/${{ env.TESTING_ID }}/g" ./traffic-generator.yaml
#
# kubectl apply --namespace=${{ env.SAMPLE_APP_NAMESPACE }} -f ./traffic-generator.yaml
#
# cat ./traffic-generator.yaml
#
# sleep 10000

- name: Deploy the traffic generator
run: |
curl -S -s "http://${{ env.APP_ENDPOINT }}/outgoing-http-call"
curl -S -s "http://${{ env.APP_ENDPOINT }}/aws-sdk-call?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"
curl -S -s "http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"
curl -S -s "http://${{ env.APP_ENDPOINT }}/client-call"
curl -S -s "http://${{ env.APP_ENDPOINT }}/mysql"
kubectl create deployment traffic-generator \
--image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/e2e-test-resource:traffic-generator \
--replicas=1
kubectl set env deployment/traffic-generator MAIN_ENDPOINT=${{ env.APP_ENDPOINT }}
kubectl set env deployment/traffic-generator REMOTE_ENDPOINT=${{ env.REMOTE_SERVICE_POD_IP }}
kubectl set env deployment/traffic-generator ID=${{ env.TESTING_ID }}
kubectl delete pods --all -n ${{ env.SAMPLE_APP_NAMESPACE }}
- name: Initiate Gradlew Daemon
if: steps.initiate-gradlew == 'failure'
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0

## This workflow aims to run the Application Signals end-to-end tests as a canary to
## test the artifacts for App Signals enablement. It will deploy a sample app and remote
## service on two EC2 instances, call the APIs, and validate the generated telemetry,
## including logs, metrics, and traces.
name: Test
on:
# push:

permissions:
id-token: write
contents: read

jobs:
# default:
# strategy:
# fail-fast: false
# matrix:
# aws-region: ['us-east-1']
# uses: ./.github/workflows/java-ec2-default-e2e-test.yml
# secrets: inherit
# with:
# aws-region: ${{ matrix.aws-region }}
# caller-workflow-name: 'test'

eks:
strategy:
fail-fast: false
matrix:
aws-region: [ 'us-east-1' ]
uses: ./.github/workflows/java-eks-e2e-test.yml
secrets: inherit
with:
aws-region: ${{ matrix.aws-region }}
test-cluster-name: 'e2e-playground'
caller-workflow-name: 'test'

60 changes: 60 additions & 0 deletions .github/workflows/traffic-generator-image-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow will build and the traffic generator image to each region whenever there is an update made to the traffic-generator folder.
# This image will be used by EKS and K8s test to call sample app endpoints
name: Create and Push Traffic Generator Image

on:
workflow_dispatch:
push:
# branches:
# - main
# paths:
# - 'traffic-generator/**'

permissions:
id-token: write
contents: read

jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
matrix:
aws-region: ['af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1',
'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1',
'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1',
'us-east-1','us-east-2','us-west-2']
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_ARN }}
aws-region: us-east-1

- name: Retrieve account
uses: aws-actions/aws-secretsmanager-get-secrets@v1
with:
secret-ids: |
ACCOUNT_ID, region-account/${{ matrix.aws-region }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ secrets.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }}
aws-region: ${{ matrix.aws-region }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build, tag, and push image to Amazon ECR
working-directory: traffic-generator
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: e2e-test-resource
IMAGE_TAG: traffic-generator
run: |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
97 changes: 97 additions & 0 deletions node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/asynckit/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c77e52e

Please sign in to comment.