Skip to content

feat(sources): extract Namespace annotations in kubernetes_logs - #25970

Open
srstrickland wants to merge 2 commits into
vectordotdev:masterfrom
srstrickland:feat/k8s-namespace-annotations
Open

feat(sources): extract Namespace annotations in kubernetes_logs#25970
srstrickland wants to merge 2 commits into
vectordotdev:masterfrom
srstrickland:feat/k8s-namespace-annotations

Conversation

@srstrickland

@srstrickland srstrickland commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

kubernetes_logs currently enriches events with the owning Namespace's labels (kubernetes.namespace_labels) but has no equivalent for Namespace annotations. This adds namespace_annotation_fields.namespace_annotations, mirroring the existing namespace_labels handling in namespace_metadata_annotator.rs and the pod_annotations field already supported on Pods. This lets users store larger/more complex values in a namespace annotation (e.g. multi-value routing config, a team/oncall identifier) without hitting the 63-character Kubernetes label-value limit.

Closes #21428.

Vector configuration

sources:
  kubernetes_logs:
    type: kubernetes_logs
    namespace_annotation_fields:
      namespace_annotations: .kubernetes.namespace_annotations
      # or "" to suppress, or a custom path, same as namespace_labels

Given a Namespace annotated with:

metadata:
  annotations:
    mycompany.com/oncall: platform-team

events from pods in that namespace now carry:

{
  "kubernetes": {
    "namespace_annotations": {
      "mycompany.com/oncall": "platform-team"
    }
  }
}

How did you test this PR?

  • Added unit test coverage in namespace_metadata_annotator.rs.
  • Built a one-off image & manually tested in a live k8s cluster; works as expected.

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

(Added: changelog.d/k8s_namespace_annotations.feature.md.)

References

Adds namespace_annotation_fields.namespace_annotations, mirroring the
existing namespace_labels handling and the pod_annotations pattern, so
events can be enriched with the owning Namespace's annotations (e.g.
values too large or complex for a label) in addition to its labels.

Closes vectordotdev#21428
@srstrickland
srstrickland requested review from a team as code owners July 29, 2026 22:41
@github-actions github-actions Bot added docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: sources Anything related to the Vector's sources domain: external docs Anything related to Vector's external, public documentation labels Jul 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8154504fc8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/sources/kubernetes_logs/namespace_metadata_annotator.rs
…_annotations

Addresses review feedback: the generated CUE reference was out of sync
with the new namespace_annotation_fields.namespace_annotations field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: external docs Anything related to Vector's external, public documentation domain: sources Anything related to the Vector's sources

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kubernetes Source: Add namespace annotations to event metadata

1 participant