Skip to content

feat(kubernetes): copy allowlisted placeholder labels onto the real pod - #145

Merged
InftyAI-Agent merged 1 commit into
InftyAI:mainfrom
kerthcet:feat/kubernetes-propagate-labels
Nov 16, 2026
Merged

InftyAI-Agent merged 1 commit into
InftyAI:mainfrom
kerthcet:feat/kubernetes-propagate-labels

Conversation

@kerthcet

Copy link
Copy Markdown
Member

What

A new manager flag, --kubernetes-propagate-labels, lists placeholder label keys the kubernetes provider copies onto the real pod in the target cluster, on top of the --cost-labels keys. For example, --kubernetes-propagate-labels=app lets a log pipeline that selects workloads by app find kubernetes sandboxes the way it finds Modal's.

  • Values are copied unchanged. A key the placeholder doesn't carry is skipped.
  • Empty, the default, copies only --cost-labels, which is the current behavior.
  • The flag fails at startup rather than dropping an entry: invalid keys, duplicates, and Nebula's own labels (nebula.inftyai.com/*, app.kubernetes.io/managed-by) are refused.

Why an allowlist

In the host cluster the real pod shares the placeholder's namespace. A controller label such as pod-template-hash would let the placeholder's owner adopt it, and anything selecting on labels (a Service, a PodDisruptionBudget, an operator) would count the sandbox twice. docs/multi-cluster.md gains a "Labels on the real pod" section saying so.

Testing

  • TestParsePropagateLabels plus provider tests for the propagated set.
  • go test ./... (non-e2e) and make lint pass.

🤖 Generated with Claude Code

--kubernetes-propagate-labels names placeholder label keys the real pod carries
in the target cluster, on top of --cost-labels, so a log pipeline selecting
workloads by label (app, say) finds kubernetes sandboxes as it does Modal's.
Values are copied unchanged; Nebula's own labels are refused at startup, and
the default (empty) copies only --cost-labels.

It is an allowlist because, in the host cluster, the real pod shares the
placeholder's namespace: a controller label such as pod-template-hash would let
the placeholder's owner adopt it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 16, 2026 20:49
@InftyAI-Agent InftyAI-Agent added needs-triage Indicates an issue or PR lacks a label and requires one. needs-priority Indicates a PR lacks a label and requires one. do-not-merge/needs-kind Indicates a PR lacks a label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues blocking the configurable Kubernetes label-propagation change.

No open issues 🎉

What changed in this PR

Adds configurable label propagation from placeholder pods to real pods in the Kubernetes provider, preserving cost-label propagation by default.

Changes:

  • Introduces --kubernetes-propagate-labels with startup validation for invalid, duplicate, and Nebula-owned keys.
  • Passes the combined label allowlist to pod creation and extends provider tests.
  • Documents label-selection risks and remote-cluster log-forwarding checks.
File Description
pkg/​provider/​kubernetes/​pod.go Validates propagation keys and copies allowlisted labels.
pkg/​provider/​kubernetes/​kubernetes.go Threads the combined label allowlist through provisioning.
pkg/​provider/​kubernetes/​kubernetes_test.go Tests parsing, propagation, and protected-label handling.
docs/​multi-cluster.md Documents label safety and log-forwarding verification.
cmd/​main.go Registers and validates the flag, combining it with cost-label keys.

Review effort: Balanced

@kerthcet

Copy link
Copy Markdown
Member Author

/lgtm
/kind feature

@InftyAI-Agent InftyAI-Agent added lgtm Looks good to me, indicates that a PR is ready to be merged. feature Categorizes issue or PR as related to a new feature. and removed do-not-merge/needs-kind Indicates a PR lacks a label and requires one. labels Nov 16, 2026

@InftyAI-Agent InftyAI-Agent left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved: PR has both lgtm and approved labels

@InftyAI-Agent
InftyAI-Agent merged commit 8b739de into InftyAI:main Nov 16, 2026
44 of 46 checks passed
@kerthcet
kerthcet deleted the feat/kubernetes-propagate-labels branch November 16, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. feature Categorizes issue or PR as related to a new feature. lgtm Looks good to me, indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a label and requires one. needs-triage Indicates an issue or PR lacks a label and requires one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants