Skip to content

[release-6.5]fix(kubernetes_log source): fix VRL crashing on null (not exist) namespace_name when pod metadata annotation fails#3331

Open
vparfonov wants to merge 1 commit into
openshift:release-6.5from
vparfonov:log9584
Open

[release-6.5]fix(kubernetes_log source): fix VRL crashing on null (not exist) namespace_name when pod metadata annotation fails#3331
vparfonov wants to merge 1 commit into
openshift:release-6.5from
vparfonov:log9584

Conversation

@vparfonov

@vparfonov vparfonov commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

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>.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.

/cc @Clee2691
/assign @jcantrill

Links

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 30fdf0fd-422a-4090-9dd6-b2a418fd63e4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from cahartma and jcantrill July 3, 2026 10:50
@openshift-ci

openshift-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vparfonov
Once this PR has been reviewed and has the lgtm label, please assign jcantrill for approval. For more information see the Code Review Process.

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

Details 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

@vparfonov

Copy link
Copy Markdown
Contributor Author

/retest-required

3 similar comments
@vparfonov

Copy link
Copy Markdown
Contributor Author

/retest-required

@vparfonov

Copy link
Copy Markdown
Contributor Author

/retest-required

@vparfonov

Copy link
Copy Markdown
Contributor Author

/retest-required

@jcantrill

Copy link
Copy Markdown
Contributor

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 6, 2026
@Clee2691

Clee2691 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 7, 2026
@jcantrill

Copy link
Copy Markdown
Contributor

@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.

@vparfonov
vparfonov marked this pull request as draft July 13, 2026 15:07
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 13, 2026
@vparfonov vparfonov changed the title fix(vector config): fix match_any crash on null (not exist) namespace_name when pod metadata annotation fails fix(vector config): fix VRL crashing on null (not exist) namespace_name when pod metadata annotation fails Jul 14, 2026
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2026
@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@vparfonov
vparfonov marked this pull request as ready for review July 14, 2026 15:31
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 14, 2026
@openshift-ci
openshift-ci Bot requested review from Clee2691 and alanconway July 14, 2026 15:34
@vparfonov vparfonov changed the title fix(vector config): fix VRL crashing on null (not exist) namespace_name when pod metadata annotation fails fix(kubernetes_log source): fix VRL crashing on null (not exist) namespace_name when pod metadata annotation fails Jul 14, 2026
@vparfonov vparfonov changed the title fix(kubernetes_log source): fix VRL crashing on null (not exist) namespace_name when pod metadata annotation fails [release-6.5]fix(kubernetes_log source): fix VRL crashing on null (not exist) namespace_name when pod metadata annotation fails Jul 14, 2026
…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>
@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@vparfonov: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-target 4b92d01 link true /test e2e-target

Full PR test history. Your PR dashboard.

Details

Instructions 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. release/6.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants