mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-09-20 21:14:37 -04:00
e2e: add AWS test
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
f6b3ef6a57
commit
11672acf0a
7 changed files with 102 additions and 12 deletions
47
.github/actions/constellation_create/action.yml
vendored
47
.github/actions/constellation_create/action.yml
vendored
|
@ -11,12 +11,6 @@ inputs:
|
||||||
cloudProvider:
|
cloudProvider:
|
||||||
description: "Either 'gcp' or 'azure'."
|
description: "Either 'gcp' or 'azure'."
|
||||||
required: true
|
required: true
|
||||||
gcpProject:
|
|
||||||
description: "The GCP project to deploy Constellation in."
|
|
||||||
required: false
|
|
||||||
gcpClusterServiceAccountKey:
|
|
||||||
description: "Service account to use inside the created Constellation cluster on GCP."
|
|
||||||
required: false
|
|
||||||
machineType:
|
machineType:
|
||||||
description: "Machine type of VM to spawn."
|
description: "Machine type of VM to spawn."
|
||||||
required: false
|
required: false
|
||||||
|
@ -29,6 +23,18 @@ inputs:
|
||||||
kubernetesVersion:
|
kubernetesVersion:
|
||||||
description: "Kubernetes version to create the cluster from."
|
description: "Kubernetes version to create the cluster from."
|
||||||
required: false
|
required: false
|
||||||
|
#
|
||||||
|
# GCP specific inputs
|
||||||
|
#
|
||||||
|
gcpProject:
|
||||||
|
description: "The GCP project to deploy Constellation in."
|
||||||
|
required: false
|
||||||
|
gcpClusterServiceAccountKey:
|
||||||
|
description: "The GCP Service account to use inside the created Constellation cluster."
|
||||||
|
required: false
|
||||||
|
#
|
||||||
|
# Azure specific inputs
|
||||||
|
#
|
||||||
azureSubscription:
|
azureSubscription:
|
||||||
description: "The Azure subscription ID to deploy Constellation in."
|
description: "The Azure subscription ID to deploy Constellation in."
|
||||||
required: false
|
required: false
|
||||||
|
@ -36,16 +42,16 @@ inputs:
|
||||||
description: "The Azure tenant ID to deploy Constellation in."
|
description: "The Azure tenant ID to deploy Constellation in."
|
||||||
required: false
|
required: false
|
||||||
azureClientID:
|
azureClientID:
|
||||||
description: "The client ID of the application registration created for Constellation in Azure."
|
description: "The Azure client ID of the application registration created for Constellation."
|
||||||
required: false
|
required: false
|
||||||
azureClientSecret:
|
azureClientSecret:
|
||||||
description: "The client secret value of the used secret"
|
description: "The Azure client secret value of the used secret."
|
||||||
required: false
|
required: false
|
||||||
azureUserAssignedIdentity:
|
azureUserAssignedIdentity:
|
||||||
description: "The Azure user assigned identity to use for Constellation."
|
description: "The Azure user assigned identity to use for Constellation."
|
||||||
required: false
|
required: false
|
||||||
azureResourceGroup:
|
azureResourceGroup:
|
||||||
description: "The resource group to use for Constellation cluster"
|
description: "The Azure resource group to use for Constellation cluster"
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
@ -71,6 +77,7 @@ runs:
|
||||||
(.provider | select(. | has(\"azure\")).azure.clientSecretValue) = \"${{ inputs.azureClientSecret }}\" |
|
(.provider | select(. | has(\"azure\")).azure.clientSecretValue) = \"${{ inputs.azureClientSecret }}\" |
|
||||||
(.provider | select(. | has(\"azure\")).azure.enforcedMeasurements) = [15]" \
|
(.provider | select(. | has(\"azure\")).azure.enforcedMeasurements) = [15]" \
|
||||||
constellation-conf.yaml
|
constellation-conf.yaml
|
||||||
|
|
||||||
yq eval -i \
|
yq eval -i \
|
||||||
"(.provider | select(. | has(\"gcp\")).gcp.project) = \"${{ inputs.gcpProject }}\" |
|
"(.provider | select(. | has(\"gcp\")).gcp.project) = \"${{ inputs.gcpProject }}\" |
|
||||||
(.provider | select(. | has(\"gcp\")).gcp.region) = \"europe-west3\" |
|
(.provider | select(. | has(\"gcp\")).gcp.region) = \"europe-west3\" |
|
||||||
|
@ -79,6 +86,14 @@ runs:
|
||||||
(.provider | select(. | has(\"gcp\")).gcp.serviceAccountKeyPath) = \"serviceAccountKey.json\"" \
|
(.provider | select(. | has(\"gcp\")).gcp.serviceAccountKeyPath) = \"serviceAccountKey.json\"" \
|
||||||
constellation-conf.yaml
|
constellation-conf.yaml
|
||||||
|
|
||||||
|
yq eval -i \
|
||||||
|
"(.provider | select(. | has(\"aws\")).aws.region) = \"eu-central-1\" |
|
||||||
|
(.provider | select(. | has(\"aws\")).aws.zone) = \"eu-central-1a\" |
|
||||||
|
(.provider | select(. | has(\"aws\")).aws.iamProfileControlPlane) = \"e2e_test_control_plane_instance_profile\" |
|
||||||
|
(.provider | select(. | has(\"aws\")).aws.iamProfileWorkerNodes) = \"e2e_test_worker_node_instance_profile\" |
|
||||||
|
(.provider | select(. | has(\"aws\")).aws.enforcedMeasurements) = [15]" \
|
||||||
|
constellation-conf.yaml
|
||||||
|
|
||||||
if [ ${{ inputs.kubernetesVersion != '' }} = true ]; then
|
if [ ${{ inputs.kubernetesVersion != '' }} = true ]; then
|
||||||
yq eval -i "(.kubernetesVersion) = ${{ inputs.kubernetesVersion }}" constellation-conf.yaml
|
yq eval -i "(.kubernetesVersion) = ${{ inputs.kubernetesVersion }}" constellation-conf.yaml
|
||||||
fi
|
fi
|
||||||
|
@ -111,6 +126,16 @@ runs:
|
||||||
|
|
||||||
yq eval -i "(.provider.gcp.image) = \"${GCP_IMAGE}\"" constellation-conf.yaml
|
yq eval -i "(.provider.gcp.image) = \"${GCP_IMAGE}\"" constellation-conf.yaml
|
||||||
;;
|
;;
|
||||||
|
aws)
|
||||||
|
if [ "${{ inputs.osImage == 'debug-latest' }}" = true ]
|
||||||
|
then
|
||||||
|
AWS_IMAGE=$(aws ec2 describe-images --owners 795746500882 --region eu-central-1 --filters "Name=name,Values=constellation-debug-v*" --query "sort_by(Images, &CreationDate)[].ImageId" | jq -r '.[-1]')
|
||||||
|
else
|
||||||
|
AWS_IMAGE=${{ inputs.osImage }}
|
||||||
|
fi
|
||||||
|
|
||||||
|
yq eval -i "(.provider.aws.image) = \"${AWS_IMAGE}\"" constellation-conf.yaml
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
- name: Set instanceType
|
- name: Set instanceType
|
||||||
|
@ -119,6 +144,7 @@ runs:
|
||||||
run: |
|
run: |
|
||||||
yq eval -i "(.provider | select(. | has(\"azure\")).azure.instanceType) = \"${{ inputs.machineType }}\"" constellation-conf.yaml
|
yq eval -i "(.provider | select(. | has(\"azure\")).azure.instanceType) = \"${{ inputs.machineType }}\"" constellation-conf.yaml
|
||||||
yq eval -i "(.provider | select(. | has(\"gcp\")).gcp.instanceType) = \"${{ inputs.machineType }}\"" constellation-conf.yaml
|
yq eval -i "(.provider | select(. | has(\"gcp\")).gcp.instanceType) = \"${{ inputs.machineType }}\"" constellation-conf.yaml
|
||||||
|
yq eval -i "(.provider | select(. | has(\"aws\")).aws.instanceType) = \"${{ inputs.machineType }}\"" constellation-conf.yaml
|
||||||
|
|
||||||
- name: Create serviceAccountKey.json
|
- name: Create serviceAccountKey.json
|
||||||
if: ${{ inputs.cloudProvider == 'gcp' }}
|
if: ${{ inputs.cloudProvider == 'gcp' }}
|
||||||
|
@ -196,6 +222,9 @@ runs:
|
||||||
gcp)
|
gcp)
|
||||||
./.github/actions/constellation_create/gcp-logs.sh
|
./.github/actions/constellation_create/gcp-logs.sh
|
||||||
;;
|
;;
|
||||||
|
aws)
|
||||||
|
./.github/actions/constellation_create/aws-logs.sh eu-central-1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
|
51
.github/actions/constellation_create/aws-logs.sh
vendored
Executable file
51
.github/actions/constellation_create/aws-logs.sh
vendored
Executable file
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Usage: ./aws-logs.sh <region>
|
||||||
|
|
||||||
|
controlAutoscalingGroup=$(\
|
||||||
|
terraform show -json | \
|
||||||
|
jq -r .'values.root_module.child_modules[] |
|
||||||
|
select(.address == "module.instance_group_control_plane") |
|
||||||
|
.resources[0].values.name' \
|
||||||
|
)
|
||||||
|
workerAutoscalingGroup=$(\
|
||||||
|
terraform show -json | \
|
||||||
|
jq -r .'values.root_module.child_modules[] |
|
||||||
|
select(.address == "module.instance_group_worker_nodes") |
|
||||||
|
.resources[0].values.name' \
|
||||||
|
)
|
||||||
|
|
||||||
|
controlInstances=$(\
|
||||||
|
aws autoscaling describe-auto-scaling-groups \
|
||||||
|
--region "${1}" \
|
||||||
|
--no-paginate \
|
||||||
|
--output json \
|
||||||
|
--auto-scaling-group-names "${controlAutoscalingGroup}" | \
|
||||||
|
jq -r '.AutoScalingGroups[0].Instances[].InstanceId' \
|
||||||
|
)
|
||||||
|
workerInstances=$(\
|
||||||
|
aws autoscaling describe-auto-scaling-groups \
|
||||||
|
--region "${1}" \
|
||||||
|
--no-paginate \
|
||||||
|
--output json \
|
||||||
|
--auto-scaling-group-names "${workerAutoscalingGroup}" | \
|
||||||
|
jq -r '.AutoScalingGroups[0].Instances[].InstanceId' \
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "Fetching logs from control planes: ${controlInstances}"
|
||||||
|
|
||||||
|
for instance in $controlInstances; do
|
||||||
|
printf "Fetching for %s\n" ${instance}
|
||||||
|
aws ec2 get-console-output --region ${1} --instance-id ${instance} | \
|
||||||
|
jq -r .'Output' | \
|
||||||
|
tail -n +2 > control-plane-${instance}.log
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Fetching logs from worker nodes: ${workerInstances}"
|
||||||
|
|
||||||
|
for instance in $workerInstances; do
|
||||||
|
printf "Fetching for %s\n" ${instance}
|
||||||
|
aws ec2 get-console-output --region ${1} --instance-id ${instance} | \
|
||||||
|
jq -r .'Output' | \
|
||||||
|
tail -n +2 > worker-${instance}.log
|
||||||
|
done
|
|
@ -16,6 +16,6 @@ for scaleset in $scalesetslist; do
|
||||||
bloburi=$(az rest --method post --url https://management.azure.com/subscriptions/${subscription}/resourceGroups/${1}/providers/Microsoft.Compute/virtualMachineScaleSets/${scaleset}/virtualmachines/$instanceid/retrieveBootDiagnosticsData?api-version=2022-03-01 | jq '.serialConsoleLogBlobUri' -r)
|
bloburi=$(az rest --method post --url https://management.azure.com/subscriptions/${subscription}/resourceGroups/${1}/providers/Microsoft.Compute/virtualMachineScaleSets/${scaleset}/virtualmachines/$instanceid/retrieveBootDiagnosticsData?api-version=2022-03-01 | jq '.serialConsoleLogBlobUri' -r)
|
||||||
sleep 4
|
sleep 4
|
||||||
curl -sL -o "./${scaleset}-${instanceid}.log" $bloburi
|
curl -sL -o "./${scaleset}-${instanceid}.log" $bloburi
|
||||||
echo $(realpath "./${scaleset}-${instanceid}.log")
|
realpath "./${scaleset}-${instanceid}.log"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Usage: ./gcp-logs.sh
|
|
||||||
|
|
||||||
CONTROL_INSTANCE_GROUP=$(terraform show -json | jq -r .'values.root_module.child_modules[] | select(.address == "module.instance_group_control_plane") | .resources[0].values.base_instance_name' )
|
CONTROL_INSTANCE_GROUP=$(terraform show -json | jq -r .'values.root_module.child_modules[] | select(.address == "module.instance_group_control_plane") | .resources[0].values.base_instance_name' )
|
||||||
WORKER_INSTANCE_GROUP=$(terraform show -json | jq -r .'values.root_module.child_modules[] | select(.address == "module.instance_group_worker") | .resources[0].values.base_instance_name')
|
WORKER_INSTANCE_GROUP=$(terraform show -json | jq -r .'values.root_module.child_modules[] | select(.address == "module.instance_group_worker") | .resources[0].values.base_instance_name')
|
||||||
ZONE=$(terraform show -json | jq -r .'values.root_module.child_modules[] | select(.address == "module.instance_group_control_plane") | .resources[0].values.zone' )
|
ZONE=$(terraform show -json | jq -r .'values.root_module.child_modules[] | select(.address == "module.instance_group_control_plane") | .resources[0].values.zone' )
|
||||||
|
|
7
.github/actions/e2e_test/action.yml
vendored
7
.github/actions/e2e_test/action.yml
vendored
|
@ -128,6 +128,13 @@ runs:
|
||||||
with:
|
with:
|
||||||
gcp_service_account_json: ${{ inputs.gcp_service_account_json }}
|
gcp_service_account_json: ${{ inputs.gcp_service_account_json }}
|
||||||
|
|
||||||
|
- name: Login to AWS
|
||||||
|
if: inputs.cloudProvider == 'aws'
|
||||||
|
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # tag=v1.7.0
|
||||||
|
with:
|
||||||
|
role-to-assume: arn:aws:iam::795746500882:role/GithubActionsE2E
|
||||||
|
aws-region: eu-central-1
|
||||||
|
|
||||||
- name: Create cluster
|
- name: Create cluster
|
||||||
id: constellation-create
|
id: constellation-create
|
||||||
uses: ./.github/actions/constellation_create
|
uses: ./.github/actions/constellation_create
|
||||||
|
|
4
.github/workflows/e2e-test-manual.yml
vendored
4
.github/workflows/e2e-test-manual.yml
vendored
|
@ -17,6 +17,7 @@ on:
|
||||||
options:
|
options:
|
||||||
- "gcp"
|
- "gcp"
|
||||||
- "azure"
|
- "azure"
|
||||||
|
- "aws"
|
||||||
default: "azure"
|
default: "azure"
|
||||||
required: true
|
required: true
|
||||||
test:
|
test:
|
||||||
|
@ -57,6 +58,9 @@ env:
|
||||||
jobs:
|
jobs:
|
||||||
e2e-test-manual:
|
e2e-test-manual:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
|
||||||
|
|
1
.github/workflows/release-cli.yml
vendored
1
.github/workflows/release-cli.yml
vendored
|
@ -60,6 +60,7 @@ jobs:
|
||||||
uses: ./.github/actions/login_azure
|
uses: ./.github/actions/login_azure
|
||||||
with:
|
with:
|
||||||
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
|
||||||
|
|
||||||
- name: Login to GCP
|
- name: Login to GCP
|
||||||
uses: ./.github/actions/login_gcp
|
uses: ./.github/actions/login_gcp
|
||||||
with:
|
with:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue