diff --git a/deploy.py b/deploy.py index c0aab20f42..332c2efce0 100755 --- a/deploy.py +++ b/deploy.py @@ -33,6 +33,11 @@ HELM_RELEASE_NAME = "preview" HELM_CHART_DIR = ROOT_DIR / "kubernetes" / "loculus" +# By default, uses K3s v1.31: https://hub.docker.com/r/rancher/k3s/tags?name=v1.31 +# K3s v1.31 is the latest version which installs Traefik v2 (Traefik v3 is not yet supported by Loculus) +# Also see: https://docs.k3s.io/upgrades#version-specific-caveats +DEFAULT_K3S_IMAGE = "rancher/k3s:v1.31.14-k3s1" + WEBSITE_PORT_MAPPING = "-p 127.0.0.1:3000:30081@agent:0" BACKEND_PORT_MAPPING = "-p 127.0.0.1:8079:30082@agent:0" LAPIS_PORT_MAPPING = "-p 127.0.0.1:8080:80@loadbalancer" @@ -68,6 +73,11 @@ ) cluster_parser.add_argument("--delete", action="store_true", help="Delete the cluster") cluster_parser.add_argument("--bind-all", action="store_true", help="Bind to all interfaces") +cluster_parser.add_argument( + "--k3s-image", + default=DEFAULT_K3S_IMAGE, + help="Specify the k3s image to use for the cluster (default: %(default)s)", +) helm_parser = subparsers.add_parser("helm", help="Install the Helm chart to the k3d cluster") helm_parser.add_argument( @@ -180,10 +190,13 @@ def handle_cluster(): if cluster_exists(CLUSTER_NAME): print(f"Cluster '{CLUSTER_NAME}' already exists.") else: - run_command( - f"k3d cluster create {CLUSTER_NAME} {' '.join(port_bindings)} --agents 1", - shell=True, - ) + command = f"k3d cluster create {CLUSTER_NAME} {' '.join(port_bindings)} --agents 1" + + if args.k3s_image: + command += f" --image {args.k3s_image}" + + run_command([command], shell=True) + install_secret_generator() while not is_traefik_running(): print("Waiting for Traefik to start...") @@ -413,8 +426,8 @@ def generate_configs(from_live, live_host, enable_ena, values_files=None): [ "python", "kubernetes/config-processor/config-processor.py", - temp_dir_path, - output_dir, + str(temp_dir_path), + str(output_dir), ] ) print(f"Config generation succeeded, processed config files available in {output_dir}")