From 9bae288ee46cbf70a6edfb934a2456638da601e9 Mon Sep 17 00:00:00 2001 From: morenod Date: Wed, 17 Feb 2021 16:47:39 +0100 Subject: [PATCH] Adding argument to select infra nodes flavor --- rosa/README.md | 1 + rosa/rosa-wrapper.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rosa/README.md b/rosa/README.md index 7d004c8..b1eaaf5 100644 --- a/rosa/README.md +++ b/rosa/README.md @@ -62,6 +62,7 @@ without uploading any information** | --rosa-env | Rosa environment where to install clusters. | -- | | --rosa-multi-az | Install ROSA clusters with multi-az support, deploying on multiple datacenters | False | | --rosa-addons | Comma separated list of addons to be added after cluster installation | -- | +| --rosa-flavour | AWS Flavour to be use on the infra nodes | -- | | --aws-profile | AWS profile to use if there is more than one on AWS cli configuration file | -- | | --cluster-count | Total number of clusters to create. | 1 | | --batch-size | Number of clusters to create in a batch. If not set it will try and create them all at once.
**NOTE**: If not used in conjunction with --delay-between-batch the cluster creation will block at the set batch size until one completes then continue. I.e. if 3 clusters are requested with a batch size of 2. The first two will be requested and then it will block until one of those completes to request the third. | -- | diff --git a/rosa/rosa-wrapper.py b/rosa/rosa-wrapper.py index ac95b6a..3e20e24 100644 --- a/rosa/rosa-wrapper.py +++ b/rosa/rosa-wrapper.py @@ -107,7 +107,7 @@ def _install_addons(rosa_cmnd,cluster_id,addons): logging.error(addon_stderr.strip().decode("utf-8")) # TODO: control addon is installed with: rosa list addons -c <> -def _build_cluster(rosa_cmnd,cluster_name_seed,expiration,rosa_azs,my_path,es,index,my_uuid,my_inc,timestamp,index_retry,addons,es_ignored_metadata): +def _build_cluster(rosa_cmnd,cluster_name_seed,expiration,rosa_azs,my_path,es,index,my_uuid,my_inc,timestamp,index_retry,addons,es_ignored_metadata,rosa_flavour): cluster_start_time = time.strftime("%Y-%m-%dT%H:%M:%S") success = True metadata = {} @@ -121,6 +121,8 @@ def _build_cluster(rosa_cmnd,cluster_name_seed,expiration,rosa_azs,my_path,es,in cluster_cmd = [rosa_cmnd, "create","cluster", "--cluster-name", cluster_name, "-y", "--watch"] if rosa_azs: cluster_cmd.append('--multi-az') + if rosa_flavour: + cluster_cmd.append('--flavour=' + rosa_flavour) logging.debug(cluster_cmd) installation_log = open(cluster_path + "/" + 'installation.log', 'w') process = subprocess.Popen(cluster_cmd, stdout=installation_log, stderr=installation_log) @@ -261,8 +263,11 @@ def main(): parser.add_argument( '--rosa-addons', type=str, - help='Comma separated list of addons to add to each cluster after installation is completed' - ) + help='Comma separated list of addons to add to each cluster after installation is completed') + parser.add_argument( + '--rosa-flavour', + type=str, + help='AWS Flavor to use for infra nodes') parser.add_argument( '--aws-profile', type=str, @@ -423,7 +428,7 @@ def main(): logging.debug('Starting Cluster thread %d' % (loop_counter + 1)) try: timestamp = time.strftime("%Y-%m-%dT%H:%M:%S") - thread = threading.Thread(target=_build_cluster,args=(rosa_cmnd,cluster_name_seed,args.expire,args.rosa_azs,my_path,es,args.es_index,my_uuid,loop_counter,timestamp,args.es_index_retry,args.rosa_addons,_es_ignored_metadata)) + thread = threading.Thread(target=_build_cluster,args=(rosa_cmnd,cluster_name_seed,args.expire,args.rosa_azs,my_path,es,args.es_index,my_uuid,loop_counter,timestamp,args.es_index_retry,args.rosa_addons,_es_ignored_metadata,args.rosa_flavour)) except Exception as err: logging.error(err) cluster_thread_list.append(thread)