Skip to content

Commit

Permalink
Update blog test
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Richman <[email protected]>
  • Loading branch information
ARichman555 committed Oct 14, 2024
1 parent 0bd8a35 commit 91443fe
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion e2e/blog-test/nlb-tls-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ metadata:
name: nlb-tls-app
annotations:
service.beta.kubernetes.io/aws-load-balancer-subnets: $SUBNET
service.beta.kubernetes.io/aws-load-balancer-type: "external"
service.beta.kubernetes.io/aws-load-balancer-type: "nlb-ip"
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: "*"
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "instance"
Expand Down
25 changes: 20 additions & 5 deletions e2e/blog_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ create_target_group() {

aws elbv2 register-targets --target-group-arn $TARGET_GROUP_ARN --targets Id=$(curl --silent http://169.254.169.254/latest/meta-data/instance-id),Port=$PORT

echo "Registered target group"

export LOAD_BALANCER_HOSTNAME=$(kubectl get service nlb-tls-app -ojson | jq -r ".status.loadBalancer.ingress[0].hostname")

LOAD_BALANCER_NAME=$(cut -d'.' -f1 <<<"$LOAD_BALANCER_HOSTNAME" | sed 's/\(.*\)-/\1\//')
Expand All @@ -38,6 +40,8 @@ create_target_group() {

LISTENER_ARN=$(aws elbv2 describe-listeners --load-balancer-arn $LOAD_BALANCER_ARN | jq -r ".Listeners[0].ListenerArn")

echo "Modifying listener"

aws elbv2 modify-listener --listener-arn $LISTENER_ARN --protocol TCP --port $PORT --default-actions Type=forward,TargetGroupArn=$TARGET_GROUP_ARN >/dev/null 2>&1

}
Expand Down Expand Up @@ -71,6 +75,13 @@ delete_ca() {
clean_up() {
set +e

KIND_LOGS=$($HOME_DIR/bin/kind-0.19.0 export logs --name pca-external-issuer)
echo $KIND_LOGS

find $KIND_LOGS/* -type f -name '*aws-load-balancer*' -exec sh -c 'cat {}' \;

echo "Cleaning up test resources"

kubectl delete -f $E2E_DIR/blog-test/test-nlb-tls-app.yaml >/dev/null 2>&1

kubectl delete -f $E2E_DIR/blog-test/nlb-lab-tls.yaml >/dev/null 2>&1
Expand All @@ -80,7 +91,6 @@ clean_up() {
helm uninstall aws-load-balancer-controller -n kube-system >/dev/null 2>&1

delete_ca

}

install_aws_load_balancer() {
Expand Down Expand Up @@ -132,16 +142,21 @@ main() {

echo "nlb-tls-app deployment found."

timeout 30s bash -c 'until kubectl get service/nlb-tls-app --output=jsonpath='{.status.loadBalancer}' | grep "ingress"; do : ; done' 1>/dev/null || exit 1
kubectl describe service/nlb-tls-app

timeout 60s bash -c 'until kubectl get service/nlb-tls-app --output=jsonpath='{.status.loadBalancer}' | grep "ingress"; do kubectl get events; done' 1>/dev/null || exit 1

echo "Creating target groups"

create_target_group

echo "Waiting for target groups"

timeout 600s bash -c 'until echo | openssl s_client -connect $LOAD_BALANCER_HOSTNAME:$PORT; do : ; done' || exit 1

echo "Blog Test Finished Successfully"

clean_up

}

trap clean_up EXIT

main
4 changes: 3 additions & 1 deletion e2e/kind_config/install_eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ spec:
name: selfsigned-issuer
kind: ClusterIssuer
---
apiVersion: admissionregistration.k8s.io/v1beta1
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: pod-identity-webhook
Expand All @@ -179,6 +179,8 @@ metadata:
webhooks:
- name: pod-identity-webhook.amazonaws.com
failurePolicy: Ignore
sideEffects: None
admissionReviewVersions: ['v1', 'v1beta']
clientConfig:
service:
name: pod-identity-webhook
Expand Down

0 comments on commit 91443fe

Please sign in to comment.