diff options
author | Maciej Wereski <m.wereski@partner.samsung.com> | 2021-07-28 13:36:47 +0000 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2021-08-24 13:41:02 +0000 |
commit | 107b0eb0586053e057e6a90722e75ba25a523b28 (patch) | |
tree | 6936c5d248ea25643703d122607fec71a5e0b75b /deployment | |
parent | fe32db5a54133b5070ad2907c424dab2ea35cade (diff) |
noheat: deploy helm with plugins & chartmuseum
Issue-ID: INT-1601
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Change-Id: If42f82101ad22631d636b9cadd8a0cef03e53a11
Diffstat (limited to 'deployment')
5 files changed, 100 insertions, 0 deletions
diff --git a/deployment/noheat/cluster-rke/ansible/create.yml b/deployment/noheat/cluster-rke/ansible/create.yml index 329d6b84d..c2eca98dc 100644 --- a/deployment/noheat/cluster-rke/ansible/create.yml +++ b/deployment/noheat/cluster-rke/ansible/create.yml @@ -37,3 +37,7 @@ repo: "https://git.onap.org/oom" dest: "{{ oom_dir }}" version: "master" +- name: Install Helm + hosts: operator0 + roles: + - role: setup_helm diff --git a/deployment/noheat/cluster-rke/ansible/roles/setup_helm/defaults/main.yml b/deployment/noheat/cluster-rke/ansible/roles/setup_helm/defaults/main.yml new file mode 100644 index 000000000..cbbb3c910 --- /dev/null +++ b/deployment/noheat/cluster-rke/ansible/roles/setup_helm/defaults/main.yml @@ -0,0 +1,6 @@ +--- +helm_version: "3.6.3" +chartmuseum_version: "0.13.1" +chartmuseum_port: "8879" +chartmuseum_dir: "{{ ansible_user_dir }}/helm3-storage" +local_user: "{{ ansible_user_id }}" diff --git a/deployment/noheat/cluster-rke/ansible/roles/setup_helm/handlers/main.yml b/deployment/noheat/cluster-rke/ansible/roles/setup_helm/handlers/main.yml new file mode 100644 index 000000000..0847b8182 --- /dev/null +++ b/deployment/noheat/cluster-rke/ansible/roles/setup_helm/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: Reload systemd + become: yes + systemd: + daemon-reload: yes diff --git a/deployment/noheat/cluster-rke/ansible/roles/setup_helm/tasks/main.yml b/deployment/noheat/cluster-rke/ansible/roles/setup_helm/tasks/main.yml new file mode 100644 index 000000000..c742fff7a --- /dev/null +++ b/deployment/noheat/cluster-rke/ansible/roles/setup_helm/tasks/main.yml @@ -0,0 +1,72 @@ +- name: Download helm + get_url: + url: "https://get.helm.sh/helm-v{{ helm_version }}-linux-amd64.tar.gz" + dest: "/tmp" + mode: '0400' + +- name: Unarchive helm + unarchive: + src: "/tmp/helm-v{{ helm_version }}-linux-amd64.tar.gz" + dest: "/tmp/" + mode: '0500' + +- name: Copy helm binary to $PATH + become: yes + copy: + src: "/tmp/linux-amd64/helm" + dest: "/usr/local/bin/" + mode: '0555' + +- name: Install Helm Push plugin + kubernetes.core.helm_plugin: + plugin_path: "https://github.com/chartmuseum/helm-push.git" + state: present + +- name: Install Helm OOM Deploy plugin + kubernetes.core.helm_plugin: + plugin_path: "{{ oom_dir }}/kubernetes/helm/plugins/deploy" + state: present + +- name: Install Helm OOM Undeploy plugin + kubernetes.core.helm_plugin: + plugin_path: "{{ oom_dir }}/kubernetes/helm/plugins/undeploy" + state: present + +- name: Download chartmuseum install script + get_url: + url: "https://raw.githubusercontent.com/helm/chartmuseum/v{{ chartmuseum_version }}/scripts/get-chartmuseum" + dest: "/tmp/" + mode: '0500' + +- name: Install chartmuseum + become: yes + command: + cmd: "./get-chartmuseum -v v{{ chartmuseum_version }}" + chdir: "/tmp/" + +- name: Create chartmuseum local storage + file: + name: "{{ chartmuseum_dir }}" + state: directory + mode: '0755' + +- name: Install chartmuseum service file + become: yes + template: + src: "chartmuseum.service.j2" + dest: "/etc/systemd/system/chartmuseum.service" + mode: '0444' + notify: Reload systemd + +- name: Start and enable chartmuseum + become: yes + service: + name: "chartmuseum" + state: started + enabled: yes + +- name: Add local Helm repository + kubernetes.core.helm_repository: + name: "local" + repo_url: "http://127.0.0.1:{{ chartmuseum_port }}" + state: present diff --git a/deployment/noheat/cluster-rke/ansible/roles/setup_helm/templates/chartmuseum.service.j2 b/deployment/noheat/cluster-rke/ansible/roles/setup_helm/templates/chartmuseum.service.j2 new file mode 100644 index 000000000..78d7967f9 --- /dev/null +++ b/deployment/noheat/cluster-rke/ansible/roles/setup_helm/templates/chartmuseum.service.j2 @@ -0,0 +1,13 @@ +[Unit] +Description=chartmuseum +Requires=network-online.target +After=network-online.target + +[Service] +ExecStart=/usr/local/bin/chartmuseum --port "{{ chartmuseum_port }}" --storage local --storage-local-rootdir "{{ chartmuseum_dir }}" +ExecStop=/usr/local/bin/chartmuseum step-down +User={{ local_user }} +Restart=always + +[Install] +WantedBy=multi-user.target |