mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-13 13:46:46 +00:00
tests: k8s: Leave runtimeclass_workloads/
alone
Makes it so that `setup.sh` doesn't make changes in `runtimeclass_workloads/` directly. Instead we treat that as a template directory and we use the new directory `runtimeclass_workloads_work/` as a work dir. This has two advantages: * Allows rerunning tests without the assumption that `setup.sh` must be idempotent. E.g. the `set_runtime_class()` step would break. * Doesn't pollute your git environment with a bunch of changes when developing. Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This commit is contained in:
parent
bdde6aa948
commit
d7f04a64a0
1
tests/.gitignore
vendored
Normal file
1
tests/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
integration/kubernetes/runtimeclass_workloads_work/
|
@ -10,25 +10,31 @@ set -o pipefail
|
||||
kubernetes_dir=$(dirname "$(readlink -f "$0")")
|
||||
source "${kubernetes_dir}/../../common.bash"
|
||||
|
||||
reset_workloads_work_dir() {
|
||||
rm -rf ${kubernetes_dir}/runtimeclass_workloads_work
|
||||
cp -R ${kubernetes_dir}/runtimeclass_workloads ${kubernetes_dir}/runtimeclass_workloads_work
|
||||
}
|
||||
|
||||
set_runtime_class() {
|
||||
sed -i -e "s|runtimeClassName: kata|runtimeClassName: kata-${KATA_HYPERVISOR}|" ${kubernetes_dir}/runtimeclass_workloads/*.yaml
|
||||
sed -i -e "s|runtimeClassName: kata|runtimeClassName: kata-${KATA_HYPERVISOR}|" ${kubernetes_dir}/runtimeclass_workloads_work/*.yaml
|
||||
}
|
||||
|
||||
set_kernel_path() {
|
||||
if [[ "${KATA_HOST_OS}" = "cbl-mariner" ]]; then
|
||||
mariner_kernel_path="/usr/share/cloud-hypervisor/vmlinux.bin"
|
||||
find ${kubernetes_dir}/runtimeclass_workloads/*.yaml -exec yq write -i {} 'metadata.annotations[io.katacontainers.config.hypervisor.kernel]' "${mariner_kernel_path}" \;
|
||||
find ${kubernetes_dir}/runtimeclass_workloads_work/*.yaml -exec yq write -i {} 'metadata.annotations[io.katacontainers.config.hypervisor.kernel]' "${mariner_kernel_path}" \;
|
||||
fi
|
||||
}
|
||||
|
||||
set_initrd_path() {
|
||||
if [[ "${KATA_HOST_OS}" = "cbl-mariner" ]]; then
|
||||
initrd_path="/opt/kata/share/kata-containers/kata-containers-initrd-mariner.img"
|
||||
find ${kubernetes_dir}/runtimeclass_workloads/*.yaml -exec yq write -i {} 'metadata.annotations[io.katacontainers.config.hypervisor.initrd]' "${initrd_path}" \;
|
||||
find ${kubernetes_dir}/runtimeclass_workloads_work/*.yaml -exec yq write -i {} 'metadata.annotations[io.katacontainers.config.hypervisor.initrd]' "${initrd_path}" \;
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
reset_workloads_work_dir
|
||||
set_runtime_class
|
||||
set_kernel_path
|
||||
set_initrd_path
|
||||
|
@ -34,6 +34,6 @@ dragonball_limitations="https://github.com/kata-containers/kata-containers/issue
|
||||
export KUBECONFIG="${KUBECONFIG:-$HOME/.kube/config}"
|
||||
|
||||
get_pod_config_dir() {
|
||||
pod_config_dir="${BATS_TEST_DIRNAME}/runtimeclass_workloads"
|
||||
pod_config_dir="${BATS_TEST_DIRNAME}/runtimeclass_workloads_work"
|
||||
info "k8s configured to use runtimeclass"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user