[18.0.0 proposed] - Do not try to get logs from non existent pods #77
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 callingoc describe
.Jira: OSPRH-8197