summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xansible/group_vars/infrastructure.yml1
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
-rw-r--r--ansible/test/roles/prepare-helm/tasks/main.yml11
8 files changed, 76 insertions, 1 deletions
diff --git a/ansible/group_vars/infrastructure.yml b/ansible/group_vars/infrastructure.yml
index a1643a11..12d1044d 100755
--- a/ansible/group_vars/infrastructure.yml
+++ b/ansible/group_vars/infrastructure.yml
@@ -20,6 +20,7 @@ all_simulated_hosts:
populate_nexus: false
helm_bin_dir: /usr/local/bin
helm_version: v2.16.6
+helm3_push_version: 0.9.0
rancher_server_image: rancher/server:v1.6.22
vnc_server_image: consol/ubuntu-icewm-vnc:1.4.0
nexus3_image: sonatype/nexus3:3.15.2
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" )
diff --git a/ansible/test/roles/prepare-helm/tasks/main.yml b/ansible/test/roles/prepare-helm/tasks/main.yml
index 1f461258..c1d25de0 100644
--- a/ansible/test/roles/prepare-helm/tasks/main.yml
+++ b/ansible/test/roles/prepare-helm/tasks/main.yml
@@ -9,4 +9,13 @@
get_url:
url: "https://get.helm.sh/helm-{{ helm_version }}-linux-amd64.tar.gz"
dest: "{{ app_data_path }}/downloads"
- remote_src: true
+
+- name: Download Helm v3 helm-push plugin
+ command: "curl --connect-timeout 10 -L https://github.com/chartmuseum/helm-push/releases/download/v{{ helm3_push_version }}/helm-push_{{ helm3_push_version }}_linux_amd64.tar.gz -o {{ app_data_path }}/downloads/helm-push_{{ helm3_push_version }}_linux_amd64.tar.gz"
+ register: result
+ retries: 10
+ delay: 1
+ until: not result.failed
+ args:
+ warn: false
+ when: helm_version | regex_search("^v3" )