Merge "Add namespace in the collect-k8s-logs role"
This commit is contained in:
commit
5c37f3fd89
@ -1 +1,7 @@
|
|||||||
An ansible role to collect all pod descriptions and kubelet logs.
|
An ansible role to collect all pod descriptions in the current namespace and kubelet logs.
|
||||||
|
|
||||||
|
.. zuul:rolevar:: collect_kubernetes_logs_namespace
|
||||||
|
|
||||||
|
Name of the specified namespace to collect logs.
|
||||||
|
If not specified explicitly, the namespace in the context
|
||||||
|
would be used.
|
@ -1,5 +1,5 @@
|
|||||||
- name: List pods
|
- name: List pods
|
||||||
command: "kubectl get pod -o=custom-columns=NAME:.metadata.name --no-headers"
|
command: "kubectl get pod {% if collect_kubernetes_logs_namespace %}-n {{ collect_kubernetes_logs_namespace }}{% endif %} -o=custom-columns=NAME:.metadata.name --no-headers"
|
||||||
register: podlist
|
register: podlist
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
@ -12,7 +12,7 @@
|
|||||||
loop: "{{ podlist.stdout_lines | default([]) }}"
|
loop: "{{ podlist.stdout_lines | default([]) }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: zj_pod_name
|
loop_var: zj_pod_name
|
||||||
shell: "kubectl describe po {{ zj_pod_name }} &> {{ ansible_user_dir }}/zuul-output/logs/pods/{{ zj_pod_name }}.txt"
|
shell: "kubectl describe po {{ zj_pod_name }} {% if collect_kubernetes_logs_namespace %}-n {{ collect_kubernetes_logs_namespace }}{% endif %} &> {{ ansible_user_dir }}/zuul-output/logs/pods/{{ zj_pod_name }}.txt"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user