summaryrefslogtreecommitdiffstats
path: root/ansible/roles/helm
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2021-02-01 10:48:54 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2021-02-04 11:51:46 +0100
commitb07d4a22dfd4fe24376de514019ca2a32e358b4b (patch)
tree1c89c875032758a6e27bb5c705b8a8a21ade342f /ansible/roles/helm
parent007a4bdfef2e398d9141cc903927bae03ea4bc7a (diff)
Add test scenario for Helm v3
Change-Id: Iad5478f70533719e1076f3961613fddffb14eebd Issue-ID: OOM-2665 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'ansible/roles/helm')
l---------ansible/roles/helm/molecule/helm3/Dockerfile.j21
-rw-r--r--ansible/roles/helm/molecule/helm3/molecule.yml31
l---------ansible/roles/helm/molecule/helm3/playbook.yml1
l---------ansible/roles/helm/molecule/helm3/prepare.yml1
-rw-r--r--ansible/roles/helm/molecule/helm3/vars.yml2
-rw-r--r--ansible/roles/helm/tasks/main.yml29
6 files changed, 65 insertions, 0 deletions
diff --git a/ansible/roles/helm/molecule/helm3/Dockerfile.j2 b/ansible/roles/helm/molecule/helm3/Dockerfile.j2
new file mode 120000
index 00000000..867ec5c3
--- /dev/null
+++ b/ansible/roles/helm/molecule/helm3/Dockerfile.j2
@@ -0,0 +1 @@
+../default/Dockerfile.j2 \ No newline at end of file
diff --git a/ansible/roles/helm/molecule/helm3/molecule.yml b/ansible/roles/helm/molecule/helm3/molecule.yml
new file mode 100644
index 00000000..e8634477
--- /dev/null
+++ b/ansible/roles/helm/molecule/helm3/molecule.yml
@@ -0,0 +1,31 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: infrastructure-server-helm3
+ image: centos:7
+ groups:
+ - infrastructure
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ ANSIBLE_LIBRARY: ../../../../library
+ inventory:
+ group_vars:
+ all:
+ app_name: onap
+ app_data_path: "/opt/{{ app_name }}"
+scenario:
+ name: helm3
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
+ directory: ../default/tests
diff --git a/ansible/roles/helm/molecule/helm3/playbook.yml b/ansible/roles/helm/molecule/helm3/playbook.yml
new file mode 120000
index 00000000..a3e26797
--- /dev/null
+++ b/ansible/roles/helm/molecule/helm3/playbook.yml
@@ -0,0 +1 @@
+../default/playbook.yml \ No newline at end of file
diff --git a/ansible/roles/helm/molecule/helm3/prepare.yml b/ansible/roles/helm/molecule/helm3/prepare.yml
new file mode 120000
index 00000000..1c017d9a
--- /dev/null
+++ b/ansible/roles/helm/molecule/helm3/prepare.yml
@@ -0,0 +1 @@
+../default/prepare.yml \ No newline at end of file
diff --git a/ansible/roles/helm/molecule/helm3/vars.yml b/ansible/roles/helm/molecule/helm3/vars.yml
new file mode 100644
index 00000000..7ff37715
--- /dev/null
+++ b/ansible/roles/helm/molecule/helm3/vars.yml
@@ -0,0 +1,2 @@
+---
+helm_version: v3.3.4
diff --git a/ansible/roles/helm/tasks/main.yml b/ansible/roles/helm/tasks/main.yml
index c1b47103..64db7850 100644
--- a/ansible/roles/helm/tasks/main.yml
+++ b/ansible/roles/helm/tasks/main.yml
@@ -9,3 +9,32 @@
- '*/helm'
remote_src: true
mode: 0755
+
+- name: Install helm-push plugin if runing with Helm v3
+ block:
+ - name: Get helm environment information
+ command: "{{ helm_bin_dir }}/helm env"
+ register: helm_env
+ changed_when: false # for idempotency
+
+ - name: Set helm plugin dir fact
+ set_fact:
+ helm_plugin_dir:
+ "{% if 'HELM_PLUGINS' in helm_env.stdout -%}
+ {{ (helm_env.stdout | replace('\"', '') | regex_search('HELM_PLUGINS.*')).split('=')[1] }}
+ {%- else -%}
+ {{ '~/.local/share/helm/plugins' }}
+ {%- endif %}"
+
+ - name: Ensure that plugin directory exists
+ file:
+ path: "{{ helm_plugin_dir }}/helm-push"
+ state: directory
+ mode: 0755
+
+ - name: Deploy helm-push plugin
+ unarchive:
+ src: "{{ app_data_path }}/downloads/helm-push_{{ helm3_push_version }}_linux_amd64.tar.gz"
+ dest: "{{ helm_plugin_dir }}/helm-push"
+ remote_src: true
+ when: helm_version | regex_search("^v3" )