mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-02 10:08:13 -03:30
Add cluster dump artifact in CI jobs (#5796)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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] }}"
|
||||
|
||||
18
tests/testcases/roles/cluster-dump/tasks/main.yml
Normal file
18
tests/testcases/roles/cluster-dump/tasks/main.yml
Normal 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']
|
||||
Reference in New Issue
Block a user