Skip to content

Add unique label to pooled pods#378

Open
antonipp wants to merge 1 commit intokubernetes-sigs:mainfrom
DataDog:ai/unique-label-pool
Open

Add unique label to pooled pods#378
antonipp wants to merge 1 commit intokubernetes-sigs:mainfrom
DataDog:ai/unique-label-pool

Conversation

@antonipp
Copy link
Contributor

@antonipp antonipp commented Mar 9, 2026

Description

This PR ensures that all Pods created by the WarmPool controller start with a unique label. This should be aligned well with the goals for all Sandboxes to have a unique and stable identity (https://github.com/kubernetes-sigs/agent-sandbox?tab=readme-ov-file#desired-sandbox-characteristics)

In our case, we need this for enforcing different Cilium Network Policies on each unique Sandbox once it's claimed from a Pool (CNPs rely on labels for selecting the Pods).

Note that it seems that someone else already had that idea:

// pod.Labels[podNameLabel] = sandboxcontrollers.NameHash(pod.Name)

but the code which was commented out wouldn't work because the pod above uses GenerateName so pod.Name would be empty

Testing

Deployed to a cluster, created a WarmPool, verified that pods had the expected label:

$ kubectl get pods -l agents.x-k8s.io/pool=bb4771e4 -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.labels.agents\.x-k8s\.io/pool-pod-id}{"\n"}{end}'
my-warmpool-g8s6d	500144bf-06d8-4db1-8a2c-d4ae4694735d
my-warmpool-t9bnj	d13cdb28-b358-449d-b3ec-562a6fbc4428

@k8s-ci-robot k8s-ci-robot requested review from igooch and janetkuo March 9, 2026 15:01
@netlify
Copy link

netlify bot commented Mar 9, 2026

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit fc2f0dd
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/69bd06631e43c5000805a2d9

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 9, 2026
@k8s-ci-robot
Copy link
Contributor

Hi @antonipp. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 9, 2026
@janetkuo janetkuo added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 9, 2026
Copy link
Contributor

@yongruilin yongruilin left a comment

Choose a reason for hiding this comment

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

@janetkuo do you think it is a valid proposal?

@antonipp antonipp force-pushed the ai/unique-label-pool branch from a23a8e6 to 6fdc461 Compare March 10, 2026 09:05
Copy link

@natasha41575 natasha41575 left a comment

Choose a reason for hiding this comment

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

proposal seems sound to me

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2026
@natasha41575
Copy link

/assign @janetkuo
wdyt?

@k8s-ci-robot
Copy link
Contributor

@antonipp: 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
presubmit-agent-sandbox-lint-api 6fdc461 link true /test presubmit-agent-sandbox-lint-api

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@yongruilin
Copy link
Contributor

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 19, 2026
Signed-off-by: Anton Ippolitov <anton.ippolitov@datadoghq.com>
@antonipp antonipp force-pushed the ai/unique-label-pool branch from 6fdc461 to fc2f0dd Compare March 20, 2026 08:33
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2026
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: antonipp
Once this PR has been reviewed and has the lgtm label, please ask for approval from janetkuo. 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

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants