From c82b69ccdf5638dec12fd68079f6b77f75bace17 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Mon, 2 Jul 2018 15:28:51 +0800 Subject: Add cluster_param in DHA file JIRA: COMPASS-603 Users may need some extra parameters to further customize the deployment. Change-Id: I64f7f39a49f17350d159b3733f34ffd816849174 Signed-off-by: Harry Huang --- deploy/client.py | 9 +++++++++ deploy/compass_conf/package_metadata/kubernetes.conf | 8 ++++++++ deploy/compass_conf/package_metadata/openstack.conf | 8 ++++++++ .../ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl | 8 ++++++++ .../openstack_queens/vars/HA-ansible-multinodes.tmpl | 8 ++++++++ deploy/config_parse.py | 7 +++++++ deploy/deploy_host.sh | 5 +++-- 7 files changed, 51 insertions(+), 2 deletions(-) (limited to 'deploy') diff --git a/deploy/client.py b/deploy/client.py index 891e632c..e612160b 100644 --- a/deploy/client.py +++ b/deploy/client.py @@ -259,6 +259,9 @@ opts = [ cfg.StrOpt('plugins', help='plugin dict', default='{}'), + cfg.StrOpt('cluster_param', + help='cluster dict', + default='{}'), cfg.StrOpt('offline_deployment', help='offline_deployment', default='Disable'), @@ -803,11 +806,17 @@ class CompassClient(object): package_config['odl_l3_agent'] = "Enable" if CONF.odl_l3_agent == "Enable" else "Disable" # noqa package_config['onos_sfc'] = "Enable" if CONF.onos_sfc == "Enable" else "Disable" # noqa package_config['plugins'] = [] + package_config['cluster_param'] = [] if CONF.plugins: for item in CONF.plugins.split(','): key, value = item.split(':') package_config['plugins'].append({key: value}) + if CONF.cluster_param: + for item in CONF.cluster_param.split(','): + key, value = item.split(':') + package_config['cluster_param'].append({key: value}) + status, resp = self.client.update_cluster_config( cluster_id, package_config=package_config) LOG.info( diff --git a/deploy/compass_conf/package_metadata/kubernetes.conf b/deploy/compass_conf/package_metadata/kubernetes.conf index d5e9a50f..c9853d17 100755 --- a/deploy/compass_conf/package_metadata/kubernetes.conf +++ b/deploy/compass_conf/package_metadata/kubernetes.conf @@ -129,6 +129,14 @@ METADATA = { 'default_value': '[]' } }, + 'cluster_param': { + '_self': { + 'mapping_to': 'cluster_param', + 'field': 'general_list', + 'is_required':False, + 'default_value': '[]' + } + }, 'ha_network': { '_self': { 'mapping_to': 'ha_network', diff --git a/deploy/compass_conf/package_metadata/openstack.conf b/deploy/compass_conf/package_metadata/openstack.conf index 6027cb1a..1a0545ad 100755 --- a/deploy/compass_conf/package_metadata/openstack.conf +++ b/deploy/compass_conf/package_metadata/openstack.conf @@ -129,6 +129,14 @@ METADATA = { 'default_value': '[]' } }, + 'cluster_param': { + '_self': { + 'mapping_to': 'cluster_param', + 'field': 'general_list', + 'is_required':False, + 'default_value': '[]' + } + }, 'ha_network': { '_self': { 'mapping_to': 'ha_network', diff --git a/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl b/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl index 669eaca0..55ef7ae4 100644 --- a/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl +++ b/deploy/compass_conf/templates/ansible_installer/kubernetes/vars/ansible-kubernetes.tmpl @@ -122,6 +122,14 @@ erlang.cookie: DJJVECFMCJPVYQTJTDWG $keys[0]: $values[0] #end for +cluster_param: +#set cluster_param = $getVar('cluster_param', []) +#for item in cluster_param +#set keys = $item.keys() +#set values = $item.values() + $keys[0]: $values[0] +#end for + #set neutron_service_plugins=['router'] #if $getVar('enable_fwaas', True) diff --git a/deploy/compass_conf/templates/ansible_installer/openstack_queens/vars/HA-ansible-multinodes.tmpl b/deploy/compass_conf/templates/ansible_installer/openstack_queens/vars/HA-ansible-multinodes.tmpl index 8ae9bdba..0c9ec062 100755 --- a/deploy/compass_conf/templates/ansible_installer/openstack_queens/vars/HA-ansible-multinodes.tmpl +++ b/deploy/compass_conf/templates/ansible_installer/openstack_queens/vars/HA-ansible-multinodes.tmpl @@ -166,6 +166,14 @@ erlang.cookie: DJJVECFMCJPVYQTJTDWG $keys[0]: $values[0] #end for +cluster_param: +#set cluster_param = $getVar('cluster_param', []) +#for item in cluster_param +#set keys = $item.keys() +#set values = $item.values() + $keys[0]: $values[0] +#end for + #set neutron_service_plugins=['router'] #if $getVar('enable_fwaas', True) #neutron_service_plugins.append('firewall') diff --git a/deploy/config_parse.py b/deploy/config_parse.py index ceaab0f5..3ee0d864 100644 --- a/deploy/config_parse.py +++ b/deploy/config_parse.py @@ -109,6 +109,13 @@ def export_dha_file(dha, dha_file, ofile): plugin_list.append(plugin_str) env.update({'plugins': ','.join(plugin_list)}) + if 'cluster_param' in env: + plugin_list = [] + for item in env.get('cluster_param'): + plugin_str = ':'.join([item.keys()[0], item.values()[0]]) + plugin_list.append(plugin_str) + env.update({'cluster_param': ','.join(plugin_list)}) + env.update({'CLUSTER_NAME': dha.get('NAME', "opnfv")}) env.update({'TYPE': dha.get('TYPE', "virtual")}) env.update({'FLAVOR': dha.get('FLAVOR', "cluster")}) diff --git a/deploy/deploy_host.sh b/deploy/deploy_host.sh index 512386e5..94abf768 100755 --- a/deploy/deploy_host.sh +++ b/deploy/deploy_host.sh @@ -48,8 +48,9 @@ function deploy_host(){ --cluster_vip="${VIP}" --network_cfg="$NETWORK" --neutron_cfg="$NEUTRON" \ --enable_secgroup="${ENABLE_SECGROUP}" --enable_fwaas="${ENABLE_FWAAS}" --expansion="${EXPANSION}" \ --rsa_file="$rsa_file" --enable_vpnaas="${ENABLE_VPNAAS}" --odl_l3_agent="${odl_l3_agent}" \ - --moon_cfg="${MOON_CFG}" --onos_sfc="${onos_sfc}" --plugins="$plugins" \ - --offline_repo_port="${COMPASS_REPO_PORT}" --offline_deployment="${OFFLINE_DEPLOY}" + --moon_cfg="${MOON_CFG}" --onos_sfc="${onos_sfc}" --plugins="${plugins}" \ + --cluster_param="${cluster_param}" --offline_repo_port="${COMPASS_REPO_PORT}" \ + --offline_deployment="${OFFLINE_DEPLOY}" RET=$? sleep $((AYNC_TIMEOUT+5)) -- cgit 1.2.3-korg