diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2021-02-16 13:12:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-02-16 13:12:45 +0000 |
commit | 9880331a27a67063d802c67b2ecf95c677046406 (patch) | |
tree | 22eca98787a905c85e5cc842d2db40f1328d5b7b /ansible/roles/helm | |
parent | 8ec40e9842c856ed4c14d91755cc26b7c81b8f01 (diff) | |
parent | d6908ed39dd5e58c539c1c818f371849dd0271eb (diff) |
Merge changes from topic "ansible-helm3"
* changes:
Run chartmuseum as a docker container
Update 'helm deploy' failure criteria
Fix kubeconfig file permissions
Ensure k8s namespace for ONAP exists
Customize helm "--timeout" option format if running helm v3
Redirect chartmuseum stdout/stderr to /dev/null
Drop DIND specific test env settings for 'rke' role/playbook
Improve bin utils symlink creation logic
Add test scenario for Helm v3
Refactor Helm role test setup
Add helm-push Helm v3 plugin to downloaded utilities list
Fix Helm v3 data dir setup
Add tasks to setup Helm v3 on infra node
Add Helm v3 test scenario to rke playbook tests
Change 'rke' role testing strategy
Workaround RKE binary download issue
Play 'chartmuseum' role in rke playbook if running with Helm v3
Fix variable inclusion order in RKE playbook tests
Add Helm v3.3.4 to the list of downloaded utilities
Add 'chartmuseum' binary to downloaded utilities list
Add Molecule test scenario to verify 'chartmuseum' role on Ubuntu
Add 'chartmuseum' role
Split Helm v2 setup to separate playbook
Improve 'application' role test coverage
Diffstat (limited to 'ansible/roles/helm')
-rw-r--r-- | ansible/roles/helm/molecule/default/Dockerfile.j2 | 14 | ||||
l--------- | ansible/roles/helm/molecule/default/group_vars/infrastructure.yml | 1 | ||||
-rw-r--r-- | ansible/roles/helm/molecule/default/molecule.yml | 6 | ||||
-rw-r--r-- | ansible/roles/helm/molecule/default/playbook.yml | 5 | ||||
-rw-r--r-- | ansible/roles/helm/molecule/default/prepare.yml | 2 | ||||
-rw-r--r-- | ansible/roles/helm/molecule/default/vars.yml | 1 | ||||
l--------- | ansible/roles/helm/molecule/helm3/Dockerfile.j2 | 1 | ||||
-rw-r--r-- | ansible/roles/helm/molecule/helm3/molecule.yml | 31 | ||||
l--------- | ansible/roles/helm/molecule/helm3/playbook.yml | 1 | ||||
l--------- | ansible/roles/helm/molecule/helm3/prepare.yml | 1 | ||||
-rw-r--r-- | ansible/roles/helm/molecule/helm3/vars.yml | 2 | ||||
l--------- | ansible/roles/helm/molecule/ubuntu/Dockerfile.j2 | 1 | ||||
l--------- | ansible/roles/helm/molecule/ubuntu/group_vars | 1 | ||||
-rw-r--r-- | ansible/roles/helm/molecule/ubuntu/molecule.yml | 6 | ||||
-rw-r--r-- | ansible/roles/helm/tasks/main.yml | 29 |
15 files changed, 90 insertions, 12 deletions
diff --git a/ansible/roles/helm/molecule/default/Dockerfile.j2 b/ansible/roles/helm/molecule/default/Dockerfile.j2 new file mode 100644 index 00000000..e6aa95d3 --- /dev/null +++ b/ansible/roles/helm/molecule/default/Dockerfile.j2 @@ -0,0 +1,14 @@ +# Molecule managed + +{% if item.registry is defined %} +FROM {{ item.registry.url }}/{{ item.image }} +{% else %} +FROM {{ item.image }} +{% endif %} + +RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \ + elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ + elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi diff --git a/ansible/roles/helm/molecule/default/group_vars/infrastructure.yml b/ansible/roles/helm/molecule/default/group_vars/infrastructure.yml deleted file mode 120000 index 3e9c2f0c..00000000 --- a/ansible/roles/helm/molecule/default/group_vars/infrastructure.yml +++ /dev/null @@ -1 +0,0 @@ -../../../../../group_vars/infrastructure.yml
\ No newline at end of file diff --git a/ansible/roles/helm/molecule/default/molecule.yml b/ansible/roles/helm/molecule/default/molecule.yml index 0d46c2d4..359d3aba 100644 --- a/ansible/roles/helm/molecule/default/molecule.yml +++ b/ansible/roles/helm/molecule/default/molecule.yml @@ -7,10 +7,7 @@ lint: name: yamllint platforms: - name: infrastructure-server - image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6} - pre_build_image: True - privileged: true - override_command: False + image: centos:7 groups: - infrastructure provisioner: @@ -25,7 +22,6 @@ provisioner: all: app_name: onap app_data_path: "/opt/{{ app_name }}" - helm_bin_dir: /usr/local/bin scenario: name: default verifier: diff --git a/ansible/roles/helm/molecule/default/playbook.yml b/ansible/roles/helm/molecule/default/playbook.yml index 2705b165..0f3fbc27 100644 --- a/ansible/roles/helm/molecule/default/playbook.yml +++ b/ansible/roles/helm/molecule/default/playbook.yml @@ -1,5 +1,10 @@ --- - name: Converge hosts: all + pre_tasks: + - name: Include infrastructure group variables + include_vars: ../../../../group_vars/infrastructure.yml + - name: Include test scenario variables + include_vars: vars.yml roles: - helm diff --git a/ansible/roles/helm/molecule/default/prepare.yml b/ansible/roles/helm/molecule/default/prepare.yml index 34c41e8e..10ccf232 100644 --- a/ansible/roles/helm/molecule/default/prepare.yml +++ b/ansible/roles/helm/molecule/default/prepare.yml @@ -4,5 +4,7 @@ pre_tasks: - name: Include infrastructure group variables include_vars: ../../../../group_vars/infrastructure.yml + - name: Include test scenario variables + include_vars: vars.yml roles: - prepare-helm diff --git a/ansible/roles/helm/molecule/default/vars.yml b/ansible/roles/helm/molecule/default/vars.yml new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/ansible/roles/helm/molecule/default/vars.yml @@ -0,0 +1 @@ +--- 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/molecule/ubuntu/Dockerfile.j2 b/ansible/roles/helm/molecule/ubuntu/Dockerfile.j2 new file mode 120000 index 00000000..867ec5c3 --- /dev/null +++ b/ansible/roles/helm/molecule/ubuntu/Dockerfile.j2 @@ -0,0 +1 @@ +../default/Dockerfile.j2
\ No newline at end of file diff --git a/ansible/roles/helm/molecule/ubuntu/group_vars b/ansible/roles/helm/molecule/ubuntu/group_vars deleted file mode 120000 index 5ce8257f..00000000 --- a/ansible/roles/helm/molecule/ubuntu/group_vars +++ /dev/null @@ -1 +0,0 @@ -../default/group_vars/
\ No newline at end of file diff --git a/ansible/roles/helm/molecule/ubuntu/molecule.yml b/ansible/roles/helm/molecule/ubuntu/molecule.yml index a375a32d..a43ff074 100644 --- a/ansible/roles/helm/molecule/ubuntu/molecule.yml +++ b/ansible/roles/helm/molecule/ubuntu/molecule.yml @@ -7,10 +7,7 @@ lint: name: yamllint platforms: - name: infrastructure-server - image: molecule-${PREBUILD_PLATFORM_DISTRO:-ubuntu}:${PREBUILD_DISTRO_VERSION:-18.04} - pre_build_image: True - privileged: true - override_command: False + image: ubuntu:18.04 groups: - infrastructure provisioner: @@ -28,7 +25,6 @@ provisioner: all: app_name: onap app_data_path: "/opt/{{ app_name }}" - helm_bin_dir: /usr/local/bin scenario: name: ubuntu verifier: 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" ) |