%define COMPONENT infra-charts
%define RPM_NAME caas-%{COMPONENT}
%define RPM_MAJOR_VERSION 1.0.0
-%define RPM_MINOR_VERSION 13
+%define RPM_MINOR_VERSION 14
Name: %{RPM_NAME}
Version: %{RPM_MAJOR_VERSION}
Vendor: %{_platform_vendor}
Source0: %{name}-%{version}.tar.gz
-Requires: rsync
+Requires: rsync, jq
%description
This rpm contains the necessary helm charts to deploy the caas subsystem.
%install
mkdir -p %{buildroot}/%{_playbooks_path}/
rsync -av ansible/playbooks/install_caas_infra.yaml %{buildroot}/%{_playbooks_path}/
+rsync -av ansible/playbooks/infra_chart_reconfig_fluentd.yaml %{buildroot}/%{_playbooks_path}/
mkdir -p %{buildroot}/%{_roles_path}/
rsync -av ansible/roles/install_caas_infra %{buildroot}/%{_roles_path}/
rsync -av ansible/roles/pre_install_caas_infra %{buildroot}/%{_roles_path}/
+rsync -av ansible/roles/infra_chart_reconfig %{buildroot}/%{_roles_path}/
mkdir -p %{buildroot}/%{_caas_chart_path}/
rsync -av infra-charts/* %{buildroot}/%{_caas_chart_path}/
--- /dev/null
+---
+# Copyright 2019 Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# nokia.cmframework.requires: install_caas_infra.yaml
+- hosts: caas_master
+ run_once: true
+ strategy: free
+ become: true
+ become_user: "{{ users.admin_user_name }}"
+ vars:
+ - infra_chart_name: "caas-infra"
+ - infra_chart_components: [fluentd]
+ pre_tasks:
+ - name: check infra chart status
+ shell: "helm status {{ infra_chart_name }} -o json | jq .info.status.code"
+ register: helm_infra_chart_status
+ ignore_errors: yes
+ roles:
+ - role: infra_chart_reconfig
+ when:
+ - helm_infra_chart_status.stdout == "1"
--- /dev/null
+---
+# Copyright 2019 Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+infra_chart_filenames: "{{ infra_chart_components | map('regex_replace', '^(.*)$', caas.caas_chart_path+'/values_\\1.yaml') | list }}"
--- /dev/null
+---
+# Copyright 2019 Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+- name: collect image names from the deployed {{ infra_chart_name }} chart
+ shell: "helm get manifest {{ infra_chart_name }} | grep ' image: {{ caas.registry_url }}' | sed 's/^\ *image:\ //' | sort -u"
+ register: helm_get_manifest_images
+- set_fact:
+ container_image_names: "{{ helm_get_manifest_images.stdout_lines }}"
+
+- name: template component specific values file
+ template:
+ src: "{{ item }}.j2"
+ dest: "{{ item }}"
+ with_items: "{{ infra_chart_filenames }}"
+
+- name: helm upgrade
+ shell: "HELM_HOST={{ caas.tiller_ip }}:{{ caas.tiller_port }} helm upgrade {{ infra_chart_name }} default/{{ infra_chart_name }} -f {{ infra_chart_filenames | join(',') }} --wait --timeout {{ caas.helm_operation_timeout }}"