-
Notifications
You must be signed in to change notification settings - Fork 1
UID2-3783 Add steps for eks e2e test #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fc3cc68
5cb654a
40fe812
2754bb8
cad9595
11584f9
b2ba8e6
91f3f5a
9b22319
c102e61
3bfb4a1
fdd9d9d
9f6ea8c
72441ed
247049e
10f6e85
b5173ce
8cfbd33
b584607
52399a4
ecc44b1
d916bcf
0bac735
2961ba1
cece400
79ec51b
a7a3bec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| .idea/ | ||
| .idea/ | ||
| *.key |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Prepare AWS Metadata | ||
| description: Prepares the AWS Nitro enclave metadata | ||
|
|
||
| inputs: | ||
| operator_image_version: | ||
| description: The uid2-operator image version | ||
| default: latest | ||
| admin_root: | ||
| description: The root path for uid2-admin folder | ||
| default: uid2-admin | ||
| eks_pcr0: | ||
| description: The EKS PCR0 | ||
| required: true | ||
|
|
||
| outputs: | ||
| operator_key: | ||
| description: The operator key | ||
| value: ${{ steps.enclave_metadata.outputs.OPERATOR_KEY }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
|
|
||
| steps: | ||
| - name: Prepare EKS enclave metadata | ||
| id: enclave_metadata | ||
| shell: bash | ||
| env: | ||
| ADMIN_ROOT: ${{ inputs.admin_root }} | ||
| ENCLAVE_ID: ${{ inputs.eks_pcr0 }} | ||
| ENCLAVE_PROTOCOL: aws-nitro | ||
| run: | | ||
| bash uid2-shared-actions/scripts/save_enclave_id_to_admin.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Start EKS Private Operator | ||
| description: Spins up an EKS private operator | ||
|
|
||
| inputs: | ||
| bore_url_core: | ||
| description: The bore URL for core service | ||
| required: true | ||
| bore_url_optout: | ||
| description: The bore URL for optout service | ||
| required: true | ||
| bore_url_localstack: | ||
| description: The bore URL for localstack service | ||
| required: true | ||
| identity_scope: | ||
| description: The identity scope [UID2, EUID] | ||
| required: true | ||
| operator_image_version: | ||
| description: The uid2-operator image version | ||
| default: latest | ||
| operator_root: | ||
| description: The root path for uid2-operator folder | ||
| default: uid2-operator | ||
| operator_key: | ||
| description: The operator key | ||
| required: true | ||
|
|
||
| # outputs: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave this for future case |
||
| # uid2_e2e_pipeline_operator_url: | ||
| # description: The EKS operator URL | ||
| # value: ${{ steps.start_aws.outputs.uid2_e2e_pipeline_operator_url }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
|
|
||
| steps: | ||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: us-east-2 | ||
| role-to-assume: arn:aws:iam::072245134533:role/github-runner-for-uid2-operator | ||
|
|
||
| - name: Check AWS caller identity | ||
| shell: bash | ||
| run: aws sts get-caller-identity | ||
|
|
||
| - name: Set up kubernetes context | ||
| shell: bash | ||
| run: | | ||
| aws eks --region us-east-2 update-kubeconfig --name uid-test-git-us-east-2 | ||
|
|
||
| - name: Create secrets in the kubernetes cluster | ||
| id: create_secrets | ||
| shell: bash | ||
| env: | ||
| OPERATOR_KEY: ${{ inputs.operator_key }} | ||
| BORE_URL_CORE: ${{ inputs.bore_url_core }} | ||
| BORE_URL_OPTOUT: ${{ inputs.bore_url_optout }} | ||
| run: | | ||
| bash uid2-shared-actions/scripts/eks/create_secret_in_k8.sh | ||
|
|
||
| - name: Prepare EKS enclave deployment files | ||
| id: enclave_metadata | ||
| shell: bash | ||
| env: | ||
| IMAGE_VERSION: ${{ inputs.operator_image_version }} | ||
| OPERATOR_ROOT: ${{ inputs.operator_root }} | ||
| run: | | ||
| bash uid2-shared-actions/scripts/eks/prepare_eks_deployment_files.sh | ||
|
|
||
| - name: Start EKS operator | ||
| id: start_eks | ||
| shell: bash | ||
| run: | | ||
| cat ${{ inputs.operator_root }}/scripts/aws/eks/deployment_files/deployment.yaml | ||
| kubectl apply -f ${{ inputs.operator_root }}/scripts/aws/eks/deployment_files/deployment.yaml | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,9 +8,6 @@ inputs: | |
| bore_url_optout: | ||
| description: The bore URL for optout service | ||
| required: true | ||
| bore_url_localstack: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not used, removed in GCP |
||
| description: The bore URL for localstack service | ||
| required: true | ||
| gcp_project: | ||
| description: The name of the GCP project | ||
| required: true | ||
|
|
@@ -44,7 +41,6 @@ runs: | |
| SERVICE_ACCOUNT: ${{ inputs.gcp_service_account }} | ||
| BORE_URL_CORE: ${{ inputs.bore_url_core }} | ||
| BORE_URL_OPTOUT: ${{ inputs.bore_url_optout }} | ||
| BORE_URL_LOCALSTACK: ${{ inputs.bore_url_localstack }} | ||
| OPERATOR_KEY: ${{ inputs.operator_key }} | ||
| IMAGE_HASH: ${{ inputs.image_hash }} | ||
| run: | | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: Stop EKS Operator | ||
|
|
||
| runs: | ||
| using: "composite" | ||
|
|
||
| steps: | ||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: us-east-2 | ||
| role-to-assume: arn:aws:iam::072245134533:role/github-runner-for-uid2-operator | ||
|
|
||
| - name: Check AWS caller identity | ||
| shell: bash | ||
| run: aws sts get-caller-identity | ||
|
|
||
| - name: Set up kubernetes context | ||
| shell: bash | ||
| run: | | ||
| aws eks --region us-east-2 update-kubeconfig --name uid-test-git-us-east-2 | ||
|
|
||
| - name: Stop EKS operator | ||
| id: stop_eks | ||
| shell: bash | ||
| run: | | ||
| kubectl delete deployment uid2-operator | ||
| kubectl delete secret github-test-secret |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| if [ -z "${OPERATOR_KEY}" ]; then | ||
| echo "OPERATOR_KEY can not be empty" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "${BORE_URL_CORE}" ]; then | ||
| echo "BORE_URL_CORE can not be empty" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "${BORE_URL_OPTOUT}" ]; then | ||
| echo "BORE_URL_OPTOUT can not be empty" | ||
| exit 1 | ||
| fi | ||
|
|
||
| source "uid2-shared-actions/scripts/jq_helper.sh" | ||
|
|
||
| SECRET_JSON_FILE="uid2-shared-actions/scripts/eks/secret.json" | ||
|
|
||
| jq_string_update ${SECRET_JSON_FILE} core_base_url "http://${BORE_URL_CORE}" | ||
| jq_string_update ${SECRET_JSON_FILE} optout_base_url "http://${BORE_URL_OPTOUT}" | ||
| jq_string_update ${SECRET_JSON_FILE} api_token "${OPERATOR_KEY}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. neat |
||
|
|
||
| cat ${SECRET_JSON_FILE} | ||
|
|
||
| kubectl create secret generic github-test-secret --from-file=config=uid2-shared-actions/scripts/eks/secret.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #!/usr/bin/env bash | ||
| set -ex | ||
|
|
||
| if [ -z "${OPERATOR_ROOT}" ]; then | ||
| echo "${OPERATOR_ROOT} can not be empty" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "${IMAGE_VERSION}" ]; then | ||
| echo "IMAGE_VERSION can not be empty" | ||
| exit 1 | ||
| fi | ||
|
|
||
| ROOT="." | ||
| DEPLOYMENT_FILES_ROOT="${OPERATOR_ROOT}/scripts/aws/eks/deployment_files" | ||
|
|
||
| ls -al | ||
|
|
||
| IMAGE="ghcr.io/iabtechlab/uid2-operator-eks-uid2:${IMAGE_VERSION}" | ||
|
|
||
| sed -i "s#IMAGE_PLACEHOLDER#${IMAGE}#g" "${DEPLOYMENT_FILES_ROOT}/deployment.yaml" | ||
| if [[ $? -ne 0 ]]; then | ||
| echo "Failed to pre-process deployment file" | ||
| exit 1 | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "api_token": "fake-operator-key", | ||
| "service_instances": 6, | ||
| "enclave_cpu_count": 6, | ||
| "enclave_memory_mb": 24576, | ||
| "environment": "integ", | ||
| "customize_enclave": "false", | ||
| "core_base_url": "https://core-integ.uidapi.com", | ||
| "optout_base_url": "https://optout-integ.uidapi.com" | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have to merge these inputs together as github has a limit of 10 inputs. See https://github.com/IABTechLab/uid2-operator/pull/889/files