Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
Merge 745413a into e3155fa
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego committed Oct 7, 2019
2 parents e3155fa + 745413a commit b8a20f7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
24 changes: 16 additions & 8 deletions reana_cluster/backends/kubernetes/k8s.py
Expand Up @@ -51,6 +51,7 @@ def __init__(self,
kubeconfig_context=None,
cephfs=False,
cephfs_volume_size=None,
cephfs_storageclass=None,
cvmfs=False,
debug=False,
url=None,
Expand All @@ -76,6 +77,7 @@ def __init__(self,
storage backend.
:param cephfs_volume_size: Int number which represents cephfs volume
size (GB)
:param cephfs_storageclass: Name of an existing cephfs storageclass.
:param cvmfs: Boolean flag toggling the mounting of cvmfs volumes in
the cluster pods.
:param debug: Boolean flag setting debug mode.
Expand Down Expand Up @@ -110,12 +112,14 @@ def __init__(self,

self.cluster_spec = cluster_spec
self.cluster_conf = cluster_conf or \
self.generate_configuration(cluster_spec,
cephfs=cephfs,
cephfs_volume_size=cephfs_volume_size,
debug=debug,
url=url,
ui=ui)
self.generate_configuration(
cluster_spec,
cephfs=cephfs,
cephfs_volume_size=cephfs_volume_size,
cephfs_storageclass=cephfs_storageclass,
debug=debug,
url=url,
ui=ui)

@property
def cluster_type(self):
Expand Down Expand Up @@ -148,15 +152,17 @@ def current_kubeconfig(self):

@classmethod
def generate_configuration(cls, cluster_spec, cvmfs=False, cephfs=False,
cephfs_volume_size=None, debug=False, url=None,
ui=None):
cephfs_volume_size=None,
cephfs_storageclass=None,
debug=False, url=None, ui=None):
"""Generate Kubernetes manifest files used to init REANA cluster.
:param cluster_spec: Dictionary representing complete REANA
cluster spec file.
:param cephfs: Boolean which represents whether REANA is
deployed with CEPH or not.
:param cephfs_volume_size: Int to set CEPH volume size in GB.
:param cephfs_storageclass: Name of an existing cephfs storageclass.
:param cvmfs: Boolean which represents whether REANA is
deployed with CVMFS or not.
:param debug: Boolean which represents whether REANA is
Expand Down Expand Up @@ -255,6 +261,8 @@ def generate_configuration(cls, cluster_spec, cvmfs=False, cephfs=False,
'reana_url',
url),
CEPHFS_VOLUME_SIZE=cephfs_volume_size or 1,
CEPHFS_STORAGECLASS=cephfs_storageclass or
'geneva-cephfs-testing',
SERVER_IMAGE=rs_img,
WORKFLOW_CONTROLLER_IMAGE=rwfc_img,
MESSAGE_BROKER_IMAGE=rmb_img,
Expand Down
Expand Up @@ -9,6 +9,6 @@ spec:
resources:
requests:
storage: {{CEPHFS_VOLUME_SIZE}}G
storageClassName: manila-csicephfs-share
storageClassName: {{CEPHFS_STORAGECLASS}}
mountOptions:
- nonempty
14 changes: 10 additions & 4 deletions reana_cluster/cli/__init__.py
Expand Up @@ -58,6 +58,9 @@ def __init__(self):
'--cephfs-volume-size',
type=int,
help='Set cephfs volume size in GB.')
@click.option(
'--cephfs-storageclass',
help='A preset cephfs storageclass.')
@click.option(
'--debug', is_flag=True,
help='If set, deploy REANA in debug mode.')
Expand All @@ -70,7 +73,7 @@ def __init__(self):
help='Deploy the REANA-UI inside the REANA Cluster.')
@click.pass_context
def cli(ctx, loglevel, skip_validation, file,
cephfs, cephfs_volume_size, debug, url, ui):
cephfs, cephfs_volume_size, cephfs_storageclass, debug, url, ui):
"""Command line application for managing a REANA cluster."""
logging.basicConfig(
format=DEBUG_LOG_FORMAT if loglevel == 'debug' else LOG_FORMAT,
Expand All @@ -80,10 +83,12 @@ def cli(ctx, loglevel, skip_validation, file,
try:
cluster_spec = load_spec_file(click.format_filename(file),
skip_validation)
if cephfs_volume_size and not cephfs:
if (cephfs_volume_size or cephfs_storageclass) and not cephfs:
cephfs_volume_size = None
click.echo(click.style('CEPHFS volume size will not be set because'
' missing `--cephfs` flag', fg='yellow'))
cephfs_storageclass = None
click.echo(click.style('CEPHFS configuration not taken into '
' account because of missing `--cephfs`'
' flag', fg='yellow'))
ctx.obj = Config()

cluster_type = cluster_spec['cluster']['type']
Expand All @@ -95,6 +100,7 @@ def cli(ctx, loglevel, skip_validation, file,
cluster_spec,
cephfs=cephfs,
cephfs_volume_size=cephfs_volume_size,
cephfs_storageclass=cephfs_storageclass,
debug=debug,
url=url,
ui=ui)
Expand Down
2 changes: 1 addition & 1 deletion reana_cluster/version.py
Expand Up @@ -14,4 +14,4 @@

from __future__ import absolute_import, print_function

__version__ = "0.6.0.dev20190730"
__version__ = "0.6.0.dev20190912"

0 comments on commit b8a20f7

Please sign in to comment.