From d4665f5237cdbe57f76b7e0eddf7a7a74051b573 Mon Sep 17 00:00:00 2001 From: louiseschmidtgen Date: Thu, 13 Jun 2024 10:14:01 +0200 Subject: [PATCH] update component contour --- build-scripts/hack/update-component-versions.py | 14 ++++++++++++++ build-scripts/hack/util.py | 7 +++++++ tests/integration/tests/test_ingress.py | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/build-scripts/hack/update-component-versions.py b/build-scripts/hack/update-component-versions.py index 75b7a5086..1404aaf83 100755 --- a/build-scripts/hack/update-component-versions.py +++ b/build-scripts/hack/update-component-versions.py @@ -23,6 +23,7 @@ DIR = Path(__file__).absolute().parent COMPONENTS = DIR.parent / "components" +CHARTS = DIR.parent.parent / "k8s" / "manifests" / "charts" # Version marker for latest Kubernetes version. Expected to be one of: # @@ -36,6 +37,9 @@ # Helm release branch to track. The most recent tag in the branch will be used. HELM_RELEASE_BRANCH = "release-3.14" +# Contour Helm repository and chart version +CONTOUR_HELM_REPO = "https://charts.bitnami.com/bitnami" +CONTOUR_CHART_VERSION = "17.0.4" def get_kubernetes_version() -> str: """Update Kubernetes version based on the specified marker file""" @@ -59,6 +63,9 @@ def get_cni_version() -> str: raise Exception(f"Failed to find cni dependency in {deps_file}") +def pull_contour_chart() -> None: + LOG.info("Pulling Contour Helm chart from %s with version %s", CONTOUR_HELM_REPO, CONTOUR_CHART_VERSION) + util.helm_pull("contour", CONTOUR_HELM_REPO, CONTOUR_CHART_VERSION, CHARTS) def get_containerd_version() -> str: """Update containerd version using latest tag of specified branch""" @@ -101,6 +108,13 @@ def update_component_versions(dry_run: bool): if not dry_run: Path(path).write_text(version.strip() + "\n") + for component, pull_helm_chart in [ + ("contour", pull_contour_chart), + ]: + LOG.info("Updating chart for %s", component) + if not dry_run: + pull_helm_chart() + def main(): parser = argparse.ArgumentParser( diff --git a/build-scripts/hack/util.py b/build-scripts/hack/util.py index 871d5b47c..ed39abf20 100644 --- a/build-scripts/hack/util.py +++ b/build-scripts/hack/util.py @@ -3,6 +3,7 @@ import tempfile import subprocess import logging +import yaml from urllib.request import urlopen from pathlib import Path @@ -48,3 +49,9 @@ def read_file(path: Path) -> str: def read_url(url: str) -> str: return urlopen(url).read().decode().strip() + +def helm_pull(chart_name: str, repo_url: str, version: str, destination: Path) -> None: + parse_output(["helm", "repo", "add", chart_name, repo_url]) + parse_output(["helm", "pull", f"{chart_name}/{chart_name}", "--version", version, "--destination", destination]) + + LOG.info("Pulled helm repository %s @ %s as %s to %s", repo_url, version, chart_name, destination) \ No newline at end of file diff --git a/tests/integration/tests/test_ingress.py b/tests/integration/tests/test_ingress.py index de0d866e2..54e778341 100644 --- a/tests/integration/tests/test_ingress.py +++ b/tests/integration/tests/test_ingress.py @@ -30,6 +30,12 @@ def test_ingress(session_instance: List[harness.Instance]): capture_output=True, ) + LOG.info("Waiting for ingress class to show up...") + util.stubbornly(retries=15, delay_s=2).on(session_instance).until( + lambda p: "ck-ingress" in p.stdout.decode() + ).exec(["k8s", "kubectl", "get", "ingressclass", "ck-ingress", "-o", "json"]) + LOG.INFO("Ingress class showed up.") + ingress_http_port = None services = json.loads(p.stdout.decode()) for svc in services["items"]: