Add cluster dump artifact in CI jobs (#5796)

This commit is contained in:
Maxime Guyot
2020-04-01 16:23:29 +02:00
committed by GitHub
parent 033afe1574
commit be9414fabe
10 changed files with 59 additions and 22 deletions

View File

@@ -12,6 +12,9 @@
bin_dir: "/usr/local/bin"
when: not ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk"]
- import_role:
name: cluster-dump
- name: Check kubectl output
shell: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide"
register: get_pods

View File

@@ -12,6 +12,9 @@
bin_dir: "/usr/local/bin"
when: not ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk"]
- import_role:
name: cluster-dump
- name: Check kubectl output
shell: "{{ bin_dir }}/kubectl get nodes"
register: get_nodes

View File

@@ -21,6 +21,9 @@
- name: Run a replica controller composed of 2 pods in test ns
shell: "{{ bin_dir }}/kubectl run test --image={{ test_image_repo }}:{{ test_image_tag }} --namespace test --replicas=2 --command -- tail -f /dev/null"
- import_role:
name: cluster-dump
- name: Check that all pods are running and ready
shell: "{{ bin_dir }}/kubectl get pods --namespace test --no-headers -o yaml"
register: run_pods_log

View File

@@ -24,6 +24,9 @@
bin_dir: "/usr/local/bin"
when: not ansible_os_family in ["CoreOS", "Coreos", "Container Linux by CoreOS", "Flatcar", "Flatcar Container Linux by Kinvolk"]
- import_role:
name: cluster-dump
- name: Wait for netchecker server
shell: "{{ bin_dir }}/kubectl get pods -o wide --namespace {{ netcheck_namespace }} | grep ^netchecker-server"
delegate_to: "{{ groups['kube-master'][0] }}"

View File

@@ -0,0 +1,18 @@
---
- name: Generate dump folder
shell: "{{ bin_dir }}/kubectl cluster-info dump --all-namespaces --output-directory /tmp/cluster-dump"
no_log: true
when: inventory_hostname in groups['kube-master']
- name: Compress directory cluster-dump
archive:
path: /tmp/cluster-dump
dest: /tmp/cluster-dump.tgz
when: inventory_hostname in groups['kube-master']
- name: Fetch dump file
fetch:
src: /tmp/cluster-dump.tgz
dest: "{{ lookup('env', 'CI_PROJECT_DIR') }}/cluster-dump/{{ inventory_hostname }}.tgz"
flat: true
when: inventory_hostname in groups['kube-master']