Skip to content

Commit 193fcaf

Browse files
committed
Create Traffic Generator for Calling Sample App Endpoints
1 parent b3d7e7c commit 193fcaf

File tree

173 files changed

+40664
-265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+40664
-265
lines changed

.github/workflows/java-eks-e2e-test.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,23 @@ jobs:
321321
working-directory: terraform/java/eks
322322
run: echo "APP_ENDPOINT=$(terraform output sample_app_endpoint)" >> $GITHUB_ENV
323323

324-
# This steps increases the speed of the validation by creating the telemetry data in advance
325-
- name: Call all test APIs
326-
continue-on-error: true
324+
- name: Deploy the traffic generator
327325
run: |
328-
curl -S -s "http://${{ env.APP_ENDPOINT }}/outgoing-http-call"
329-
curl -S -s "http://${{ env.APP_ENDPOINT }}/aws-sdk-call?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"
330-
curl -S -s "http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"
331-
curl -S -s "http://${{ env.APP_ENDPOINT }}/client-call"
332-
curl -S -s "http://${{ env.APP_ENDPOINT }}/mysql"
326+
kubectl create deployment -n ${{ env.SAMPLE_APP_NAMESPACE }} traffic-generator \
327+
--image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/e2e-test-resource:traffic-generator \
328+
--replicas=1
329+
330+
kubectl patch deployment -n ${{ env.SAMPLE_APP_NAMESPACE }} traffic-generator --patch '{"spec": {"template": {"spec": {"containers": [{"name": "e2e-test-resource", "imagePullPolicy": "Always"}]}}}}'
331+
332+
sleep 10
333+
334+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator MAIN_ENDPOINT=${{ env.APP_ENDPOINT }}
335+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator REMOTE_ENDPOINT=${{ env.REMOTE_SERVICE_POD_IP }}
336+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator ID=${{ env.TESTING_ID }}
337+
338+
sleep 10
339+
340+
kubectl get pods -n ${{ env.SAMPLE_APP_NAMESPACE }} --no-headers | grep '^traffic-generator' | awk '{print $1}' | xargs kubectl delete pod -n ${{ env.SAMPLE_APP_NAMESPACE }}
333341
334342
- name: Initiate Gradlew Daemon
335343
if: steps.initiate-gradlew == 'failure'

.github/workflows/test.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
## SPDX-License-Identifier: Apache-2.0
3+
4+
## This workflow aims to run the Application Signals end-to-end tests as a canary to
5+
## test the artifacts for App Signals enablement. It will deploy a sample app and remote
6+
## service on two EC2 instances, call the APIs, and validate the generated telemetry,
7+
## including logs, metrics, and traces.
8+
name: Test
9+
on:
10+
# push:
11+
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
jobs:
17+
# default:
18+
# strategy:
19+
# fail-fast: false
20+
# matrix:
21+
# aws-region: ['us-east-1']
22+
# uses: ./.github/workflows/java-ec2-default-e2e-test.yml
23+
# secrets: inherit
24+
# with:
25+
# aws-region: ${{ matrix.aws-region }}
26+
# caller-workflow-name: 'test'
27+
28+
eks:
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
aws-region: [ 'us-east-1' ]
33+
uses: ./.github/workflows/java-eks-e2e-test.yml
34+
secrets: inherit
35+
with:
36+
aws-region: ${{ matrix.aws-region }}
37+
test-cluster-name: 'e2e-playground'
38+
caller-workflow-name: 'test'
39+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This workflow will build and the traffic generator image to each region whenever there is an update made to the traffic-generator folder.
2+
# This image will be used by EKS and K8s test to call sample app endpoints
3+
name: Create and Push Traffic Generator Image
4+
5+
on:
6+
workflow_dispatch:
7+
push:
8+
# branches:
9+
# - main
10+
# paths:
11+
# - 'traffic-generator/**'
12+
13+
permissions:
14+
id-token: write
15+
contents: read
16+
17+
jobs:
18+
build-and-push-image:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
aws-region: ['us-west-1']
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Configure AWS Credentials
28+
uses: aws-actions/configure-aws-credentials@v4
29+
with:
30+
role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_ARN }}
31+
aws-region: us-east-1
32+
33+
- name: Retrieve account
34+
uses: aws-actions/aws-secretsmanager-get-secrets@v1
35+
with:
36+
secret-ids: |
37+
ACCOUNT_ID, region-account/${{ matrix.aws-region }}
38+
39+
- name: Configure AWS Credentials
40+
uses: aws-actions/configure-aws-credentials@v4
41+
with:
42+
role-to-assume: arn:aws:iam::654654176582:role/GithubProviderRole
43+
aws-region: us-west-1
44+
45+
- name: Login to Amazon ECR
46+
id: login-ecr
47+
uses: aws-actions/amazon-ecr-login@v2
48+
49+
- name: Build, tag, and push image to Amazon ECR
50+
working-directory: traffic-generator
51+
env:
52+
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
53+
REPOSITORY: e2e-test-resource
54+
IMAGE_TAG: traffic-generator
55+
run: |
56+
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
57+
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG

node_modules/.package-lock.json

+97
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/asynckit/LICENSE

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)