[release-6.5]fix(kubernetes_log source): fix VRL crashing on null (not exist) namespace_name when pod metadata annotation fails#3331
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vparfonov The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/retest-required |
3 similar comments
|
/retest-required |
|
/retest-required |
|
/retest-required |
|
/hold |
|
/lgtm |
|
@vparfonov lets find a time to discuss this. We should NEVER not have this base meta which is available from the file path. This failure is because it was purged. Maybe we just need fallback logic to extract it from the file or maybe this is a prime candidate for a vector enhancement. |
|
New changes are detected. LGTM label has been removed. |
…a annotation fails When Vector's kubernetes_logs source fails to annotate an event with pod metadata (e.g. pod already deleted), the kubernetes.namespace_name field is null, causing string!() to abort the remap transform. Add fallback VRL logic that extracts kubernetes metadata (namespace, pod name, pod UID, container name) from the log file path, which is always available even when the Kubernetes API lookup fails. The file path format /var/log/pods/<ns>_<pod>_<uid>/<container>/<n>.log is parsed via regex. Also use fallible string() with null coalescing in the match_any call as defense-in-depth in case the file path parsing also fails. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Vitalii Parfonov <vparfono@redhat.com>
|
@vparfonov: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
When Vector's kubernetes_logs source fails to annotate an event with pod metadata (e.g. pod already deleted), the kubernetes.namespace_name field is null, causing string!() to abort the remap transform.
Add fallback VRL logic that extracts kubernetes metadata (namespace, pod name, pod UID, container name) from the log file path, which is always available even when the Kubernetes API lookup fails. The file path format
/var/log/pods/<ns>_<pod>_<uid>/<container>/<n>.logis parsed via regex.Also use fallible
string()with null coalescing in thematch_anycall as defense-in-depth in case the file path parsing also fails./cc @Clee2691
/assign @jcantrill
Links