Skip to content

Commit 536147d

Browse files
authored
UID2-4243 Change namespace to be separated by UID2 and EUID (#125)
* Change namespace to be separated by UID2 and EUID * Port forward to different port for UID2 and EUID * Pass in missing IDENTITY_SCOPE * Use kcc-UID2-4243-fix-e2e * Replace namespace * Remove nitro-enclave namespace * Delete unused namspace * Add debugging message * Add debugging message * Remove debugging messages * Add debugging message * Add ps aux debugging message * Don't suppress any output * Wait until pods ready * Remove unnecessary debugging message * Change kcc-UID2-4243-fix-e2e to v3
1 parent 448004f commit 536147d

File tree

7 files changed

+44
-8
lines changed

7 files changed

+44
-8
lines changed

.github/workflows/shared-run-e2e-tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,4 @@ jobs:
337337
with:
338338
eks_test_cluster: ${{ inputs.eks_test_cluster }}
339339
eks_test_cluster_region: ${{ inputs.eks_test_cluster_region }}
340+
identity_scope: ${{ inputs.uid2_e2e_identity_scope }}

actions/start_eks_operator/action.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ runs:
5656
5757
- name: Clean up previous run
5858
shell: bash
59+
env:
60+
IDENTITY_SCOPE: ${{ inputs.identity_scope }}
5961
run: |
6062
bash uid2-shared-actions/scripts/eks/stop_eks_enclave.sh
6163
@@ -66,6 +68,7 @@ runs:
6668
OPERATOR_KEY: ${{ inputs.operator_key }}
6769
BORE_URL_CORE: ${{ inputs.bore_url_core }}
6870
BORE_URL_OPTOUT: ${{ inputs.bore_url_optout }}
71+
IDENTITY_SCOPE: ${{ inputs.identity_scope }}
6972
run: |
7073
bash uid2-shared-actions/scripts/eks/create_secret_in_k8.sh
7174
@@ -84,6 +87,7 @@ runs:
8487
shell: bash
8588
env:
8689
OPERATOR_ROOT: ${{ inputs.operator_root }}
90+
IDENTITY_SCOPE: ${{ inputs.identity_scope }}
8791
run: |
8892
bash uid2-shared-actions/scripts/eks/start_eks_enclave.sh
8993

actions/stop_eks_operator/action.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ inputs:
77
eks_test_cluster_region:
88
description: The EKS Test Cluster Region
99
required: true
10+
identity_scope:
11+
description: The identity scope [UID2, EUID]
12+
required: true
1013

1114
runs:
1215
using: "composite"
@@ -30,5 +33,7 @@ runs:
3033
- name: Stop EKS operator
3134
id: stop_eks
3235
shell: bash
36+
env:
37+
IDENTITY_SCOPE: ${{ inputs.identity_scope }}
3338
run: |
3439
bash uid2-shared-actions/scripts/eks/stop_eks_enclave.sh

scripts/eks/create_secret_in_k8.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ if [ -z "${BORE_URL_OPTOUT}" ]; then
1616
exit 1
1717
fi
1818

19+
if [ -z "${IDENTITY_SCOPE}" ]; then
20+
echo "IDENTITY_SCOPE can not be empty"
21+
exit 1
22+
fi
23+
1924
source "uid2-shared-actions/scripts/jq_helper.sh"
2025

2126
SECRET_JSON_FILE="uid2-shared-actions/scripts/eks/secret.json"
@@ -26,5 +31,5 @@ jq_string_update ${SECRET_JSON_FILE} api_token "${OPERATOR_KEY}"
2631

2732
cat ${SECRET_JSON_FILE}
2833

29-
kubectl create namespace compute
30-
kubectl create secret generic github-test-secret --from-file=config=uid2-shared-actions/scripts/eks/secret.json -n compute
34+
kubectl create namespace ${IDENTITY_SCOPE,,}
35+
kubectl create secret generic github-test-secret --from-file=config=uid2-shared-actions/scripts/eks/secret.json -n ${IDENTITY_SCOPE,,}

scripts/eks/prepare_eks_deployment_files.sh

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ls -al
2525
IMAGE="ghcr.io/iabtechlab/uid2-operator-eks-${IDENTITY_SCOPE,,}:${IMAGE_VERSION}"
2626

2727
sed -i "s#IMAGE_PLACEHOLDER#${IMAGE}#g" "${DEPLOYMENT_FILE}"
28+
sed -i "s#NAMESPACE_PLACEHOLDER#${IDENTITY_SCOPE,,}#g" "${DEPLOYMENT_FILE}"
2829
if [[ $? -ne 0 ]]; then
2930
echo "Failed to pre-process deployment file"
3031
exit 1

scripts/eks/start_eks_enclave.sh

+20-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,30 @@ if [ -z "${OPERATOR_ROOT}" ]; then
99
exit 1
1010
fi
1111

12+
if [ -z "${IDENTITY_SCOPE}" ]; then
13+
echo "IDENTITY_SCOPE can not be empty"
14+
exit 1
15+
fi
16+
1217
cat "${OPERATOR_ROOT}/scripts/aws/eks/deployment_files/test-deployment.yaml"
1318

1419
kubectl apply -f "${OPERATOR_ROOT}/scripts/aws/eks/deployment_files/test-deployment.yaml"
1520
kubectl get pods --all-namespaces
16-
17-
kubectl get services -n compute
18-
kubectl port-forward svc/operator-service -n compute 27015:80 > /dev/null 2>&1 &
19-
EKS_OPERATOR_URL="http://localhost:27015"
21+
kubectl get services -n ${IDENTITY_SCOPE,,}
22+
23+
POD_NAME=$(kubectl get pods -n ${IDENTITY_SCOPE,,} -o name | grep "operator")
24+
kubectl wait --for=condition=Ready "$POD_NAME" -n ${IDENTITY_SCOPE,,} --timeout=120s
25+
26+
if [ "${IDENTITY_SCOPE}" == "UID2" ]; then
27+
kubectl port-forward svc/operator-service -n ${IDENTITY_SCOPE,,} 27777:80 > /dev/null 2>&1 &
28+
EKS_OPERATOR_URL="http://localhost:27777"
29+
elif [ "${IDENTITY_SCOPE}" == "EUID" ]; then
30+
kubectl port-forward svc/operator-service -n ${IDENTITY_SCOPE,,} 27778:80 > /dev/null 2>&1 &
31+
EKS_OPERATOR_URL="http://localhost:27778"
32+
else
33+
echo "IDENTITY_SCOPE provided with wrong value"
34+
exit 1
35+
fi
2036

2137
kubectl get pods --all-namespaces
2238
HEALTHCHECK_URL="${EKS_OPERATOR_URL}/ops/healthcheck"

scripts/eks/stop_eks_enclave.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
kubectl delete namespace compute --ignore-not-found=true
2-
kubectl delete namespace nitro-enclaves --ignore-not-found=true
1+
if [ -z "${IDENTITY_SCOPE}" ]; then
2+
echo "IDENTITY_SCOPE can not be empty"
3+
exit 1
4+
fi
5+
6+
kubectl delete namespace ${IDENTITY_SCOPE,,} --ignore-not-found=true

0 commit comments

Comments
 (0)