summaryrefslogtreecommitdiffstats
path: root/ansible/roles/chartmuseum
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2021-02-16 13:12:45 +0000
committerGerrit Code Review <gerrit@onap.org>2021-02-16 13:12:45 +0000
commit9880331a27a67063d802c67b2ecf95c677046406 (patch)
tree22eca98787a905c85e5cc842d2db40f1328d5b7b /ansible/roles/chartmuseum
parent8ec40e9842c856ed4c14d91755cc26b7c81b8f01 (diff)
parentd6908ed39dd5e58c539c1c818f371849dd0271eb (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/chartmuseum')
-rw-r--r--ansible/roles/chartmuseum/.yamllint11
-rw-r--r--ansible/roles/chartmuseum/defaults/main.yml4
-rw-r--r--ansible/roles/chartmuseum/handlers/main.yml14
-rw-r--r--ansible/roles/chartmuseum/molecule/default/molecule.yml33
-rw-r--r--ansible/roles/chartmuseum/molecule/default/playbook.yml5
-rw-r--r--ansible/roles/chartmuseum/molecule/default/prepare.yml8
-rw-r--r--ansible/roles/chartmuseum/molecule/default/tests/test_default.py14
-rw-r--r--ansible/roles/chartmuseum/molecule/ubuntu/molecule.yml37
-rw-r--r--ansible/roles/chartmuseum/tasks/main.yml14
9 files changed, 140 insertions, 0 deletions
diff --git a/ansible/roles/chartmuseum/.yamllint b/ansible/roles/chartmuseum/.yamllint
new file mode 100644
index 00000000..ad0be760
--- /dev/null
+++ b/ansible/roles/chartmuseum/.yamllint
@@ -0,0 +1,11 @@
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
+ truthy: disable
diff --git a/ansible/roles/chartmuseum/defaults/main.yml b/ansible/roles/chartmuseum/defaults/main.yml
new file mode 100644
index 00000000..1d3ae1ba
--- /dev/null
+++ b/ansible/roles/chartmuseum/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+chartmuseum_server_image_tar: "{{ chartmuseum_server_image | regex_replace('(\\/|\\:)', '_') }}.tar"
+chartmuseum_port: "8879"
+chartmuseum_storage_dir: "{{ app_data_path }}/chartmuseum"
diff --git a/ansible/roles/chartmuseum/handlers/main.yml b/ansible/roles/chartmuseum/handlers/main.yml
new file mode 100644
index 00000000..867aaf0f
--- /dev/null
+++ b/ansible/roles/chartmuseum/handlers/main.yml
@@ -0,0 +1,14 @@
+---
+- name: Run chartmuseum server container
+ docker_container:
+ name: chartmuseum
+ image: "{{ chartmuseum_server_image }}"
+ env:
+ STORAGE: "local"
+ STORAGE_LOCAL_ROOTDIR: "/charts"
+ volumes:
+ - "{{ chartmuseum_storage_dir }}:/charts:rw"
+ ports:
+ - "{{ chartmuseum_port }}:8080/tcp"
+ restart_policy: unless-stopped
+ recreate: true
diff --git a/ansible/roles/chartmuseum/molecule/default/molecule.yml b/ansible/roles/chartmuseum/molecule/default/molecule.yml
new file mode 100644
index 00000000..9c5d1c2a
--- /dev/null
+++ b/ansible/roles/chartmuseum/molecule/default/molecule.yml
@@ -0,0 +1,33 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: instance-chartmuseum
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+ pre_build_image: True
+ privileged: true
+ override_command: False
+ volumes:
+ - /var/lib/docker
+ groups:
+ - infrastructure
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ ANSIBLE_LIBRARY: ../../../../library
+ inventory:
+ links:
+ group_vars: ../../../../group_vars
+scenario:
+ name: default
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/ansible/roles/chartmuseum/molecule/default/playbook.yml b/ansible/roles/chartmuseum/molecule/default/playbook.yml
new file mode 100644
index 00000000..2694582a
--- /dev/null
+++ b/ansible/roles/chartmuseum/molecule/default/playbook.yml
@@ -0,0 +1,5 @@
+---
+- name: Converge
+ hosts: all
+ roles:
+ - chartmuseum
diff --git a/ansible/roles/chartmuseum/molecule/default/prepare.yml b/ansible/roles/chartmuseum/molecule/default/prepare.yml
new file mode 100644
index 00000000..dee6a976
--- /dev/null
+++ b/ansible/roles/chartmuseum/molecule/default/prepare.yml
@@ -0,0 +1,8 @@
+---
+- name: Prepare infra
+ hosts: infrastructure
+ vars_files:
+ - ../../../../roles/chartmuseum/defaults/main.yml
+ roles:
+ - prepare-docker-dind
+ - prepare-chartmuseum
diff --git a/ansible/roles/chartmuseum/molecule/default/tests/test_default.py b/ansible/roles/chartmuseum/molecule/default/tests/test_default.py
new file mode 100644
index 00000000..40773065
--- /dev/null
+++ b/ansible/roles/chartmuseum/molecule/default/tests/test_default.py
@@ -0,0 +1,14 @@
+import os
+
+import testinfra.utils.ansible_runner
+
+testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
+ os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
+
+
+def test_chartmuseum_dir(host):
+ assert host.file("/chartmuseum").is_directory
+
+
+def test_container_running(host):
+ assert host.docker('chartmuseum').is_running
diff --git a/ansible/roles/chartmuseum/molecule/ubuntu/molecule.yml b/ansible/roles/chartmuseum/molecule/ubuntu/molecule.yml
new file mode 100644
index 00000000..5f351a93
--- /dev/null
+++ b/ansible/roles/chartmuseum/molecule/ubuntu/molecule.yml
@@ -0,0 +1,37 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: instance-ubuntu-chartmuseum
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-ubuntu}:${PREBUILD_DISTRO_VERSION:-18.04}
+ pre_build_image: True
+ privileged: true
+ override_command: False
+ volumes:
+ - /var/lib/docker
+ groups:
+ - infrastructure
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ ANSIBLE_LIBRARY: ../../../../library
+ inventory:
+ links:
+ group_vars: ../../../../group_vars
+ playbooks:
+ prepare: ../default/prepare.yml
+ converge: ../default/playbook.yml
+scenario:
+ name: ubuntu
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
+ directory: ../default/tests/
diff --git a/ansible/roles/chartmuseum/tasks/main.yml b/ansible/roles/chartmuseum/tasks/main.yml
new file mode 100644
index 00000000..16e41022
--- /dev/null
+++ b/ansible/roles/chartmuseum/tasks/main.yml
@@ -0,0 +1,14 @@
+---
+- name: Create storage directory for chartmuseum
+ file:
+ path: "{{ chartmuseum_storage_dir }}"
+ state: directory
+ mode: 0777
+
+- name: Load chartmuseum server image
+ docker_image:
+ name: "{{ chartmuseum_server_image }}"
+ load_path: "{{ infra_images_path }}/{{ chartmuseum_server_image_tar }}"
+ state: present
+ timeout: 120
+ notify: Run chartmuseum server container