constellation/.github/actions/k-bench/action.yml
renovate[bot] f60120bbbc
Update github actions dependencies (#420)
Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2022-11-02 11:00:40 +01:00

132 lines
5.5 KiB
YAML

name: k-bench
description: "Run K-Bench"
inputs:
cloudProvider:
description: "Which cloud provider to use."
required: true
kubeconfig:
description: "The kubeconfig of the cluster to test."
required: true
runs:
using: "composite"
steps:
- name: Setup python
uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # tag=v4.3.0
with:
python-version: "3.10"
- name: Install evaluation dependencies
shell: bash
run: pip install -r .github/actions/k-bench/evaluate/requirements.txt
- name: Checkout patched K-Bench
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
with:
fetch-depth: 0
repository: "edgelesssys/k-bench"
ref: 'feat/constellation'
path: k-bench
- name: Install patched K-Bench
working-directory: "k-bench"
run: ./install.sh
shell: bash
- name: Install Constellation GCP CSI driver and create storage class
if: ${{ inputs.cloudProvider == 'gcp' }}
shell: bash
run: |
kubectl apply -k github.com/edgelesssys/constellation-gcp-compute-persistent-disk-csi-driver/deploy/kubernetes/overlays/edgeless/latest
kubectl wait -n kube-system deployments csi-gce-pd-controller --for condition=available
kubectl apply -f .github/actions/k-bench/gcp_sc.yml
env:
KUBECONFIG: ${{ inputs.kubeconfig }}
- name: Install Constellation Azure CSI driver and create storage class
if: ${{ inputs.cloudProvider == 'azure' }}
shell: bash
run: |
helm install azuredisk-csi-driver https://raw.githubusercontent.com/edgelesssys/constellation-azuredisk-csi-driver/main/charts/edgeless/latest/azuredisk-csi-driver.tgz --namespace kube-system --set linux.distro=fedora --set controller.replicas=1
kubectl wait -n kube-system deployments csi-azuredisk-controller --for condition=available --timeout=300s
kubectl apply -f .github/actions/k-bench/azure_sc.yml
env:
KUBECONFIG: ${{ inputs.kubeconfig }}
- name: Run K-Bench
shell: bash
working-directory: k-bench
run: |
mkdir -p ./out
kubectl create namespace kbench-pod-namespace --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f ../.github/actions/k-bench/encrypted_storage.yml
./run.sh -r "kbench-constellation-${{ inputs.cloudProvider }}" -t "default" -o "./out/"
kubectl delete namespace kbench-pod-namespace --wait=true || true
kubectl create namespace kbench-pod-namespace --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f ../.github/actions/k-bench/encrypted_storage.yml
./run.sh -r "kbench-constellation-${{ inputs.cloudProvider }}" -t "dp_fio" -o "./out/"
kubectl delete namespace kbench-pod-namespace --wait=true || true
kubectl create namespace kbench-pod-namespace --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f ../.github/actions/k-bench/encrypted_storage.yml
./run.sh -r "kbench-constellation-${{ inputs.cloudProvider }}" -t "dp_network_internode" -o "./out/"
kubectl delete namespace kbench-pod-namespace --wait=true || true
kubectl create namespace kbench-pod-namespace --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f ../.github/actions/k-bench/encrypted_storage.yml
./run.sh -r "kbench-constellation-${{ inputs.cloudProvider }}" -t "dp_network_intranode" -o "./out/"
env:
KUBECONFIG: ${{ inputs.kubeconfig }}
- name: Delete namespace and PVCs
shell: bash
run: |
ELAPSED=0
kubectl delete namespace kbench-pod-namespace --wait=true || true
echo "::group::Wait for PV deletion"
until [ "$(kubectl get pv -o json | jq '.items | length')" == "0" ] || [ $ELAPSED -gt $PV_DELETION_TIMEOUT ];
do
echo $(kubectl get pv -o json | jq '.items | length') PV remaining..
sleep 1
ELAPSED=$((ELAPSED+1))
done
if [ $ELAPSED -gt $PV_DELETION_TIMEOUT ]; then
echo "Timed out waiting for PV deletion.."
exit 1
fi
echo "::endgroup::"
env:
KUBECONFIG: ${{ inputs.kubeconfig }}
PV_DELETION_TIMEOUT: "120" # 2 minutes timeout for pv deletion
- name: Merge K-Bench results
working-directory: k-bench
shell: bash
run: |
mkdir -p "./out/kbench-constellation-${{ inputs.cloudProvider }}"
mv ./out/results_kbench-constellation-${{ inputs.cloudProvider }}_*m/* "./out/kbench-constellation-${{ inputs.cloudProvider }}/"
ls -l "./out/kbench-constellation-${{ inputs.cloudProvider }}"
cat ./out/kbench-constellation-${{ inputs.cloudProvider }}/*/kbench.log
- name: Upload original benchmark results
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # tag=v3.1.1
if: ${{ !env.ACT }}
with:
path: "k-bench/out/kbench-constellation-${{ inputs.cloudProvider }}"
name: "k-bench-constellation-${{ inputs.cloudProvider }}"
- name: Parse test results and create diagrams
shell: bash
run: python .github/actions/k-bench/evaluate/main.py
env:
KBENCH_RESULTS: ${{ github.workspace }}/k-bench/out/
CSP: ${{ inputs.cloudProvider }}
- name: Upload benchmark results
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # tag=v3.1.1
if: ${{ !env.ACT }}
with:
path: |
*_perf.png
kbench_results.json
name: "benchmark_results"