Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0.0 proposed] - Do not try to get logs from non existent pods #77

Conversation

fmount
Copy link
Contributor

@fmount fmount commented Sep 23, 2024

This patch fixes the current issue related to the fact that we try to get logs from pods that are not present in the namespace. This is caused by the fact that the crash_status variable is sometimes not predictable and an output made by many strings is produced. We only need to know if the Pod was terminated, and get the -previous log, but we don't care about the reason of the crash. In addition, given the complexity generated by go-template, we moved the data processing to json and jq, as it results easy to read and maintain.
However, if a pod is in Pending state and has no 'status.containerStatus' field, the jq command crashes, and we get no logs. This change also skips collecting logs for these pods, while still calling oc describe.

Jira: OSPRH-8197

fmount and others added 2 commits September 23, 2024 15:46
This patch fixes the current issue related to the fact that we try to
get logs from pods that are not present in the namespace. This is caused
by the fact that the crash_status variable is sometimes not predictable
and an output made by many strings is produced. We only need to know if
the Pod was terminated, and get the -previous log.
In addition, given the complexity generated by go-template, we moved the
data processing to json and jq, as it results easy to read and maintain.

Jira: https://issues.redhat.com/browse/OSPRH-8197

Signed-off-by: Francesco Pantano <[email protected]>
(cherry picked from commit dbbc8b9)
If a pod is in Pending state and has no 'status.containerStatus' field,
the jq command crashes, and we get no logs. This change sets the
container name for those pods as null, and then we can skip collecting
logs for that pod, while still calling 'oc describe' on it.

(cherry picked from commit 6ddcf8a)
Copy link
Contributor

@stuggi stuggi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link

openshift-ci bot commented Sep 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit b5d0af4 into openstack-k8s-operators:18.0.0-proposed Sep 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants