mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 03:42:09 +00:00
Revert "ci: Use helm to deploy kata-deploy" (partially)
This partially reverts commit 51690bc157
,
as there's more work needed in order to have this one done in a robust
way, and we are taking the safer path of reverting for now, and adding
it back as soon as the release is cut out.
Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
This commit is contained in:
parent
21f9f01e1d
commit
36f4038a89
@ -529,29 +529,6 @@ function ensure_yq() {
|
||||
hash -d yq 2> /dev/null || true # yq is preinstalled on GHA Ubuntu 22.04 runners so we clear Bash's PATH cache.
|
||||
}
|
||||
|
||||
function ensure_helm() {
|
||||
ensure_yq
|
||||
# The get-helm-3 script will take care of downloaading and installing Helm
|
||||
# properly on the system respecting ARCH, OS and other configurations.
|
||||
DESIRED_VERSION=$(get_from_kata_deps ".externals.helm.version")
|
||||
export DESIRED_VERSION
|
||||
|
||||
# Check if helm is available in the system's PATH
|
||||
if ! command -v helm &> /dev/null; then
|
||||
echo "Helm is not installed. Installing Helm..."
|
||||
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
||||
# Verify the installation
|
||||
if command -v helm &> /dev/null; then
|
||||
echo "Helm installed successfully."
|
||||
else
|
||||
echo "Failed to install Helm."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Helm is already installed."
|
||||
fi
|
||||
}
|
||||
|
||||
# dependency: What we want to get the version from the versions.yaml file
|
||||
function get_from_kata_deps() {
|
||||
versions_file="${repo_root_dir}/versions.yaml"
|
||||
|
@ -17,7 +17,6 @@ source "${kubernetes_dir}/../../gha-run-k8s-common.sh"
|
||||
source "${kubernetes_dir}/confidential_kbs.sh"
|
||||
# shellcheck disable=2154
|
||||
tools_dir="${repo_root_dir}/tools"
|
||||
helm_chart_dir="${tools_dir}/packaging/kata-deploy/helm-chart/kata-deploy"
|
||||
kata_tarball_dir="${2:-kata-artifacts}"
|
||||
|
||||
DOCKER_REGISTRY=${DOCKER_REGISTRY:-quay.io}
|
||||
@ -147,7 +146,6 @@ function deploy_coco_kbs() {
|
||||
|
||||
function deploy_kata() {
|
||||
platform="${1:-}"
|
||||
ensure_helm
|
||||
ensure_yq
|
||||
|
||||
[ "$platform" = "kcli" ] && \
|
||||
@ -159,59 +157,82 @@ function deploy_kata() {
|
||||
|
||||
set_default_cluster_namespace
|
||||
|
||||
local values_yaml
|
||||
values_yaml=$(mktemp /tmp/values_yaml.XXXXXX)
|
||||
sed -i -e "s|quay.io/kata-containers/kata-deploy:latest|${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}|g" "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
|
||||
yq -i ".k8sDistribution = \"${KUBERNETES}\"" "${values_yaml}"
|
||||
yq -i ".image.reference = \"${DOCKER_REGISTRY}/${DOCKER_REPO}\"" "${values_yaml}"
|
||||
yq -i ".image.tag = \"${DOCKER_TAG}\"" "${values_yaml}"
|
||||
yq -i ".env.debug = \"true\"" "${values_yaml}"
|
||||
yq -i ".env.shims = \"${KATA_HYPERVISOR}\"" "${values_yaml}"
|
||||
yq -i ".env.defaultShim = \"${KATA_HYPERVISOR}\"" "${values_yaml}"
|
||||
yq -i ".env.createRuntimeClasses = \"true\"" "${values_yaml}"
|
||||
yq -i ".env.createDefaultRuntimeClass = \"true\"" "${values_yaml}"
|
||||
yq -i ".env.allowedHypervisorAnnotations = \"default_vcpus\"" "${values_yaml}"
|
||||
yq -i ".env.snapshotterHandlerMapping = \"\"" "${values_yaml}"
|
||||
yq -i ".env.agentHttpsProxy = \"\"" "${values_yaml}"
|
||||
yq -i ".env.agentNoProxy = \"\"" "${values_yaml}"
|
||||
yq -i ".env.pullTypeMapping = \"\"" "${values_yaml}"
|
||||
yq -i ".env.hostOS = \"\"" "${values_yaml}"
|
||||
# Enable debug for Kata Containers
|
||||
yq -i \
|
||||
'.spec.template.spec.containers[0].env[1].value = "true"' \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
# Create the runtime class only for the shim that's being tested
|
||||
yq -i \
|
||||
".spec.template.spec.containers[0].env[2].value = \"${KATA_HYPERVISOR}\"" \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
# Set the tested hypervisor as the default `kata` shim
|
||||
yq -i \
|
||||
".spec.template.spec.containers[0].env[3].value = \"${KATA_HYPERVISOR}\"" \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
# Let the `kata-deploy` script take care of the runtime class creation / removal
|
||||
yq -i \
|
||||
'.spec.template.spec.containers[0].env[4].value = "true"' \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
# Let the `kata-deploy` create the default `kata` runtime class
|
||||
yq -i \
|
||||
'.spec.template.spec.containers[0].env[5].value = "true"' \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
# Enable 'default_vcpus' hypervisor annotation
|
||||
yq -i \
|
||||
'.spec.template.spec.containers[0].env[6].value = "default_vcpus"' \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
|
||||
if [ -n "${SNAPSHOTTER}" ]; then
|
||||
yq -i ".env.snapshotterHandlerMapping = \"${KATA_HYPERVISOR}:${SNAPSHOTTER}\"" "${values_yaml}"
|
||||
yq -i \
|
||||
".spec.template.spec.containers[0].env[7].value = \"${KATA_HYPERVISOR}:${SNAPSHOTTER}\"" \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
fi
|
||||
|
||||
if [ "${KATA_HOST_OS}" = "cbl-mariner" ]; then
|
||||
yq -i ".env.allowedHypervisorAnnotations = \"initrd kernel default_vcpus\"" "${values_yaml}"
|
||||
yq -i ".env.hostOS = \"${KATA_HOST_OS}\"" "${values_yaml}"
|
||||
ALLOWED_HYPERVISOR_ANNOTATIONS="initrd kernel default_vcpus"
|
||||
HOST_OS=${KATA_HOST_OS}
|
||||
fi
|
||||
|
||||
if [ "${KATA_HYPERVISOR}" = "qemu" ]; then
|
||||
yq -i ".env.allowedHypervisorAnnotations = \"image initrd kernel default_vcpus\"" "${values_yaml}"
|
||||
yq -i \
|
||||
'.spec.template.spec.containers[0].env[6].value = "image initrd kernel default_vcpus"' \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
fi
|
||||
|
||||
if [ "${KATA_HYPERVISOR}" = "qemu-tdx" ]; then
|
||||
yq -i ".env.agentHttpsProxy = \"${HTTPS_PROXY}\"" "${values_yaml}"
|
||||
yq -i ".env.agentNoProxy = \"${NO_PROXY}\"" "${values_yaml}"
|
||||
yq -i \
|
||||
".spec.template.spec.containers[0].env[8].value = \"${HTTPS_PROXY}\"" \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
|
||||
yq -i \
|
||||
".spec.template.spec.containers[0].env[9].value = \"${NO_PROXY}\"" \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
fi
|
||||
|
||||
# Set the PULL_TYPE_MAPPING
|
||||
if [ "${PULL_TYPE}" != "default" ]; then
|
||||
yq -i ".env.pullTypeMapping = \"${KATA_HYPERVISOR}:${PULL_TYPE}\"" "${values_yaml}"
|
||||
yq -i \
|
||||
".spec.template.spec.containers[0].env[10].value = \"${KATA_HYPERVISOR}:${PULL_TYPE}\"" \
|
||||
"${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
fi
|
||||
|
||||
echo "::group::Final kata-deploy manifests used in the test"
|
||||
cat "${values_yaml}"
|
||||
helm template "${helm_chart_dir}" --values "${values_yaml}" --namespace kube-system
|
||||
[ "$(yq .image.reference ${values_yaml})" = "${DOCKER_REGISTRY}/${DOCKER_REPO}" ] || die "Failed to set image reference"
|
||||
[ "$(yq .image.tag ${values_yaml})" = "${DOCKER_TAG}" ] || die "Failed to set image tag"
|
||||
echo "::group::Final kata-deploy.yaml that is used in the test"
|
||||
cat "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
grep "${DOCKER_REGISTRY}/${DOCKER_REPO}:${DOCKER_TAG}" "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml" || die "Failed to setup the tests image"
|
||||
echo "::endgroup::"
|
||||
|
||||
# will wait until all Pods, PVCs, Services, and minimum number of Pods
|
||||
# of a Deployment, StatefulSet, or ReplicaSet are in a ready state
|
||||
# before marking the release as successful. It will wait for as long
|
||||
# as --timeout -- Ready >> Running
|
||||
helm install --wait --timeout 10m kata-deploy "${helm_chart_dir}" --values "${values_yaml}" --namespace kube-system
|
||||
kubectl_retry apply -f "${tools_dir}/packaging/kata-deploy/kata-rbac/base/kata-rbac.yaml"
|
||||
case "${KUBERNETES}" in
|
||||
k0s) kubectl_retry apply -k "${tools_dir}/packaging/kata-deploy/kata-deploy/overlays/k0s" ;;
|
||||
k3s) kubectl_retry apply -k "${tools_dir}/packaging/kata-deploy/kata-deploy/overlays/k3s" ;;
|
||||
rke2) kubectl_retry apply -k "${tools_dir}/packaging/kata-deploy/kata-deploy/overlays/rke2" ;;
|
||||
*) kubectl_retry apply -f "${tools_dir}/packaging/kata-deploy/kata-deploy/base/kata-deploy.yaml"
|
||||
esac
|
||||
|
||||
local cmd="kubectl -n kube-system get -l name=kata-deploy pod 2>/dev/null | grep '\<Running\>'"
|
||||
waitForProcess "${KATA_DEPLOY_WAIT_TIMEOUT}" 10 "$cmd"
|
||||
|
||||
# This is needed as the kata-deploy pod will be set to "Ready" when it starts running,
|
||||
# which may cause issues like not having the node properly labeled or the artefacts
|
||||
|
@ -218,11 +218,6 @@ externals:
|
||||
version: "1.36.1"
|
||||
url: "https://busybox.net/downloads"
|
||||
|
||||
helm:
|
||||
description: "Kubernetes package manager"
|
||||
url: "https://get.helm.sh/"
|
||||
version: "v3.15.2"
|
||||
|
||||
cni-plugins:
|
||||
description: "CNI network plugins"
|
||||
url: "https://github.com/containernetworking/plugins"
|
||||
|
Loading…
Reference in New Issue
Block a user