From e20bbbc3775db9b61fcfb4150909b2a8ce7b9b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Sun, 28 Jun 2020 15:10:11 +0200 Subject: [PATCH 1/9] helm: use maildev 1.1.0 docker image version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tibor Šimko --- helm/reana/templates/reana-mail.yaml | 2 +- reana/cli.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/helm/reana/templates/reana-mail.yaml b/helm/reana/templates/reana-mail.yaml index 53c3b2c8..f1e94c70 100644 --- a/helm/reana/templates/reana-mail.yaml +++ b/helm/reana/templates/reana-mail.yaml @@ -38,7 +38,7 @@ spec: spec: containers: - name: maildev - image: maildev/maildev + image: maildev/maildev:1.1.0 imagePullPolicy: IfNotPresent ports: - containerPort: 80 diff --git a/reana/cli.py b/reana/cli.py index b9a2c67e..26f09826 100644 --- a/reana/cli.py +++ b/reana/cli.py @@ -152,7 +152,12 @@ ] DOCKER_PREFETCH_IMAGES = { - "reana": ["postgres:9.6.2", "kozea/wdb:3.2.5", "maildev/maildev", "redis:5.0.5"], + "reana": [ + "postgres:9.6.2", + "kozea/wdb:3.2.5", + "maildev/maildev:1.1.0", + "redis:5.0.5", + ], "reana-demo-helloworld": ["python:2.7-slim",], "reana-demo-worldpopulation": ["reanahub/reana-env-jupyter",], "reana-demo-root6-roofit": ["reanahub/reana-env-root6:6.18.04",], From a543415e92e1ba9e44b831fc1ab018232e44a942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Sun, 28 Jun 2020 15:22:31 +0200 Subject: [PATCH 2/9] cli: used versioned demo example docker images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tibor Šimko --- reana/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reana/cli.py b/reana/cli.py index 26f09826..d7f59558 100644 --- a/reana/cli.py +++ b/reana/cli.py @@ -159,11 +159,11 @@ "redis:5.0.5", ], "reana-demo-helloworld": ["python:2.7-slim",], - "reana-demo-worldpopulation": ["reanahub/reana-env-jupyter",], + "reana-demo-worldpopulation": ["reanahub/reana-env-jupyter:1.0.0",], "reana-demo-root6-roofit": ["reanahub/reana-env-root6:6.18.04",], "reana-demo-atlas-recast": [ - "reanahub/reana-demo-atlas-recast-eventselection", - "reanahub/reana-demo-atlas-recast-statanalysis", + "reanahub/reana-demo-atlas-recast-eventselection:1.0", + "reanahub/reana-demo-atlas-recast-statanalysis:1.0", ], } From 77eae4c8f693ab9e09a0146a4ba3e5207ad8c04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Mon, 29 Jun 2020 10:57:00 +0200 Subject: [PATCH 3/9] installation: addition of PyYAML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PyYAML is required after recent introduction of yaml-related handling in `reana-dev`. Signed-off-by: Tibor Šimko --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e7533ad9..f1c24416 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # This file is part of REANA. -# Copyright (C) 2017, 2018, 2019 CERN. +# Copyright (C) 2017, 2018, 2019, 2020 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -42,6 +42,7 @@ install_requires = [ "click>=7", "colorama>=0.3.9", + "PyYAML>=5.1", ] From ca3da24035281772ae03293e759352a37b02d6d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Mon, 29 Jun 2020 11:03:09 +0200 Subject: [PATCH 4/9] cli: parametrisable `cluster-build` command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds option to pass additional parameters to `cluster-build` command with respect to excluding components or passing build arguments. After building cluster's images, loads them immediately to Kind cluster. Signed-off-by: Tibor Šimko --- reana/cli.py | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/reana/cli.py b/reana/cli.py index d7f59558..4a3fe70c 100644 --- a/reana/cli.py +++ b/reana/cli.py @@ -1662,6 +1662,13 @@ def client_uninstall(): # noqa: D301 run_command("pip check") +@click.option( + "--build-arg", + "-b", + default="", + multiple=True, + help="Any build arguments? (e.g. `-b COMPUTE_BACKENDS=kubernetes,htcondorcern,slurmcern`)", +) @click.option( "-d", "--debug", @@ -1669,16 +1676,45 @@ def client_uninstall(): # noqa: D301 default=False, help="Should we build REANA in debug mode? ", ) +@click.option( + "--exclude-components", + default="", + help="Which components to exclude from build? [c1,c2,c3]", +) +@click.option("--no-cache", is_flag=True, help="Do not use Docker image layer cache.") @cli.command(name="cluster-build") -def cluster_build(debug): # noqa: D301 - """Build REANA cluster.""" +def cluster_build(build_arg, debug, exclude_components, no_cache): # noqa: D301 + """Build REANA cluster. + + \b + Example: + $ reana-dev cluster-build --exclude-components=r-ui,r-a-vomsproxy + -b COMPUTE_BACKENDS=kubernetes,htcondorcern,slurmcern + --debug + --no-cache + """ + # initalise common submodules cmds = ["reana-dev git-submodule --update"] if debug: + # do we mount Python code live? cmds.append("reana-dev python-install-eggs") - cmds.append( - "reana-dev docker-build --exclude-components r-ui,r-a-vomsproxy" - + (" -b DEBUG=1" if debug else "") - ) + # build Docker images + cmd = "reana-dev docker-build" + if exclude_components: + cmd += " --exclude-components {}".format(exclude_components) + for arg in build_arg: + cmd += " -b {0}".format(arg) + if debug: + cmd += " -b DEBUG=1" + if no_cache: + cmd += " --no-cache" + cmds.append(cmd) + # load built Docker images into cluster + cmd = "reana-dev kind-load-docker-image -c CLUSTER" + if exclude_components: + cmd += " --exclude-components {}".format(exclude_components) + cmds.append(cmd) + # execute commands for cmd in cmds: run_command(cmd, "reana") From fbee402fb6b57ec549e223ff551f323d15129b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Mon, 29 Jun 2020 11:06:33 +0200 Subject: [PATCH 5/9] cli: parametrisable `run-example` command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allows to run any example in the `run-example` command. Moves prefetching and loading of example environment images from the cluster creation step to later stages. Allows to speed up local testing using (i) one small fast REANA example in the CI cycle vs (ii) using all examples for a full-scale CI testing. Signed-off-by: Tibor Šimko --- reana/cli.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/reana/cli.py b/reana/cli.py index 4a3fe70c..db00138f 100644 --- a/reana/cli.py +++ b/reana/cli.py @@ -1879,8 +1879,8 @@ def client_setup_environment(server_hostname, insecure_url): # noqa: D301 "--component", "-c", multiple=True, - default=["reana-demo-root6-roofit"], - help="Which examples to run? [reana-demo-root6-roofit]", + default=["DEMO"], + help="Which examples to run? [default=DEMO]", ) @click.option( "--workflow_engine", @@ -1922,6 +1922,10 @@ def run_example( ): # noqa: D301 """Run given REANA example with given workflow engine. + \b + Example: + $ reana-dev run-example -c r-d-r-roofit + \b :param component: The option ``component`` can be repeated. The value is the repository name of the example. The special value `DEMO` @@ -2033,7 +2037,7 @@ def run_example( default=False, help="Should we mount the REANA source code for live code updates?", ) -@click.option("--worker-nodes", default=0, help="How many worker nodes? default 0") +@click.option("--worker-nodes", default=0, help="How many worker nodes? [default=0]") @cli.command(name="cluster-create") def cluster_create(mounts, debug, worker_nodes): """Create cluster.""" @@ -2088,8 +2092,8 @@ def add_volume_mounts(node): cluster_create = cluster_create.format(cluster_config=yaml.dump(cluster_config)) for cmd in [ cluster_create, - "reana-dev docker-pull -c reana -c DEMO", - "reana-dev kind-load-docker-image -c reana -c DEMO", + "reana-dev docker-pull -c reana", + "reana-dev kind-load-docker-image -c reana", ]: run_command(cmd, "reana") From 71ff0992ff56f6a29831e7605716c67a41a0cf33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Mon, 29 Jun 2020 11:11:42 +0200 Subject: [PATCH 6/9] cli: parametrisable `run-ci` command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parametrises `run-ci` to allow various CI builds via one single CLI command. Signed-off-by: Tibor Šimko --- reana/cli.py | 170 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 138 insertions(+), 32 deletions(-) diff --git a/reana/cli.py b/reana/cli.py index db00138f..8c826b3d 100644 --- a/reana/cli.py +++ b/reana/cli.py @@ -185,8 +185,8 @@ def cli(): # noqa: D301 $ mkdir -p ~/project/reana/src $ cd ~/project/reana/src $ # create new virtual environment - $ virtualenv ~/.virtualenvs/myreana - $ source ~/.virtualenvs/myreana/bin/activate + $ virtualenv ~/.virtualenvs/reana + $ source ~/.virtualenvs/reana/bin/activate $ # install reana-dev developer helper script $ pip install git+git://github.com/reanahub/reana.git#egg=reana $ # run ssh-agent locally to simplify GitHub interaction @@ -202,27 +202,31 @@ def cli(): # noqa: D301 $ eval "$(reana-dev git-fork -c ALL)" $ reana-dev git-clone -c ALL -u tiborsimko - How to install latest ``master`` REANA client CLI scripts: + How to run CI tests: .. code-block:: console \b - $ reana-dev client-install + $ # example (a): fast, CLI mode only, fast example + $ reana-dev cluster-delete + $ reana-dev run-ci -m /var/reana:/var/reana -c r-d-helloworld --exclude-components=r-ui,r-a-vomsproxy + $ # example (b): slow, CLI and Web modes, all examples + $ reana-dev cluster-delete + $ reana-dev run-ci - How to compile and deploy latest ``master`` REANA cluster: + How to create REANA cluster: .. code-block:: console \b - $ # create cluster and set docker environment + $ # example (a): simple cluster creation $ reana-dev cluster-create - $ kubectl cluster-info --context kind-kind - $ # option (a): cluster in production-like mode - $ reana-dev docker-build - $ helm install reana helm/reana - $ # option (b): cluster in developer-like debug-friendly mode - $ reana-dev docker-build -b DEBUG=1 - $ helm install reana helm/reana --set debug.enabled=true + $ # example (b): mount sharing /var/reana with host + $ reana-dev cluster-create -m /var/reana:/var/reana + $ # example (c): mount sharing /var/reana with host and /cvmfs for jobs + $ reana-dev cluster-create -m /var/reana:/var/reana -j /cvmfs:/cvmfs + $ # example (d): debug mode with code sharing as well + $ reana-dev cluster-create -m /var/reana:/var/reana --debug How to set up your shell environment variables: @@ -255,6 +259,7 @@ def cli(): # noqa: D301 $ cd reana-workflow-controller $ reana-dev git-checkout -b . 72 --fetch $ reana-dev docker-build -c . + $ reana-dev kind-load-docker-image -c . $ reana-dev kubectl-delete-pod -c . How to test multiple component branches: @@ -266,7 +271,9 @@ def cli(): # noqa: D301 $ reana-dev git-checkout -b reana-workflow-controller 98 $ reana-dev git-status $ reana-dev docker-build + $ reana-dev kind-load-docker-image -c reana-server $ reana-dev kubectl-delete-pod -c reana-server + $ reana-dev kind-load-docker-image -c reana-workflow-controller $ reana-dev kubectl-delete-pod -c reana-workflow-controller How to test multiple component branches with commits to shared modules: @@ -278,17 +285,7 @@ def cli(): # noqa: D301 $ reana-dev git-checkout -b reana-db 73 $ reana-dev git-checkout -b reana-workflow-controller 98 $ reana-dev git-checkout -b reana-server 112 - $ reana-dev git-submodule --update - $ reana-dev client-install - $ reana-dev install-cluster - $ reana-dev docker-build - $ helm delete helm/reana - $ docker-exec -i -t kind-control-plane sh -c 'sudo rm -rf /var/reana/*' - $ helm install reana helm/reana - $ eval $(reana-dev client-setup-environment) - $ reana-dev run-example -c r-d-helloworld - $ reana-dev git-submodule --delete - $ reana-dev git-status -s + $ reana-dev run-ci [using same old options] How to release and push cluster component images: @@ -757,6 +754,15 @@ def volume_mounts_to_list(ctx, param, value): sys.exit(1) +def is_cluster_created(): + """Return True/False based on whether there is a cluster created already.""" + cmd = "kind get clusters" + output = run_command(cmd, "reana", return_output=True) + if "kind" in output: + return True + return False + + @cli.command() def version(): """Show version.""" @@ -1807,6 +1813,13 @@ def cluster_undeploy(): # noqa: D301 display_message(msg, "reana") +@click.option( + "--build-arg", + "-b", + default="", + multiple=True, + help="Any build arguments? (e.g. `-b COMPUTE_BACKENDS=kubernetes,htcondorcern,slurmcern`)", +) @click.option( "-d", "--debug", @@ -1814,21 +1827,107 @@ def cluster_undeploy(): # noqa: D301 default=False, help="Should we deploy REANA in debug mode? ", ) +@click.option( + "--exclude-components", + default="", + help="Which components to exclude from build? [c1,c2,c3]", +) +@click.option( + "-m", + "--mount", + "mounts", + multiple=True, + help="Which local directories to mount in the cluster nodes? [local_path:cluster_node_path]", +) +@click.option( + "-j", + "--job-mounts", + multiple=True, + help="Which directories from the Kubernetes nodes to mount inside the job pods? " + "cluster_node_path:job_pod_mountpath, e.g /var/reana/mydata:/mydata", +) +@click.option("--no-cache", is_flag=True, help="Do not use Docker image layer cache.") +@click.option( + "--component", + "-c", + multiple=True, + default=["DEMO"], + help="Which examples to run? [default=DEMO]", +) @cli.command(name="run-ci") -def run_ci(debug): # noqa: D301 +def run_ci( + build_arg, debug, exclude_components, mounts, job_mounts, no_cache, component, +): # noqa: D301 """Run CI build. Builds and installs REANA and runs a demo example. + + \b + Basically it runs the following sequence of commands: + $ reana-dev client-install + $ reana-dev cluster-undeploy + $ reana-dev cluster-build + $ reana-dev cluster-deploy + $ eval "$(reana-dev client-setup-environment)" && reana-dev run-example + + in the appropriate order and with the appropriate mounting or debugging + arguments. + + \b + Example: + $ reana-dev run-cli -m /var/reana:/var/reana + -m /usr/share/local/mydata:/mydata + -j /mydata:/mydata + -c r-d-helloworld + --exclude-components=r-ui,r-a-vomsproxy + --debug """ + # parse arguments + components = select_components(component) + # create cluster if needed + if not is_cluster_created(): + cmd = "reana-dev cluster-create" + for mount in mounts: + cmd += " -m {}".format(mount) + if debug: + cmd += " --debug" + run_command(cmd, "reana") + # prefetch and load images for selected demo examples + for component in components: + for cmd in [ + "reana-dev docker-pull -c {}".format(component), + "reana-dev kind-load-docker-image -c {}".format(component), + ]: + run_command(cmd, "reana") + # undeploy cluster and install latest client for cmd in [ "reana-dev cluster-undeploy", "reana-dev client-install", - "reana-dev cluster-build" + (" --debug" if debug else ""), - "reana-dev kind-load-docker-image -c CLUSTER --exclude-components=r-ui,r-a-vomsproxy", - "reana-dev cluster-deploy" + (" --debug" if debug else ""), - "eval $(reana-dev client-setup-environment) && reana-dev run-example", ]: run_command(cmd, "reana") + # build cluster + cmd = "reana-dev cluster-build" + if exclude_components: + cmd += " --exclude-components {}".format(exclude_components) + for arg in build_arg: + cmd += " -b {0}".format(arg) + if debug: + cmd += " --debug" + if no_cache: + cmd += " --no-cache" + run_command(cmd, "reana") + # deploy cluster + cmd = "reana-dev cluster-deploy" + if debug: + cmd += " --debug" + for job_mount in job_mounts: + cmd += " -j {}".format(job_mount) + run_command(cmd, "reana") + # run demo examples + cmd = "eval $(reana-dev client-setup-environment) && reana-dev run-example" + for component in components: + cmd += " -c {}".format(component) + run_command(cmd, "reana") @cli.command(name="client-setup-environment") @@ -2029,7 +2128,7 @@ def run_example( "mounts", multiple=True, callback=volume_mounts_to_list, - help="Which local directories would be mounted in the Kind nodes? local_path:cluster_node_path", + help="Which local directories to mount in the cluster nodes? [local_path:cluster_node_path]", ) @click.option( "--debug", @@ -2039,8 +2138,15 @@ def run_example( ) @click.option("--worker-nodes", default=0, help="How many worker nodes? [default=0]") @cli.command(name="cluster-create") -def cluster_create(mounts, debug, worker_nodes): - """Create cluster.""" +def cluster_create(mounts, debug, worker_nodes): # noqa: D301 + """Create cluster. + + \b + Example: + $ reana-dev cluster-create -m /var/reana:/var/reana + -m /usr/share/local/mydata:/mydata + --debug + """ class literal_str(str): pass From c4d6464c2549a25d9aaa64d5366c4104e45566c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Mon, 29 Jun 2020 15:46:24 +0200 Subject: [PATCH 7/9] cli: output message cosmetics in `client-install` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tibor Šimko --- reana/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reana/cli.py b/reana/cli.py index 8c826b3d..9e86ea08 100644 --- a/reana/cli.py +++ b/reana/cli.py @@ -1657,7 +1657,7 @@ def client_install(): # noqa: D301 "pip install . --upgrade", ]: run_command(cmd, component) - run_command("pip check") + run_command("pip check", "reana") @cli.command(name="client-uninstall") @@ -1665,7 +1665,7 @@ def client_uninstall(): # noqa: D301 """Uninstall REANA client and its dependencies.""" cmd = "pip uninstall -y " + " ".join(REPO_LIST_CLIENT) run_command(cmd, "reana") - run_command("pip check") + run_command("pip check", "reana") @click.option( From bf04dcf67d43baa81c1557c571debc5eb7fb9d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Thu, 2 Jul 2020 16:02:37 +0200 Subject: [PATCH 8/9] cli: check shared storage for multi-node clusters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tibor Šimko --- reana/cli.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/reana/cli.py b/reana/cli.py index 9e86ea08..88e6f438 100644 --- a/reana/cli.py +++ b/reana/cli.py @@ -2147,6 +2147,7 @@ def cluster_create(mounts, debug, worker_nodes): # noqa: D301 -m /usr/share/local/mydata:/mydata --debug """ + import sys class literal_str(str): pass @@ -2155,7 +2156,7 @@ def literal_unicode_str(dumper, data): return dumper.represent_scalar("tag:yaml.org,2002:str", data, style="|") def add_volume_mounts(node): - """Add needed volumen mounts to the provided node.""" + """Add needed volumes mounts to the provided node.""" yaml.add_representer(literal_str, literal_unicode_str) @@ -2184,6 +2185,20 @@ def add_volume_mounts(node): ] ) + # check whether we mount shared volume for multi-node deployments: + if worker_nodes > 0: + mount_targets = [x["containerPath"].strip("/") for x in mounts] + if "var/reana" in mount_targets or "var" in mount_targets: + pass + else: + click.echo( + "[ERROR] For multi-node deployments, one has to use a shared storage volume for cluster nodes." + ) + click.echo( + "[ERROR] Example: reana-dev cluster-create -m /var/reana:/var/reana --worker-nodes 2." + ) + sys.exit(1) + nodes = [{"role": "worker"} for _ in range(worker_nodes)] + [control_plane] for node in nodes: node["extraMounts"] = mounts From a2b509e895a3f1128e85f009037bf6cbc179cc5d Mon Sep 17 00:00:00 2001 From: Diego Rodriguez Date: Fri, 3 Jul 2020 18:46:05 +0200 Subject: [PATCH 9/9] helm: add option to split load by node affinity --- helm/reana/README.md | 1 + helm/reana/templates/_helpers.tpl | 7 +++++++ helm/reana/templates/reana-cache.yaml | 1 + helm/reana/templates/reana-db.yaml | 1 + helm/reana/templates/reana-mail.yaml | 1 + helm/reana/templates/reana-message-broker.yaml | 1 + helm/reana/templates/reana-server.yaml | 1 + helm/reana/templates/reana-ui.yaml | 1 + helm/reana/templates/reana-wdb.yaml | 1 + helm/reana/templates/reana-workflow-controller.yaml | 1 + helm/reana/templates/serviceaccount.yaml | 2 ++ 11 files changed, 18 insertions(+) diff --git a/helm/reana/README.md b/helm/reana/README.md index 89640795..adef48b6 100644 --- a/helm/reana/README.md +++ b/helm/reana/README.md @@ -50,6 +50,7 @@ This Helm automatically prefixes all names using the release name to avoid colli | `notifications.system_status` | Cronjob pattern representing how often the system status notification should be sent. Leave it empty to deactivate it | "0 0 * * *" | | `reana_url` | REANA URL host | None | | `default_runtime_namespace` | Namespace in which the REANA runtime pods (workflow engines, jobs etc...) will run | None | +| `dedicated_nodes` | Should the infrastructure and runtime pods be splitted by node? (all nodes in the cluster should be labeled either as `reana-system=infrastructure` or `reana-system=runtime`) | False | | `secrets.cern.sso.CERN_CONSUMER_KEY` | CERN SSO consumer key | None | | `secrets.cern.sso.CERN_CONSUMER_SECRET` | **[Do not use in production, use secrets instead]** CERN SSO consumer secret | None | | `secrets.database.pasword` | **[Do not use in production, use secrets instead]** PostgreSQL database password | None | diff --git a/helm/reana/templates/_helpers.tpl b/helm/reana/templates/_helpers.tpl index 136483cd..eab07472 100644 --- a/helm/reana/templates/_helpers.tpl +++ b/helm/reana/templates/_helpers.tpl @@ -27,3 +27,10 @@ naming spec: `my-reana-batch-yadage-3c640169-d3b7-41ad-9c09-392c903fc1d8` {{- define "reana.prefixed_runtime_svaccount_name" -}} {{- include "reana.prefix" . -}}-runtime {{- end -}} + +{{- define "reana_sytem_infrastructure_annotations" -}} +{{- if .Values.dedicated_nodes }} + annotations: + scheduler.alpha.kubernetes.io/node-selector: reana-system=infrastructure +{{- end }} +{{- end -}} \ No newline at end of file diff --git a/helm/reana/templates/reana-cache.yaml b/helm/reana/templates/reana-cache.yaml index 059d69eb..330851d7 100644 --- a/helm/reana/templates/reana-cache.yaml +++ b/helm/reana/templates/reana-cache.yaml @@ -18,6 +18,7 @@ kind: Deployment metadata: name: {{ include "reana.prefix" . }}-cache namespace: {{ .Release.Namespace }} + {{- include "reana_sytem_infrastructure_annotations" . }} spec: replicas: 1 selector: diff --git a/helm/reana/templates/reana-db.yaml b/helm/reana/templates/reana-db.yaml index 4b7fb97b..65544615 100644 --- a/helm/reana/templates/reana-db.yaml +++ b/helm/reana/templates/reana-db.yaml @@ -19,6 +19,7 @@ kind: Deployment metadata: name: {{ include "reana.prefix" . }}-db namespace: {{ .Release.Namespace }} + {{- include "reana_sytem_infrastructure_annotations" . }} spec: replicas: 1 selector: diff --git a/helm/reana/templates/reana-mail.yaml b/helm/reana/templates/reana-mail.yaml index f1e94c70..a9c80b9c 100644 --- a/helm/reana/templates/reana-mail.yaml +++ b/helm/reana/templates/reana-mail.yaml @@ -26,6 +26,7 @@ kind: Deployment metadata: name: {{ include "reana.prefix" . }}-mail namespace: {{ .Release.Namespace }} + {{- include "reana_sytem_infrastructure_annotations" . }} spec: replicas: 1 selector: diff --git a/helm/reana/templates/reana-message-broker.yaml b/helm/reana/templates/reana-message-broker.yaml index 82c23e70..0ddaed83 100644 --- a/helm/reana/templates/reana-message-broker.yaml +++ b/helm/reana/templates/reana-message-broker.yaml @@ -22,6 +22,7 @@ kind: Deployment metadata: name: {{ include "reana.prefix" . }}-message-broker namespace: {{ .Release.Namespace }} + {{- include "reana_sytem_infrastructure_annotations" . }} spec: replicas: 1 selector: diff --git a/helm/reana/templates/reana-server.yaml b/helm/reana/templates/reana-server.yaml index 22dfe7f0..b43df5a3 100644 --- a/helm/reana/templates/reana-server.yaml +++ b/helm/reana/templates/reana-server.yaml @@ -19,6 +19,7 @@ kind: Deployment metadata: name: {{ include "reana.prefix" . }}-server namespace: {{ .Release.Namespace }} + {{- include "reana_sytem_infrastructure_annotations" . }} spec: replicas: 1 selector: diff --git a/helm/reana/templates/reana-ui.yaml b/helm/reana/templates/reana-ui.yaml index 16c357de..d3205a82 100644 --- a/helm/reana/templates/reana-ui.yaml +++ b/helm/reana/templates/reana-ui.yaml @@ -20,6 +20,7 @@ kind: Deployment metadata: name: {{ include "reana.prefix" . }}-ui namespace: {{ .Release.Namespace }} + {{- include "reana_sytem_infrastructure_annotations" . }} spec: replicas: 1 selector: diff --git a/helm/reana/templates/reana-wdb.yaml b/helm/reana/templates/reana-wdb.yaml index 3b3712a2..88aa4ed7 100644 --- a/helm/reana/templates/reana-wdb.yaml +++ b/helm/reana/templates/reana-wdb.yaml @@ -25,6 +25,7 @@ kind: Deployment metadata: name: {{ include "reana.prefix" . }}-wdb namespace: {{ .Release.Namespace }} + {{- include "reana_sytem_infrastructure_annotations" . }} spec: replicas: 1 selector: diff --git a/helm/reana/templates/reana-workflow-controller.yaml b/helm/reana/templates/reana-workflow-controller.yaml index f784490d..aaa1c096 100644 --- a/helm/reana/templates/reana-workflow-controller.yaml +++ b/helm/reana/templates/reana-workflow-controller.yaml @@ -19,6 +19,7 @@ kind: Deployment metadata: name: {{ include "reana.prefix" . }}-workflow-controller namespace: {{ .Release.Namespace }} + {{- include "reana_sytem_infrastructure_annotations" . }} spec: replicas: 1 selector: diff --git a/helm/reana/templates/serviceaccount.yaml b/helm/reana/templates/serviceaccount.yaml index 037b29e2..82b1b327 100644 --- a/helm/reana/templates/serviceaccount.yaml +++ b/helm/reana/templates/serviceaccount.yaml @@ -10,8 +10,10 @@ apiVersion: v1 kind: Namespace metadata: name: {{ .Values.default_runtime_namespace }} +{{- if .Values.dedicated_nodes }} annotations: scheduler.alpha.kubernetes.io/node-selector: reana-system=runtime +{{- end }} --- apiVersion: v1 kind: ServiceAccount