Gate: simplify helm release log gathering

This PS simplifys the helm release log gathering, to collect logs
from all charts released into the cluster, and also adds a `logs`
sub-target to the dev-deploy target in the Makefile.

Change-Id: I016a5e08163eaccf13331db6faa45fab1e9cf4f2
This commit is contained in:
portdirect 2017-12-28 14:47:10 -05:00
parent 2be5abec3d
commit 6c3786aef3
4 changed files with 24 additions and 59 deletions

View File

@ -68,6 +68,8 @@ elif [ "x${DEPLOY}" == "xk8s" ]; then
PLAYBOOKS="osh-infra-build osh-infra-deploy-k8s"
elif [ "x${DEPLOY}" == "xcharts" ]; then
PLAYBOOKS="osh-infra-deploy-charts"
elif [ "x${DEPLOY}" == "xlogs" ]; then
PLAYBOOKS="osh-infra-collect-logs"
elif [ "x${DEPLOY}" == "xfull" ]; then
ansible_install
PLAYBOOKS="osh-infra-docker osh-infra-build osh-infra-deploy-k8s osh-infra-deploy-charts osh-infra-collect-logs"

View File

@ -12,27 +12,33 @@
- name: "creating directory for helm release status"
file:
path: "{{ logs_dir }}/helm-releases"
path: "{{ logs_dir }}/helm"
state: directory
- name: "Gathering release status in chart groups"
- name: "retrieve all deployed charts"
shell: |-
set -e
helm ls --short
args:
executable: /bin/bash
register: helm_releases
- name: "Gather get release status for helm charts"
shell: |-
set -e
helm status {{ helm_released }} >> {{ logs_dir }}/helm/{{ helm_release }}.txt
args:
executable: /bin/bash
ignore_errors: True
vars:
chart_group_name: "{{ helm_chart_group.name }}"
include: util-chart-group-releases.yaml
helm_release: "{{ helm_released }}"
loop_control:
loop_var: helm_chart_group
with_items: "{{ chart_groups }}"
loop_var: helm_released
with_items: "{{ helm_releases.stdout_lines }}"
- name: "Downloads helm release statuses to executor"
- name: "Downloads logs to executor"
synchronize:
src: "{{ logs_dir }}/helm-releases"
src: "{{ logs_dir }}/helm"
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
mode: pull
ignore_errors: yes
- name: "Download helm release test logs to executor"
synchronize:
src: "{{ logs_dir }}/helm-tests"
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
mode: pull
ignore_errors: yes
ignore_errors: True

View File

@ -1,20 +0,0 @@
# 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: "Gathering release status for {{ helm_chart_group.name }} chart group"
vars:
release: "{{ charts[helm_chart].release }}"
namespace: "{{ charts[helm_chart].namespace }}"
loop_control:
loop_var: helm_chart
include: util-common-release-status.yaml
with_items: "{{ helm_chart_group.charts }}"

View File

@ -1,23 +0,0 @@
# 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: Helm release status common block
vars:
release: null
namespace: null
block:
- name: "describing the {{ release }} release"
shell: |-
helm status "{{ release }}" > "{{ logs_dir }}"/helm-releases/"{{ release }}".yaml
args:
executable: /bin/bash
ignore_errors: True