Add namespace in the collect-k8s-logs role
Specify namespace to collect logs, so no need to change the context Change-Id: If26bb9aa517bbd6462fbb93eb6cca99929e7e6aa
This commit is contained in:
parent
4b390f2d40
commit
81b584d5a1
@ -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
|
||||
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
|
||||
failed_when: false
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
loop: "{{ podlist.stdout_lines | default([]) }}"
|
||||
loop_control:
|
||||
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:
|
||||
executable: /bin/bash
|
||||
failed_when: false
|
||||
|
Loading…
Reference in New Issue
Block a user