Skip to content

Commit 6f59ef4

Browse files
committed
Remove Public Endpoint from EKS Platform
1 parent 8cdc51d commit 6f59ef4

32 files changed

+230
-603
lines changed

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

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -232,39 +232,6 @@ jobs:
232232
233233
execute_and_retry 2 "kubectl delete pods --all -n ${{ env.SAMPLE_APP_NAMESPACE }}" "" 60
234234
execute_and_retry 2 "kubectl wait --for=condition=Ready --request-timeout '5m' pod --all -n ${{ env.SAMPLE_APP_NAMESPACE }}" "" 10
235-
236-
echo "Attempting to connect to the main sample app endpoint"
237-
main_sample_app_endpoint=http://$(terraform output sample_app_endpoint)
238-
attempt_counter=0
239-
max_attempts=60
240-
until $(curl --output /dev/null --silent --head --fail $(echo "$main_sample_app_endpoint" | tr -d '"')); do
241-
if [ ${attempt_counter} -eq ${max_attempts} ];then
242-
echo "Failed to connect to endpoint ($main_sample_app_endpoint). Will attempt to redeploy sample app."
243-
deployment_failed=1
244-
break
245-
fi
246-
247-
printf '.'
248-
attempt_counter=$(($attempt_counter+1))
249-
sleep 10
250-
done
251-
252-
echo "Attempting to connect to the remote sample app endpoint"
253-
remote_sample_app_endpoint=http://$(terraform output sample_remote_app_endpoint)/healthcheck
254-
echo $remote_sample_app_endpoint
255-
attempt_counter=0
256-
max_attempts=30
257-
until $(curl --output /dev/null --silent --head --fail $(echo "$remote_sample_app_endpoint" | tr -d '"')); do
258-
if [ ${attempt_counter} -eq ${max_attempts} ];then
259-
echo "Failed to connect to endpoint. Will attempt to redeploy sample app."
260-
deployment_failed=1
261-
break
262-
fi
263-
264-
printf '.'
265-
attempt_counter=$(($attempt_counter+1))
266-
sleep 10
267-
done
268235
fi
269236
270237
# If the deployment_failed is 1 then either the terraform deployment or the endpoint connection failed, so first destroy the
@@ -333,18 +300,28 @@ jobs:
333300
echo "REMOTE_SERVICE_POD_IP=$(kubectl get pods -n ${{ env.SAMPLE_APP_NAMESPACE }} --selector=app=remote-app -o jsonpath='{.items[0].status.podIP}')" >> $GITHUB_ENV
334301
335302
- name: Get the sample app endpoint
336-
working-directory: terraform/java/eks
337-
run: echo "APP_ENDPOINT=$(terraform output sample_app_endpoint)" >> $GITHUB_ENV
303+
run: echo "APP_ENDPOINT=$(kubectl get pods -n ${{ env.SAMPLE_APP_NAMESPACE }} --selector=app=sample-app -o jsonpath='{.items[0].status.podIP}'):8080" >> $GITHUB_ENV
338304

339-
# This steps increases the speed of the validation by creating the telemetry data in advance
340-
- name: Call all test APIs
341-
continue-on-error: true
305+
- name: Deploy the traffic generator
342306
run: |
343-
curl -S -s "http://${{ env.APP_ENDPOINT }}/outgoing-http-call"
344-
curl -S -s "http://${{ env.APP_ENDPOINT }}/aws-sdk-call?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"
345-
curl -S -s "http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"
346-
curl -S -s "http://${{ env.APP_ENDPOINT }}/client-call"
347-
curl -S -s "http://${{ env.APP_ENDPOINT }}/mysql"
307+
# Deploy the traffic generator
308+
kubectl create deployment -n ${{ env.SAMPLE_APP_NAMESPACE }} traffic-generator \
309+
--image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/e2e-test-resource:traffic-generator \
310+
--replicas=1
311+
312+
# Patch it with ImagePull always policy so that it pulls the latest image from the ECR
313+
kubectl patch deployment -n ${{ env.SAMPLE_APP_NAMESPACE }} traffic-generator --patch '{"spec": {"template": {"spec": {"containers": [{"name": "e2e-test-resource", "imagePullPolicy": "Always"}]}}}}'
314+
315+
# Add the appropriate environment variables to the traffic generator
316+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator MAIN_ENDPOINT=${{ env.APP_ENDPOINT }}
317+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator REMOTE_ENDPOINT=${{ env.REMOTE_SERVICE_POD_IP }}
318+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator ID=${{ env.TESTING_ID }}
319+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator CANARY_TYPE=${{ github.job }}
320+
321+
# Restart the traffic generator with the new configuration
322+
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 }} || true
323+
324+
sleep 10
348325
349326
- name: Initiate Gradlew Daemon
350327
if: steps.initiate-gradlew == 'failure'

.github/workflows/java-metric-limiter-e2e-test.yml

Lines changed: 21 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -204,48 +204,7 @@ jobs:
204204
--configuration-values '{"agent":{"config":{"logs":{"metrics_collected":{"app_signals":{"limiter":{"drop_threshold":2}}}}}}}'
205205
206206
execute_and_retry 2 "kubectl delete pods --all -n ${{ env.SAMPLE_APP_NAMESPACE }}" "" 60
207-
execute_and_retry 2 "kubectl wait --for=condition=Ready --request-timeout '5m' pod --all -n ${{ env.SAMPLE_APP_NAMESPACE }}" "" 10
208-
209-
echo "Attempting to connect to the main sample app endpoint"
210-
main_sample_app_endpoint=http://$(terraform output sample_app_endpoint)
211-
attempt_counter=0
212-
max_attempts=60
213-
until $(curl --output /dev/null --silent --head --fail $(echo "$main_sample_app_endpoint" | tr -d '"')); do
214-
if [ ${attempt_counter} -eq ${max_attempts} ];then
215-
echo "Failed to connect to endpoint. Will attempt to redeploy sample app."
216-
deployment_failed=1
217-
break
218-
fi
219-
220-
printf '.'
221-
attempt_counter=$(($attempt_counter+1))
222-
sleep 10
223-
done
224-
225-
# Need to call some APIs so that it exceeds the metric limiter threshold and make the test
226-
# APIs generate AllOtherOperations metric. Sleep for a minute to let cloudwatch service process the API call
227-
# Calling it here before calling the remote sample app endpoint because the API generated by it is validated
228-
# for AllOtherRemoteOperations in the metric validation step
229-
curl -S -s $(echo "$main_sample_app_endpoint" | tr -d '"'); echo
230-
curl -S -s $(echo "$main_sample_app_endpoint" | tr -d '"')/fake-endpoint; echo
231-
sleep 60
232-
233-
echo "Attempting to connect to the remote sample app endpoint"
234-
remote_sample_app_endpoint=http://$(terraform output sample_remote_app_endpoint)/healthcheck
235-
echo $remote_sample_app_endpoint
236-
attempt_counter=0
237-
max_attempts=30
238-
until $(curl --output /dev/null --silent --head --fail $(echo "$remote_sample_app_endpoint" | tr -d '"')); do
239-
if [ ${attempt_counter} -eq ${max_attempts} ];then
240-
echo "Failed to connect to endpoint. Will attempt to redeploy sample app."
241-
deployment_failed=1
242-
break
243-
fi
244-
245-
printf '.'
246-
attempt_counter=$(($attempt_counter+1))
247-
sleep 10
248-
done
207+
execute_and_retry 2 "kubectl wait --for=condition=Ready --request-timeout '5m' pod --all -n ${{ env.SAMPLE_APP_NAMESPACE }}" "" 10
249208
fi
250209
251210
# If the deployment_failed is 1 then either the terraform deployment or the endpoint connection failed, so first destroy the
@@ -324,17 +283,28 @@ jobs:
324283
jq '.items[0].status.containerStatuses[0].imageID'
325284
326285
- name: Get the sample app endpoint
327-
run: echo "APP_ENDPOINT=$(terraform output sample_app_endpoint)" >> $GITHUB_ENV
328-
working-directory: terraform/java/eks
286+
run: echo "APP_ENDPOINT=$(kubectl get pods -n ${{ env.SAMPLE_APP_NAMESPACE }} --selector=app=sample-app -o jsonpath='{.items[0].status.podIP}'):8080" >> $GITHUB_ENV
329287

330-
# This steps increases the speed of the validation by creating the telemetry data in advance
331-
- name: Call all test APIs
332-
continue-on-error: true
288+
- name: Deploy the traffic generator
333289
run: |
334-
curl -S -s "http://${{ env.APP_ENDPOINT }}/outgoing-http-call"; echo
335-
curl -S -s "http://${{ env.APP_ENDPOINT }}/aws-sdk-call?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"; echo
336-
curl -S -s "http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"; echo
337-
curl -S -s "http://${{ env.APP_ENDPOINT }}/client-call"; echo
290+
# Deploy the traffic generator
291+
kubectl create deployment -n ${{ env.SAMPLE_APP_NAMESPACE }} traffic-generator \
292+
--image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/e2e-test-resource:traffic-generator \
293+
--replicas=1
294+
295+
# Patch it with ImagePull always policy so that it pulls the latest image from the ECR
296+
kubectl patch deployment -n ${{ env.SAMPLE_APP_NAMESPACE }} traffic-generator --patch '{"spec": {"template": {"spec": {"containers": [{"name": "e2e-test-resource", "imagePullPolicy": "Always"}]}}}}'
297+
298+
# Add the appropriate environment variables to the traffic generator
299+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator MAIN_ENDPOINT=${{ env.APP_ENDPOINT }}
300+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator REMOTE_ENDPOINT=${{ env.REMOTE_SERVICE_POD_IP }}
301+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator ID=${{ env.TESTING_ID }}
302+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator CANARY_TYPE=${{ github.job }}
303+
304+
# Restart the traffic generator with the new configuration
305+
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 }} || true
306+
307+
sleep 10
338308
339309
- name: Initiate Gradlew Daemon
340310
if: steps.initiate-gradlew == 'failure'

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

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -235,39 +235,6 @@ jobs:
235235
236236
execute_and_retry 2 "kubectl delete pods --all -n ${{ env.SAMPLE_APP_NAMESPACE }}" "" 60
237237
execute_and_retry 2 "kubectl wait --for=condition=Ready --request-timeout '5m' pod --all -n ${{ env.SAMPLE_APP_NAMESPACE }}" "" 10
238-
239-
echo "Attempting to connect to the main sample app endpoint"
240-
python_app_endpoint=http://$(terraform output python_app_endpoint)
241-
attempt_counter=0
242-
max_attempts=60
243-
until $(curl --output /dev/null --silent --head --fail $(echo "$python_app_endpoint" | tr -d '"')); do
244-
if [ ${attempt_counter} -eq ${max_attempts} ];then
245-
echo "Failed to connect to endpoint ($python_app_endpoint). Will attempt to redeploy sample app."
246-
deployment_failed=1
247-
break
248-
fi
249-
250-
printf '.'
251-
attempt_counter=$(($attempt_counter+1))
252-
sleep 10
253-
done
254-
255-
echo "Attempting to connect to the remote sample app endpoint"
256-
remote_sample_app_endpoint=http://$(terraform output python_r_app_endpoint)/healthcheck
257-
echo $remote_sample_app_endpoint
258-
attempt_counter=0
259-
max_attempts=30
260-
until $(curl --output /dev/null --silent --head --fail $(echo "$remote_sample_app_endpoint" | tr -d '"')); do
261-
if [ ${attempt_counter} -eq ${max_attempts} ];then
262-
echo "Failed to connect to endpoint. Will attempt to redeploy sample app."
263-
deployment_failed=1
264-
break
265-
fi
266-
267-
printf '.'
268-
attempt_counter=$(($attempt_counter+1))
269-
sleep 10
270-
done
271238
fi
272239
273240
# If the deployment_failed is 1 then either the terraform deployment or the endpoint connection failed, so first destroy the
@@ -337,18 +304,28 @@ jobs:
337304
echo "REMOTE_SERVICE_POD_IP=$(kubectl get pods -n ${{ env.SAMPLE_APP_NAMESPACE }} --selector=app=remote-app -o jsonpath='{.items[0].status.podIP}')" >> $GITHUB_ENV
338305
339306
- name: Get the sample app endpoint
340-
run: echo "APP_ENDPOINT=$(terraform output python_app_endpoint)" >> $GITHUB_ENV
341-
working-directory: terraform/python/eks
307+
run: echo "APP_ENDPOINT=$(kubectl get pods -n ${{ env.SAMPLE_APP_NAMESPACE }} --selector=app=python-app -o jsonpath='{.items[0].status.podIP}'):8000" >> $GITHUB_ENV
342308

343-
# This steps increases the speed of the validation by creating the telemetry data in advance
344-
- name: Call all test APIs
345-
continue-on-error: true
309+
- name: Deploy the traffic generator
346310
run: |
347-
curl -S -s "http://${{ env.APP_ENDPOINT }}/outgoing-http-call"; echo
348-
curl -S -s "http://${{ env.APP_ENDPOINT }}/aws-sdk-call?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"; echo
349-
curl -S -s "http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}&testingId=${{ env.TESTING_ID }}"; echo
350-
curl -S -s "http://${{ env.APP_ENDPOINT }}/client-call"; echo
351-
curl -S -s "http://${{ env.APP_ENDPOINT }}/mysql"; echo
311+
# Deploy the traffic generator
312+
kubectl create deployment -n ${{ env.SAMPLE_APP_NAMESPACE }} traffic-generator \
313+
--image=${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.E2E_TEST_AWS_REGION }}.amazonaws.com/e2e-test-resource:traffic-generator \
314+
--replicas=1
315+
316+
# Patch it with ImagePull always policy so that it pulls the latest image from the ECR
317+
kubectl patch deployment -n ${{ env.SAMPLE_APP_NAMESPACE }} traffic-generator --patch '{"spec": {"template": {"spec": {"containers": [{"name": "e2e-test-resource", "imagePullPolicy": "Always"}]}}}}'
318+
319+
# Add the appropriate environment variables to the traffic generator
320+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator MAIN_ENDPOINT=${{ env.APP_ENDPOINT }}
321+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator REMOTE_ENDPOINT=${{ env.REMOTE_SERVICE_POD_IP }}
322+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator ID=${{ env.TESTING_ID }}
323+
kubectl set env -n ${{ env.SAMPLE_APP_NAMESPACE }} deployment/traffic-generator CANARY_TYPE=${{ github.job }}
324+
325+
# Restart the traffic generator with the new configuration
326+
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 }} || true
327+
328+
sleep 10
352329
353330
- name: Initiate Gradlew Daemon
354331
if: steps.initiate-gradlew == 'failure'

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
workflow_dispatch:
11+
push:
12+
13+
permissions:
14+
id-token: write
15+
contents: read
16+
17+
jobs:
18+
java-eks:
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
aws-region: [ 'us-east-1' ]
23+
uses: ./.github/workflows/java-eks-e2e-test.yml
24+
secrets: inherit
25+
with:
26+
aws-region: ${{ matrix.aws-region }}
27+
test-cluster-name: 'e2e-playground'
28+
caller-workflow-name: 'test'
29+
30+
python-eks:
31+
needs: java-eks
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
aws-region: [ 'us-east-1' ]
36+
uses: ./.github/workflows/python-eks-e2e-test.yml
37+
secrets: inherit
38+
with:
39+
aws-region: ${{ matrix.aws-region }}
40+
test-cluster-name: 'e2e-playground'
41+
caller-workflow-name: 'test'
42+
43+
metric-limiter:
44+
needs: python-eks
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
aws-region: [ 'us-east-1' ]
49+
uses: ./.github/workflows/java-metric-limiter-e2e-test.yml
50+
secrets: inherit
51+
with:
52+
aws-region: ${{ matrix.aws-region }}
53+
test-cluster-name: 'e2e-playground'
54+
caller-workflow-name: 'test'

terraform/java/eks/main.tf

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -153,41 +153,6 @@ resource "kubernetes_service" "sample_app_service" {
153153
}
154154
}
155155

156-
resource "kubernetes_ingress_v1" "sample-app-ingress" {
157-
depends_on = [kubernetes_service.sample_app_service]
158-
wait_for_load_balancer = true
159-
metadata {
160-
name = "sample-app-ingress-${var.test_id}"
161-
namespace = var.test_namespace
162-
annotations = {
163-
"kubernetes.io/ingress.class" = "alb"
164-
"alb.ingress.kubernetes.io/scheme" = "internet-facing"
165-
"alb.ingress.kubernetes.io/target-type" = "ip"
166-
}
167-
labels = {
168-
app = "sample-app-ingress"
169-
}
170-
}
171-
spec {
172-
rule {
173-
http {
174-
path {
175-
path = "/"
176-
path_type = "Prefix"
177-
backend {
178-
service {
179-
name = kubernetes_service.sample_app_service.metadata[0].name
180-
port {
181-
number = 8080
182-
}
183-
}
184-
}
185-
}
186-
}
187-
}
188-
}
189-
}
190-
191156
# Set up the remote service
192157

193158
resource "kubernetes_deployment" "sample_remote_app_deployment" {
@@ -251,47 +216,4 @@ resource "kubernetes_service" "sample_remote_app_service" {
251216
node_port = 30101
252217
}
253218
}
254-
}
255-
256-
resource "kubernetes_ingress_v1" "sample-remote-app-ingress" {
257-
depends_on = [kubernetes_service.sample_remote_app_service]
258-
wait_for_load_balancer = true
259-
metadata {
260-
name = "sample-remote-app-ingress-${var.test_id}"
261-
namespace = var.test_namespace
262-
annotations = {
263-
"kubernetes.io/ingress.class" = "alb"
264-
"alb.ingress.kubernetes.io/scheme" = "internet-facing"
265-
"alb.ingress.kubernetes.io/target-type" = "ip"
266-
}
267-
labels = {
268-
app = "sample-remote-app-ingress"
269-
}
270-
}
271-
spec {
272-
rule {
273-
http {
274-
path {
275-
path = "/"
276-
path_type = "Prefix"
277-
backend {
278-
service {
279-
name = kubernetes_service.sample_remote_app_service.metadata[0].name
280-
port {
281-
number = 8080
282-
}
283-
}
284-
}
285-
}
286-
}
287-
}
288-
}
289-
}
290-
291-
output "sample_app_endpoint" {
292-
value = kubernetes_ingress_v1.sample-app-ingress.status.0.load_balancer.0.ingress.0.hostname
293-
}
294-
295-
output "sample_remote_app_endpoint" {
296-
value = kubernetes_ingress_v1.sample-remote-app-ingress.status.0.load_balancer.0.ingress.0.hostname
297-
}
219+
}

0 commit comments

Comments
 (0)