Skip to content

Commit

Permalink
feat(reana_dev): customize kind image version (reanahub#811)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlemesh committed Jul 31, 2024
1 parent 9112171 commit 7b323eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions reana/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@
TIMEOUT = 900
"""Maximum timeout to wait for results when running demo analyses in CI."""

KIND_IMAGE_VERSION = "v1.30.2"
"""Kind Docker image version. Should be compatible with kubeVersion in HELM_VERSION_FILE."""

DOCKER_VERSION_FILE = "Dockerfile"
"""Docker version file."""

Expand Down
12 changes: 10 additions & 2 deletions reana/reana_dev/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
validate_mode_option,
)

from reana.config import (
KIND_IMAGE_VERSION,
)


def volume_mounts_to_list(ctx, param, value):
"""Convert tuple params to dictionary. e.g `(foo:bar)` to `{'foo': 'bar'}`.
Expand Down Expand Up @@ -71,8 +75,12 @@ def cluster_commands():
is_flag=True,
help="Disable default CNI and use e.g. Calico.",
)
@click.option(
"--kind-version",
default=KIND_IMAGE_VERSION,
help=f"Which kindest/node image version to use? [default={KIND_IMAGE_VERSION}]")
@cluster_commands.command(name="cluster-create")
def cluster_create(mounts, mode, worker_nodes, disable_default_cni): # noqa: D301
def cluster_create(mounts, mode, worker_nodes, disable_default_cni, kind_version): # noqa: D301
"""Create new REANA cluster.
\b
Expand Down Expand Up @@ -164,7 +172,7 @@ def add_volume_mounts(node):
kind_provider = "KIND_EXPERIMENTAL_PROVIDER=podman"

# create cluster
cluster_create = "cat <<EOF | {kind_provider} kind create cluster --config=-\n{cluster_config}\nEOF"
cluster_create = "cat <<EOF | {kind_provider} kind create cluster --image kindest/node:{kind_version} --config=-\n{cluster_config}\nEOF"
cluster_create = cluster_create.format(
kind_provider=kind_provider, cluster_config=yaml.dump(cluster_config)
)
Expand Down

0 comments on commit 7b323eb

Please sign in to comment.