openstack-helm-infra/roles/gather-prom-metrics/tasks/main.yaml
Pete Birley 16a6f7af8f Gate: Tolerate failures in log collection tasks
This PS updates the gate tasks to tollerate failures in the post
run log collection tasks.

Change-Id: I8b982112955f4112e8107a7eae35680aa68c87ab
Signed-off-by: Pete Birley <pete@port.direct>
2018-10-05 01:42:56 +00:00

47 lines
1.7 KiB
YAML

# 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: "creating directory for helm release descriptions"
file:
path: "{{ logs_dir }}/prometheus"
state: directory
- name: "Get prometheus metrics from exporters in all namespaces"
shell: |-
set -e
NAMESPACES=$(kubectl get namespaces -o json | jq -r '.items[].metadata.name')
for NS in $NAMESPACES; do
SERVICES=$(kubectl get svc -l component=metrics -n $NS -o json | jq -r '.items[].metadata.name')
for SVC in $SERVICES; do
PORT=$(kubectl get svc $SVC -n $NS -o json | jq -r '.spec.ports[].port')
curl "$SVC.$NS:$PORT/metrics" >> "{{ logs_dir }}"/prometheus/$NS-$SVC.txt
done
done
args:
executable: /bin/bash
ignore_errors: True
- name: "Get prometheus metrics from tiller-deploy"
shell: |-
set -e
curl tiller-deploy.kube-system:44135/metrics >> "{{ logs_dir }}"/prometheus/kube-system-tiller-deploy.txt
args:
executable: /bin/bash
ignore_errors: True
- name: "Downloads logs to executor"
synchronize:
src: "{{ logs_dir }}/prometheus"
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
mode: pull
ignore_errors: True