From 0d6137fd3eb409cccda47c0dc953d9c59dfa70e0 Mon Sep 17 00:00:00 2001 From: emosbaugh <371319+emosbaugh@users.noreply.github.com> Date: Thu, 5 Sep 2024 04:03:54 +0000 Subject: [PATCH] Create new Sonobuoy version --- addons/sonobuoy/0.57.2/Manifest | 4 ++ addons/sonobuoy/0.57.2/install.sh | 73 +++++++++++++++++++++++++++++++ web/src/installers/versions.js | 1 + 3 files changed, 78 insertions(+) create mode 100644 addons/sonobuoy/0.57.2/Manifest create mode 100644 addons/sonobuoy/0.57.2/install.sh diff --git a/addons/sonobuoy/0.57.2/Manifest b/addons/sonobuoy/0.57.2/Manifest new file mode 100644 index 0000000000..be042ae382 --- /dev/null +++ b/addons/sonobuoy/0.57.2/Manifest @@ -0,0 +1,4 @@ +asset sonobuoy.tar.gz https://github.com/vmware-tanzu/sonobuoy/releases/download/v0.57.2/sonobuoy_0.57.2_linux_amd64.tar.gz + +image systemd-logs sonobuoy/systemd-logs:v0.4 +image sonobuoy sonobuoy/sonobuoy:v0.57.2 diff --git a/addons/sonobuoy/0.57.2/install.sh b/addons/sonobuoy/0.57.2/install.sh new file mode 100644 index 0000000000..d6dfeabf5a --- /dev/null +++ b/addons/sonobuoy/0.57.2/install.sh @@ -0,0 +1,73 @@ + +function sonobuoy() { + sonobuoy_binary + + sonobuoy_airgap_maybe_tag_image "k8s.gcr.io/conformance:v${KUBERNETES_VERSION}" "registry.k8s.io/conformance:v${KUBERNETES_VERSION}" + sonobuoy_airgap_maybe_tag_image "registry.k8s.io/conformance:v${KUBERNETES_VERSION}" "k8s.gcr.io/conformance:v${KUBERNETES_VERSION}" +} + +function sonobuoy_already_applied() { + sonobuoy_airgap_maybe_tag_image "k8s.gcr.io/conformance:v${KUBERNETES_VERSION}" "registry.k8s.io/conformance:v${KUBERNETES_VERSION}" + sonobuoy_airgap_maybe_tag_image "registry.k8s.io/conformance:v${KUBERNETES_VERSION}" "k8s.gcr.io/conformance:v${KUBERNETES_VERSION}" +} + +function sonobuoy_join() { + sonobuoy_binary + + sonobuoy_airgap_maybe_tag_image "k8s.gcr.io/conformance:v${KUBERNETES_VERSION}" "registry.k8s.io/conformance:v${KUBERNETES_VERSION}" + sonobuoy_airgap_maybe_tag_image "registry.k8s.io/conformance:v${KUBERNETES_VERSION}" "k8s.gcr.io/conformance:v${KUBERNETES_VERSION}" +} + +function sonobuoy_binary() { + local src="${DIR}/addons/sonobuoy/${SONOBUOY_VERSION}" + + if ! kubernetes_is_master; then + return 0 + fi + + if [ "${AIRGAP}" != "1" ]; then + mkdir -p "${src}/assets" + curl -L -o "${src}/assets/sonobuoy.tar.gz" "https://github.com/vmware-tanzu/sonobuoy/releases/download/v${SONOBUOY_VERSION}/sonobuoy_${SONOBUOY_VERSION}_linux_amd64.tar.gz" + fi + + tar xzf "${src}/assets/sonobuoy.tar.gz" -C /usr/local/bin +} + +function sonobuoy_airgap_maybe_tag_image() { + if [ "$AIRGAP" != "1" ]; then + return + fi + if [ -n "$DOCKER_VERSION" ]; then + sonobuoy_docker_maybe_tag_image "$@" + else + sonobuoy_ctr_maybe_tag_image "$@" + fi +} + +function sonobuoy_docker_maybe_tag_image() { + local src="$1" + local dst="$2" + if ! docker image inspect "$src" >/dev/null 2>&1 ; then + # source image does not exist, will not tag + return + fi + if docker image inspect "$dst" >/dev/null 2>&1 ; then + # destination image exists, will not tag + return + fi + docker image tag "$src" "$dst" +} + +function sonobuoy_ctr_maybe_tag_image() { + local src="$1" + local dst="$2" + if [ "$(ctr -n=k8s.io images list -q name=="$src" 2>/dev/null | wc -l)" = "0" ] ; then + # source image does not exist, will not tag + return + fi + if [ "$(ctr -n=k8s.io images list -q name=="$dst" 2>/dev/null | wc -l)" = "1" ] ; then + # destination image exists, will not tag + return + fi + ctr -n=k8s.io images tag "$src" "$dst" +} diff --git a/web/src/installers/versions.js b/web/src/installers/versions.js index 355c65896f..a899c3d06c 100644 --- a/web/src/installers/versions.js +++ b/web/src/installers/versions.js @@ -653,6 +653,7 @@ module.exports.InstallerVersions = { ], sonobuoy: [ // cron-sonobuoy-update + "0.57.2", "0.57.1", "0.57.0", "0.56.17",