Skip to content

[rds.kubernetes] Add a namespace label to discovered resources - #1489

Merged
manugarg merged 2 commits into
mainfrom
rds-k8s-namespace-label
Sep 13, 2026
Merged

manugarg merged 2 commits into
mainfrom
rds-k8s-namespace-label

Conversation

@manugarg

@manugarg manugarg commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Resources for all four Kubernetes kinds (pods, services, endpoints, ingresses) now carry a namespace label, so probes can use it via @target.label.namespace@ (e.g. in additional_label) and filter on it with labels.namespace.

  • A new kMetadata.resourceLabels() helper returns a copy of the object's labels plus namespace, so cached objects aren't modified.
  • If the object already has a label named namespace, it takes precedence (same convention as ingress fqdn/relative_url).
  • Pods, services, and endpoints now match the labels filter against these labels, so labels.namespace works for every kind.
  • Endpoints no longer overwrite object labels named node or pod, so all labels Cloudprober adds (namespace, node, pod, fqdn, relative_url) follow the same rule. Behavior change: endpoints targets whose object has its own node or pod label (e.g. copied from the Service) now report that value.
  • Docs: added a "Target Labels" section to the Kubernetes targets how-to.

This picks up the namespace label part of #1274. It doesn't prefix service names with the namespace, since that would rename existing targets.

Resources for all four kinds (pods, services, endpoints, ingresses) now
carry a "namespace" label, so probes can use it through
@target.label.namespace@ and filter on it with labels.namespace. An
object label named "namespace" takes precedence.

Picks up the namespace label part of #1274.
@manugarg manugarg changed the title [rds/kubernetes] Add a namespace label to discovered resources [rds.kubernetes] Add a namespace label to discovered resources Sep 12, 2026
…ndpoints

Match namespace, fqdn and relative_url: if the endpoints object already
has a node or pod label, keep its value.
@manugarg
manugarg merged commit 5003cb3 into main Sep 13, 2026
13 checks passed
@manugarg
manugarg deleted the rds-k8s-namespace-label branch September 13, 2026 05:10
manugarg added a commit that referenced this pull request Sep 13, 2026
Use kMetadata.resourceLabels(), as the other kinds do since #1489.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant