diff --git a/roles/artifacts/tasks/main.yml b/roles/artifacts/tasks/main.yml index 682058fcf4..a0b6cd72d7 100644 --- a/roles/artifacts/tasks/main.yml +++ b/roles/artifacts/tasks/main.yml @@ -66,6 +66,13 @@ ansible.builtin.import_role: name: os_must_gather +- name: Run must gather - OpenShift cluster state + when: cifmw_artifacts_gather_logs + ignore_errors: true # noqa: ignore-errors + ansible.builtin.import_role: + name: os_must_gather + tasks_from: os_cluster_info.yml + - name: Collect crc logs when tests failed ignore_errors: true # noqa: ignore-errors when: not cifmw_success_flag.stat.exists diff --git a/roles/os_must_gather/tasks/main.yml b/roles/os_must_gather/tasks/main.yml index d6b7f1a95c..72fce2b808 100644 --- a/roles/os_must_gather/tasks/main.yml +++ b/roles/os_must_gather/tasks/main.yml @@ -101,10 +101,6 @@ dest: "{{ cifmw_os_must_gather_output_log_dir }}/latest" state: link - # Collect pod usage - - name: Collect pod usage - ansible.builtin.include_tasks: get_top.yml - rescue: - name: Openstack-must-gather failure block: diff --git a/roles/os_must_gather/tasks/oomkill.yml b/roles/os_must_gather/tasks/oomkill.yml new file mode 100644 index 0000000000..212bc0b200 --- /dev/null +++ b/roles/os_must_gather/tasks/oomkill.yml @@ -0,0 +1,27 @@ +--- +# Copyright Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +- name: Check if there were some OOMKill + ansible.builtin.shell: > + oc get events + --all-namespaces + --field-selector type=Warning + --sort-by=.lastTimestamp | + grep -i -E 'OOMKill|Killing.*out of memory|Pressure' > + {{ cifmw_os_must_gather_output_log_dir }}/latest/OOMKill-events.log + environment: + KUBECONFIG: "{{ cifmw_openshift_kubeconfig | default(cifmw_os_cluster_info_kubeconfig) }}" + ignore_errors: true # noqa: ignore-errors diff --git a/roles/os_must_gather/tasks/os_cluster_info.yml b/roles/os_must_gather/tasks/os_cluster_info.yml new file mode 100644 index 0000000000..cf5bb64e9d --- /dev/null +++ b/roles/os_must_gather/tasks/os_cluster_info.yml @@ -0,0 +1,6 @@ +--- +- name: Collect pod usage + ansible.builtin.include_tasks: get_top.yml + +- name: Collect info for OOMKill + ansible.builtin.include_tasks: oomkill.yml