2023-02-28 04:13:26 -05:00
|
|
|
name: benchmark
|
|
|
|
description: "Run benchmarks"
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
cloudProvider:
|
|
|
|
description: "Which cloud provider to use."
|
|
|
|
required: true
|
2024-01-25 09:32:19 -05:00
|
|
|
attestationVariant:
|
|
|
|
description: "Which attestation variant to use."
|
|
|
|
required: true
|
2023-02-28 04:13:26 -05:00
|
|
|
kubeconfig:
|
|
|
|
description: "The kubeconfig of the cluster to test."
|
|
|
|
required: true
|
2023-03-01 10:46:23 -05:00
|
|
|
awsOpenSearchDomain:
|
|
|
|
description: "AWS OpenSearch Endpoint Domain to upload the results."
|
|
|
|
required: false
|
|
|
|
awsOpenSearchUsers:
|
|
|
|
description: "AWS OpenSearch User to upload the results."
|
|
|
|
required: false
|
|
|
|
awsOpenSearchPwd:
|
|
|
|
description: "AWS OpenSearch Password to upload the results."
|
|
|
|
required: false
|
2024-02-27 02:59:22 -05:00
|
|
|
artifactNameSuffix:
|
|
|
|
description: "Suffix for artifact naming."
|
|
|
|
required: true
|
2023-12-21 13:28:18 -05:00
|
|
|
encryptionSecret:
|
2023-12-20 09:17:49 -05:00
|
|
|
description: 'The secret to use for encrypting the artifact.'
|
|
|
|
required: true
|
2023-02-28 04:13:26 -05:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Setup python
|
2024-05-08 08:33:35 -04:00
|
|
|
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
|
2023-02-28 04:13:26 -05:00
|
|
|
with:
|
|
|
|
python-version: "3.10"
|
|
|
|
|
|
|
|
- name: Install kubestr
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
KUBESTR_VER: "0.4.37"
|
|
|
|
run: |
|
|
|
|
HOSTOS="$(go env GOOS)"
|
|
|
|
HOSTARCH="$(go env GOARCH)"
|
|
|
|
curl -fsSLO https://github.com/kastenhq/kubestr/releases/download/v${KUBESTR_VER}/kubestr_${KUBESTR_VER}_${HOSTOS}_${HOSTARCH}.tar.gz
|
|
|
|
tar -xzf kubestr_${KUBESTR_VER}_${HOSTOS}_${HOSTARCH}.tar.gz
|
|
|
|
install kubestr /usr/local/bin
|
|
|
|
|
|
|
|
- name: Checkout k8s-bench-suite
|
2024-06-19 09:19:41 -04:00
|
|
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
2023-02-28 04:13:26 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-09-25 05:59:36 -04:00
|
|
|
repository: "edgelesssys/k8s-bench-suite"
|
|
|
|
ref: 67c64c854841165b778979375444da1c02e02210
|
2023-02-28 04:13:26 -05:00
|
|
|
path: k8s-bench-suite
|
|
|
|
|
2024-06-04 07:23:07 -04:00
|
|
|
- name: Run FIO benchmark
|
2023-03-23 06:23:57 -04:00
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
KUBECONFIG: ${{ inputs.kubeconfig }}
|
|
|
|
run: |
|
2024-06-04 07:23:07 -04:00
|
|
|
if [[ "${{ inputs.cloudProvider }}" == "azure" ]]
|
|
|
|
then
|
2023-03-23 06:23:57 -04:00
|
|
|
cat <<EOF | kubectl apply -f -
|
|
|
|
apiVersion: storage.k8s.io/v1
|
|
|
|
kind: StorageClass
|
|
|
|
metadata:
|
2024-06-04 07:23:07 -04:00
|
|
|
name: fio-benchmark
|
2023-03-23 06:23:57 -04:00
|
|
|
allowVolumeExpansion: true
|
|
|
|
allowedTopologies: []
|
|
|
|
mountOptions: []
|
|
|
|
parameters:
|
|
|
|
skuname: StandardSSD_LRS
|
|
|
|
cachingMode: None
|
|
|
|
provisioner: azuredisk.csi.confidential.cloud
|
|
|
|
reclaimPolicy: Delete
|
|
|
|
volumeBindingMode: Immediate
|
|
|
|
EOF
|
2024-06-04 07:23:07 -04:00
|
|
|
fi
|
2023-03-23 06:23:57 -04:00
|
|
|
|
2024-06-04 07:23:07 -04:00
|
|
|
if [[ "${{ inputs.cloudProvider }}" == "gcp" ]]
|
|
|
|
then
|
2023-03-23 06:23:57 -04:00
|
|
|
cat <<EOF | kubectl apply -f -
|
|
|
|
apiVersion: storage.k8s.io/v1
|
|
|
|
kind: StorageClass
|
|
|
|
metadata:
|
2024-06-04 07:23:07 -04:00
|
|
|
name: fio-benchmark
|
2023-03-23 06:23:57 -04:00
|
|
|
provisioner: gcp.csi.confidential.cloud
|
|
|
|
volumeBindingMode: Immediate
|
|
|
|
allowVolumeExpansion: true
|
|
|
|
parameters:
|
|
|
|
type: pd-balanced
|
|
|
|
EOF
|
2024-06-04 07:23:07 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${{ inputs.cloudProvider }}" == "aws" ]]
|
|
|
|
then
|
|
|
|
cat <<EOF | kubectl apply -f -
|
|
|
|
apiVersion: storage.k8s.io/v1
|
|
|
|
kind: StorageClass
|
|
|
|
metadata:
|
|
|
|
name: fio-benchmark
|
|
|
|
parameters:
|
|
|
|
type: gp3
|
|
|
|
provisioner: aws.csi.confidential.cloud
|
|
|
|
allowVolumeExpansion: true
|
|
|
|
reclaimPolicy: Delete
|
|
|
|
volumeBindingMode: Immediate
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
2023-02-28 04:13:26 -05:00
|
|
|
mkdir -p out
|
2024-06-04 07:23:07 -04:00
|
|
|
kubestr fio -e "out/fio-constellation-${{ inputs.attestationVariant }}.json" -o json -s fio-benchmark -z 400Gi -f .github/actions/e2e_benchmark/fio.ini
|
2023-02-28 04:13:26 -05:00
|
|
|
|
|
|
|
- name: Upload raw FIO benchmark results
|
|
|
|
if: (!env.ACT)
|
2023-12-20 09:17:49 -05:00
|
|
|
uses: ./.github/actions/artifact_upload
|
2023-02-28 04:13:26 -05:00
|
|
|
with:
|
2024-06-04 07:23:07 -04:00
|
|
|
path: "out/fio-constellation-${{ inputs.attestationVariant }}.json"
|
2024-02-27 02:59:22 -05:00
|
|
|
name: "fio-constellation-${{ inputs.artifactNameSuffix }}.json"
|
2023-12-21 13:28:18 -05:00
|
|
|
encryptionSecret: ${{ inputs.encryptionSecret }}
|
2023-02-28 04:13:26 -05:00
|
|
|
|
|
|
|
- name: Run knb benchmark
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
KUBECONFIG: ${{ inputs.kubeconfig }}
|
|
|
|
TERM: xterm-256color
|
|
|
|
run: |
|
2024-06-04 07:23:07 -04:00
|
|
|
workers="$(kubectl get nodes -o name -l '!node-role.kubernetes.io/control-plane')"
|
2023-02-28 04:13:26 -05:00
|
|
|
echo -e "Found workers:\n$workers"
|
|
|
|
server="$(echo "$workers" | tail +1 | head -1 | cut -d '/' -f2)"
|
|
|
|
echo "Server: $server"
|
|
|
|
client="$(echo "$workers" | tail +2 | head -1 | cut -d '/' -f2)"
|
|
|
|
echo "Client: $client"
|
2024-06-04 07:23:07 -04:00
|
|
|
k8s-bench-suite/knb -f "out/knb-constellation-${{ inputs.attestationVariant }}.json" -o json --server-node "$server" --client-node "$client"
|
2023-02-28 04:13:26 -05:00
|
|
|
|
|
|
|
- name: Upload raw knb benchmark results
|
|
|
|
if: (!env.ACT)
|
2023-12-20 09:17:49 -05:00
|
|
|
uses: ./.github/actions/artifact_upload
|
2023-02-28 04:13:26 -05:00
|
|
|
with:
|
2024-06-04 07:23:07 -04:00
|
|
|
path: "out/knb-constellation-${{ inputs.attestationVariant }}.json"
|
2024-02-27 02:59:22 -05:00
|
|
|
name: "knb-constellation-${{ inputs.artifactNameSuffix }}.json"
|
2023-12-21 13:28:18 -05:00
|
|
|
encryptionSecret: ${{ inputs.encryptionSecret }}
|
2023-02-28 04:13:26 -05:00
|
|
|
|
2024-01-25 05:12:32 -05:00
|
|
|
- name: Parse results, create diagrams and post the progression summary
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
# Original result directory
|
|
|
|
BENCH_RESULTS: out/
|
|
|
|
# Working directory containing the previous results as JSON and to contain the graphs
|
|
|
|
BDIR: benchmarks
|
|
|
|
CSP: ${{ inputs.cloudProvider }}
|
2024-06-04 07:23:07 -04:00
|
|
|
ATTESTATION_VARIANT: ${{ inputs.attestationVariant }}
|
2024-01-25 05:12:32 -05:00
|
|
|
run: |
|
|
|
|
mkdir -p benchmarks
|
|
|
|
python .github/actions/e2e_benchmark/evaluate/parse.py
|
|
|
|
|
|
|
|
- name: Upload benchmark results to action run
|
|
|
|
if: (!env.ACT)
|
|
|
|
uses: ./.github/actions/artifact_upload
|
|
|
|
with:
|
|
|
|
path: >
|
2024-06-04 07:23:07 -04:00
|
|
|
benchmarks/constellation-${{ inputs.attestationVariant }}.json
|
2024-02-27 02:59:22 -05:00
|
|
|
name: "benchmarks-${{ inputs.artifactNameSuffix }}"
|
2024-01-25 05:12:32 -05:00
|
|
|
encryptionSecret: ${{ inputs.encryptionSecret }}
|
|
|
|
|
2023-02-28 04:13:26 -05:00
|
|
|
- name: Assume AWS role to retrieve and update benchmarks in S3
|
2024-02-21 09:29:06 -05:00
|
|
|
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
|
2023-02-28 04:13:26 -05:00
|
|
|
with:
|
|
|
|
role-to-assume: arn:aws:iam::795746500882:role/GithubActionUpdateBenchmarks
|
|
|
|
aws-region: us-east-2
|
|
|
|
|
|
|
|
- name: Set S3 artifact store
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
ARTIFACT_BUCKET_CONSTELLATION: "edgeless-artifact-store/constellation"
|
|
|
|
run: echo S3_PATH=s3://${ARTIFACT_BUCKET_CONSTELLATION}/benchmarks >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Get previous benchmark records from S3
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-06-04 07:23:07 -04:00
|
|
|
if aws s3 cp "${S3_PATH}/constellation-${{ inputs.attestationVariant }}.json" ./ --no-progress
|
|
|
|
then
|
|
|
|
mv "constellation-${{ inputs.attestationVariant }}.json" "benchmarks/constellation-${{ inputs.attestationVariant }}-previous.json"
|
2023-02-28 04:13:26 -05:00
|
|
|
else
|
|
|
|
echo "::warning::Couldn't retrieve previous benchmark records from s3"
|
|
|
|
fi
|
|
|
|
|
2024-01-25 05:12:32 -05:00
|
|
|
- name: Compare results
|
2023-02-28 04:13:26 -05:00
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
# Paths to benchmark results as JSON of the previous run and the current run
|
2024-06-04 07:23:07 -04:00
|
|
|
PREV_BENCH: benchmarks/constellation-${{ inputs.attestationVariant }}-previous.json
|
|
|
|
CURR_BENCH: benchmarks/constellation-${{ inputs.attestationVariant }}.json
|
2023-02-28 04:13:26 -05:00
|
|
|
run: |
|
|
|
|
if [[ -f "$PREV_BENCH" ]]; then
|
2024-01-25 05:12:32 -05:00
|
|
|
# Fails if the results are outside the threshold range
|
2023-02-28 04:13:26 -05:00
|
|
|
python .github/actions/e2e_benchmark/evaluate/compare.py >> $GITHUB_STEP_SUMMARY
|
|
|
|
fi
|
|
|
|
|
2024-06-04 07:23:07 -04:00
|
|
|
- name: Upload benchmark results to OpenSearch
|
2023-03-01 10:46:23 -05:00
|
|
|
if: (!env.ACT)
|
2023-02-28 04:13:26 -05:00
|
|
|
shell: bash
|
2023-03-01 10:46:23 -05:00
|
|
|
env:
|
|
|
|
OPENSEARCH_DOMAIN: ${{ inputs.awsOpenSearchDomain }}
|
|
|
|
OPENSEARCH_USER: ${{ inputs.awsOpenSearchUsers }}
|
|
|
|
OPENSEARCH_PWD: ${{ inputs.awsOpenSearchPwd }}
|
2023-02-28 04:13:26 -05:00
|
|
|
run: |
|
2023-03-01 10:46:23 -05:00
|
|
|
curl -XPOST \
|
|
|
|
-u "${OPENSEARCH_USER}:${OPENSEARCH_PWD}" \
|
2024-06-04 07:23:07 -04:00
|
|
|
"${OPENSEARCH_DOMAIN}/benchmarks-${{ inputs.attestationVariant }}-$(date '+%Y')"/_doc \
|
|
|
|
--data-binary @benchmarks/constellation-${{ inputs.attestationVariant }}.json \
|
2023-03-01 10:46:23 -05:00
|
|
|
-H 'Content-Type: application/json'
|
2023-02-28 04:13:26 -05:00
|
|
|
|
|
|
|
- name: Update benchmark records in S3
|
|
|
|
if: github.ref_name == 'main'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-06-04 07:23:07 -04:00
|
|
|
aws s3 cp benchmarks/constellation-${{ inputs.attestationVariant }}.json ${S3_PATH}/constellation-${{ inputs.attestationVariant }}.json
|