openstack-helm-infra/roles/helm-release-status/tasks/main.yaml
Dustin Specker 367bed952f fix helm-release-status role to use helm3 commands
Helm3 requires specifying a namespace to retrieve status and values for
a given release.

Before this role would not retrieve any values or statuses. Now values
and statuses are retrieved in saved in Zuul archive correctly.

Change-Id: If8cf28349b0c14ba6e1de74d49e46ab4a61b93c7
2022-05-10 11:17:53 -05:00

51 lines
2.0 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 status"
file:
path: "{{ logs_dir }}/helm/{{ directory }}"
state: directory
loop_control:
loop_var: directory
with_items:
- values
- releases
- name: "Gather get release status for helm charts"
shell: |-
set -e
for namespace in $(kubectl get namespaces --no-headers --output custom-columns=":metadata.name"); do
# get all Helm releases including pending and failed releases
for release in $(helm list --all --short --namespace $namespace); do
# Make respective directories only when a Helm release actually exists in the namespace
# to prevent uploading a bunch of empty directories for namespaces without a Helm release.
mkdir -p {{ logs_dir }}/helm/releases/$namespace
mkdir -p {{ logs_dir }}/helm/values/$namespace
helm status $release --namespace $namespace >> {{ logs_dir }}/helm/releases/$namespace/$release.txt
helm get values $release --namespace $namespace --all >> {{ logs_dir }}/helm/values/$namespace/$release.yaml
done
done
args:
executable: /bin/bash
ignore_errors: True
- name: "Downloads logs to executor"
synchronize:
src: "{{ logs_dir }}/helm"
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
mode: pull
ignore_errors: True
...