Add CI action to install CSI drivers

This commit is contained in:
Christoph Meyer 2022-10-27 14:57:54 +00:00 committed by cm
parent ad15c7f84d
commit 94429c8db8
5 changed files with 69 additions and 26 deletions

View File

@ -1,8 +1,30 @@
name: Constellation destroy
description: "Destroy a running Constellation cluster."
runs:
using: 'composite'
using: "composite"
steps:
- name: Constellation terminate
run: constellation terminate --yes
shell: bash
- name: Delete PVs
shell: bash
run: |
ELAPSED=0
kubectl delete pvc --all --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: ${{ github.workspace }}/constellation-admin.conf
PV_DELETION_TIMEOUT: "120" # 2 minutes timeout for pv deletion
- name: Constellation terminate
run: constellation terminate --yes
shell: bash

View File

@ -0,0 +1,35 @@
name: Install CSI drivers
description: Installs the Constellation CSI drivers depending on the cloud provider.
inputs:
cloudProvider:
description: |
Cloud provider for the Constellation cluster.
Either 'gcp' or 'azure'.
required: true
kubeconfig:
description: "The kubeconfig of the cluster to test."
required: true
runs:
using: composite
steps:
- 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/install_csi_drivers/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/install_csi_drivers/azure_sc.yml
env:
KUBECONFIG: ${{ inputs.kubeconfig }}

View File

@ -16,7 +16,7 @@ runs:
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
@ -26,7 +26,7 @@ runs:
with:
fetch-depth: 0
repository: "edgelesssys/k-bench"
ref: 'feat/constellation'
ref: "feat/constellation"
path: k-bench
- name: Install patched K-Bench
@ -34,25 +34,11 @@ runs:
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: Install Constellation CSI drivers and create storage class
uses: ./.github/actions/install_csi_drivers
with:
kubeconfig: ${{ inputs.kubeconfig }}
cloudProvider: ${{ inputs.cloudProvider }}
- name: Run K-Bench
shell: bash
@ -84,7 +70,7 @@ runs:
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
do
echo $(kubectl get pv -o json | jq '.items | length') PV remaining..
sleep 1
ELAPSED=$((ELAPSED+1))