summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomáš Levora <t.levora@partner.samsung.com>2019-07-09 06:35:37 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-09 06:35:37 +0000
commit55edf66b72501fb5700abf490d927dc3808b5aeb (patch)
treeba05114be476d83131a47b6624be57d889941b78
parent37796bfe9db3f947429b325f86450bfc9512ed9a (diff)
parenta9fff274a6cb8cc99e0cbb035c89e1d848bf45aa (diff)
Merge "Modify the way override works"
-rw-r--r--ansible/roles/application/defaults/main.yml14
-rw-r--r--ansible/roles/application/molecule/default/tests/test_default.py3
-rw-r--r--ansible/roles/application/tasks/install.yml12
3 files changed, 22 insertions, 7 deletions
diff --git a/ansible/roles/application/defaults/main.yml b/ansible/roles/application/defaults/main.yml
index 2ae668ac..6a7472a6 100644
--- a/ansible/roles/application/defaults/main.yml
+++ b/ansible/roles/application/defaults/main.yml
@@ -5,11 +5,15 @@ helm_extra_install_options:
- { opt: '--timeout 1800'}
# Override file generation for Helm application can be customized by any role
# given by user and found by ansible from roles_path.
-# By default override file is generated by 'application-override' role that is
-# specific for offline installer (for onap) as it's generating server
-# certificate needed to simulate internet by offline installer.
+# By default override file is generated by 'application-override' role that
+# allows specifying custom helm overrides as the value of "override"
+# dictionary in inventory or extravars.
app_skip_helm_override: false
app_helm_override_role: application-override
app_helm_override_file: "{{ app_data_path }}/override.yaml"
-helm_overide_files:
- - "{{ app_helm_override_file }}"
+# List of additional helm override files, the one generated above overrides
+# every file listed here. In addition, the order of override files in this list
+# matters, settings in latter files override the former..
+# Paths provided here must be absolute.
+helm_override_files:
+ - "{{ app_helm_charts_infra_directory }}/onap/resources/overrides/onap-all.yaml"
diff --git a/ansible/roles/application/molecule/default/tests/test_default.py b/ansible/roles/application/molecule/default/tests/test_default.py
index 5edceff3..22298e3a 100644
--- a/ansible/roles/application/molecule/default/tests/test_default.py
+++ b/ansible/roles/application/molecule/default/tests/test_default.py
@@ -16,7 +16,8 @@ serve
repo list
repo add local http://127.0.0.1:8879
install --name moleculetestapp local/moleculetestapp --namespace \
-moleculetestapp -f /opt/moleculetestapp/override.yaml \
+moleculetestapp -f /opt/moleculetestapp/helm_charts/onap/resources/\
+overrides/onap-all.yaml -f /opt/moleculetestapp/override.yaml \
--timeout 1800"""
assert fc == expected_content
diff --git a/ansible/roles/application/tasks/install.yml b/ansible/roles/application/tasks/install.yml
index 003631d7..2ac2fd6b 100644
--- a/ansible/roles/application/tasks/install.yml
+++ b/ansible/roles/application/tasks/install.yml
@@ -59,6 +59,16 @@
name: "{{ app_helm_override_role }}"
when: not app_skip_helm_override
+# The generated override file is added to override list unless skipped.
+- name: Add application helm override file to list of overrides unless skipped
+ set_fact:
+ helm_override_files: "{{ (helm_override_files | default([])) + [app_helm_override_file] }}"
+ when: not app_skip_helm_override
+
+- name: Print final list of override files
+ debug:
+ var: helm_override_files
+
- name: Check for deploy plugin presence
stat:
path: '{{ helm_home_dir.stdout }}/plugins/deploy/deploy.sh'
@@ -71,7 +81,7 @@
{{ app_helm_release_name }}
{{ helm_repository_name }}/{{ app_helm_chart_name }}
--namespace {{ app_kubernetes_namespace }}
- {% if not app_skip_helm_override %} {% for arg in helm_overide_files %} {{ '-f ' + arg }} {% endfor %} {% endif %}
+ {% for arg in helm_override_files %} {{ '-f ' + arg }} {% endfor %}
{% for arg in helm_extra_install_options %} {{ arg.opt }} {% endfor %}
changed_when: true # when executed its a changed type of action
register: helm_install