fix: show detailed Loki template and resource diagnostics
Some checks failed
Deploy Cluster / Terraform (push) Successful in 45s
Deploy Cluster / Ansible (push) Has been cancelled

This commit is contained in:
2026-03-02 14:41:40 +00:00
parent 1c4dfd7fae
commit b595c1738a

View File

@@ -66,19 +66,25 @@
--values /tmp/loki-values.yaml
register: loki_template
changed_when: false
failed_when: false
- name: Show Loki template output (check for StatefulSet)
- name: Show Loki template summary
debug:
msg: "Loki template contains StatefulSet: {{ 'kind: StatefulSet' in loki_template.stdout }}"
when: "'kind: StatefulSet' not in loki_template.stdout"
- name: Fail if Loki template produces no StatefulSet
fail:
msg: |
Loki Helm template produces no StatefulSet. Check values configuration.
Template output (first 100 lines):
{{ loki_template.stdout.split('\n')[:100] | join('\n') }}
when: "'kind: StatefulSet' not in loki_template.stdout"
Template rc: {{ loki_template.rc }}
Contains StatefulSet: {{ 'kind: StatefulSet' in loki_template.stdout }}
Contains Deployment: {{ 'kind: Deployment' in loki_template.stdout }}
Template stderr: {{ loki_template.stderr }}
- name: Show Loki template output sample
debug:
msg: "{{ loki_template.stdout.split('\n')[:50] }}"
when: loki_template.rc == 0
- name: Fail if Loki template fails
fail:
msg: "Loki helm template failed: {{ loki_template.stderr }}"
when: loki_template.rc != 0
- name: Remove legacy Loki scalable workloads (if present)
command: >-
@@ -145,10 +151,20 @@
changed_when: false
failed_when: false
- name: Show ALL observability resources
command: kubectl -n {{ observability_namespace }} get all,configmaps,secrets,pvc
register: all_observability_resources
changed_when: false
failed_when: false
- name: Debug all observability resources
debug:
msg: "{{ all_observability_resources.stdout }}"
when: all_observability_resources.stdout | length > 0
- name: Debug Loki resources
debug:
msg: "{{ loki_resources.stdout }}"
when: loki_resources.stdout | length > 0
msg: "Loki resources: {{ loki_resources.stdout if loki_resources.stdout | length > 0 else 'No Loki resources found' }}"
- name: Wait for Loki statefulset rollout
command: kubectl -n {{ observability_namespace }} rollout status statefulset/loki --timeout=10m