gha: Create Mariner host as part of k8s tests

The current testing setup only supports running Kata on top of an Ubuntu
host. This adds Mariner to the matrix of testable hosts for k8s
tests, with Cloud Hypervisor as a VMM.

As preparation for the upcoming PR that will change only the actual test
code (rather than workflow YAMLs), this also introduces a new file
`setup.sh` that will be used to set host-specific parameters at test
run-time.

Fixes: #6961

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This commit is contained in:
Aurélien Bombo 2023-04-13 15:05:10 -07:00
parent 59cefa719c
commit 4af4ced1aa
3 changed files with 33 additions and 2 deletions

View File

@ -17,10 +17,15 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
host_os:
- ubuntu
vmm: vmm:
- clh - clh
- dragonball - dragonball
- qemu - qemu
include:
- host_os: cbl-mariner
vmm: clh
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -46,7 +51,8 @@ jobs:
-n "${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.vmm }}-amd64" \ -n "${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.vmm }}-amd64" \
-s "Standard_D4s_v5" \ -s "Standard_D4s_v5" \
--node-count 1 \ --node-count 1 \
--generate-ssh-keys --generate-ssh-keys \
${{ matrix.host_os == 'cbl-mariner' && '--os-sku mariner --workload-runtime KataMshvVmIsolation' }}
- name: Install `bats` - name: Install `bats`
run: | run: |
@ -79,10 +85,11 @@ jobs:
sleep 240s sleep 240s
pushd tests/integration/kubernetes pushd tests/integration/kubernetes
sed -i -e 's|runtimeClassName: kata|runtimeClassName: kata-${{ matrix.vmm }}|' runtimeclass_workloads/*.yaml bash setup.sh
bash run_kubernetes_tests.sh bash run_kubernetes_tests.sh
popd popd
env: env:
KATA_HOST_OS: ${{ matrix.host_os }}
KATA_HYPERVISOR: ${{ matrix.vmm }} KATA_HYPERVISOR: ${{ matrix.vmm }}
- name: Delete AKS cluster - name: Delete AKS cluster

View File

@ -54,6 +54,10 @@ else
) )
fi fi
if [ ${KATA_HOST_OS} == "cbl-mariner" ]; then
exit 0
fi
# we may need to skip a few test cases when running on non-x86_64 arch # we may need to skip a few test cases when running on non-x86_64 arch
arch_config_file="${kubernetes_dir}/filter_out_per_arch/${TARGET_ARCH}.yaml" arch_config_file="${kubernetes_dir}/filter_out_per_arch/${TARGET_ARCH}.yaml"
if [ -f "${arch_config_file}" ]; then if [ -f "${arch_config_file}" ]; then

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Copyright (c) 2023 Microsoft Corporation
#
# SPDX-License-Identifier: Apache-2.0
set -o errexit
set -o nounset
set -o pipefail
kubernetes_dir=$(dirname "$(readlink -f "$0")")
set_runtime_class() {
sed -i -e "s|runtimeClassName: kata|runtimeClassName: kata-${KATA_HYPERVISOR}|" ${kubernetes_dir}/runtimeclass_workloads/*.yaml
}
main() {
set_runtime_class
}
main "$@"