-
Notifications
You must be signed in to change notification settings - Fork 26
feat: Added Disruption control for SandboxTemplate in extensions #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for agent-sandbox canceled.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vicentefb The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hi @vicentefb. 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 Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
ae1d6ff to
8891f87
Compare
|
I am inclined to keep this out of the core sandbox CRD. Related: |
|
/ok-to-test |
4016287 to
588db3d
Compare
Hi @barney-s , were you suggesting that we should not have this at all, and leave it to users to create and manage the PDB for their Sandbox pod? |
Yes. Not part of the sandbox spec. |
Sounds good, and we can provide some documentation/guidance around this so users can follow |
|
friendly ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After spending some more time on this, I don't think using a PDB for replica=1 resources is ideal. Given that each Sandbox has only one replica, applying a PDB with minAvailable: 1 creates an usually undesirable, operational outcome that it will block all voluntary disruptions (like node drains) and effectively prevent cluster maintenance.
+1 to this. Also commented to this effect on the Issue #59 |
feat: added PDB to Sandbox spec updated rbac generated file nit nit refacted pdb into its own controller nit sandbox controller test nit moved PDB implementation to extensions fixed lint
towards: #59
This PR introduces disruption control for sandboxes created via sandboxclaim controller. It extends the
SandboxTemplateAPI with a new boolean flag, enableDisruptionControl, which protects the resulting sandbox pod from voluntary disruptions (e.g., node upgrades, cluster autoscaling).This is achieved by updating the
sandboxclaim-controllerto:"safe-to-evict"annotation and a PDB selector label into theSandboxresource.API Update (
sandboxtemplate_types.go):-Added a new optional field
enableDisruptionControl: boolto the SandboxTemplateSpec.Controller Logic (
sandboxclaim_controller.go):-PDB Finalizer: The controller now adds a pdb-cleanup finalizer to any SandboxClaim that uses a template with enableDisruptionControl: true.
-Resource Injection: When creating a Sandbox resource, the controller now injects two fields into its podTemplate:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false".-PDB Reconciliation: The controller ensures a single, shared PodDisruptionBudget (named sandbox-highly-available) exists in any namespace that has at least one claim with
enableDisruptionControl: true.-Cleanup Logic: The
reconcilePDBDeletionfunction ensures that the shared PDB is only deleted when the last participating SandboxClaim in that namespace is deleted.Testing:
Added a new test suite,
TestSandboxClaimPDBLifecycle, tosandboxclaim_controller_test.goto validate:-The PDB is correctly created when enableDisruptionControl is true.
-The finalizer is successfully added to the SandboxClaim.
-The Sandbox resource is created with the correct PDB label and safe-to-evict annotation.
-The PDB is not deleted if other claims still require it.
The PDB is correctly deleted when the final participating claim is removed.
