Skip to content

Commit

Permalink
gha: Create Mariner host as part of k8s tests
Browse files Browse the repository at this point in the history
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: kata-containers/tests#5528

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
  • Loading branch information
sprt committed May 15, 2023
1 parent da877a6 commit 3fc98de
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/run-k8s-tests-on-aks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ jobs:
strategy:
fail-fast: false
matrix:
host_os:
- ubuntu
vmm:
- clh
- dragonball
- qemu
include:
- host_os: cbl-mariner
vmm: clh
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -46,7 +51,8 @@ jobs:
-n "${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.vmm }}-amd64" \
-s "Standard_D4s_v5" \
--node-count 1 \
--generate-ssh-keys
--generate-ssh-keys \
${{ matrix.host_os == 'cbl-mariner' && '--os-sku mariner --workload-runtime KataMshvVmIsolation' }}
- name: Install `bats`
run: |
Expand Down Expand Up @@ -76,10 +82,11 @@ jobs:
timeout-minutes: 30
run: |
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
popd
env:
KATA_HOST_OS: ${{ matrix.host_os }}
KATA_HYPERVISOR: ${{ matrix.vmm }}

- name: Delete AKS cluster
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/kubernetes/run_kubernetes_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ if [ ${KATA_HYPERVISOR} == "qemu-snp" ]; then
exit 0
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
arch_config_file="${kubernetes_dir}/filter_out_per_arch/${TARGET_ARCH}.yaml"
if [ -f "${arch_config_file}" ]; then
Expand Down
14 changes: 14 additions & 0 deletions tests/integration/kubernetes/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Copyright (c) 2023 Microsoft Corporation
#
# SPDX-License-Identifier: Apache-2.0

set -o errexit
set -o nounset
set -o pipefail

set_runtime_class() {
sed -i -e "s|runtimeClassName: kata|runtimeClassName: kata-${KATA_HYPERVISOR}|" runtimeclass_workloads/*.yaml
}

set_runtime_class

0 comments on commit 3fc98de

Please sign in to comment.