-
Notifications
You must be signed in to change notification settings - Fork 60
Use a Deployment instead of a StatefulSet for the controller #191
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
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: antonipp 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 |
✅ Deploy Preview for agent-sandbox canceled.
|
|
Hi @antonipp. Thanks for your PR. I'm waiting for a github.com 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. |
|
/ok-to-test |
| --- | ||
|
|
||
| kind: StatefulSet | ||
| kind: Deployment |
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.
To provide some more context, the original discussion regarding StatefulSet vs. Deployment is here: #13 (comment)
Note that if we decide to accept this change, this requires an additional migration step when upgrading Agent Sandbox to this version.
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.
ah thanks, I didn't see this conversation. But tbh I still don't really understand why an STS would be better for leader election specifically? I don't really see why the overhead would be worth it. (cc @justinsb)
Also FWIW, we've been running dozens of different controllers over the years and from what I've seen they've all been Deployments. When it comes to the identity, they seem to simply be using os.Hostname(). We don't need static STS identities at all.
Random examples:
- cluster-autoscaler https://github.com/kubernetes/autoscaler/blob/fb2899a594ed99489add5c46e3680a460776154b/cluster-autoscaler/main.go#L403-L449 / https://github.com/kubernetes/autoscaler/blob/fb2899a594ed99489add5c46e3680a460776154b/cluster-autoscaler/charts/cluster-autoscaler/templates/deployment.yaml#L4
- Cilium Operator https://github.com/cilium/cilium/blob/f8a57c416f0aac506e5725f939fe42b8464885fe/operator/cmd/root.go#L469-L538 / https://github.com/cilium/cilium/blob/cb94478fa365a6331ff0a79ee82c223bb6d4b936/install/kubernetes/cilium/templates/cilium-operator/deployment.yaml#L4
- CSI Snapshotter: https://github.com/kubernetes-csi/external-snapshotter/blob/2c37c1c04f835acb2f22e9d543e1f68bcef4cb30/cmd/snapshot-controller/main.go#L343-L371 / https://github.com/kubernetes-csi/external-snapshotter/blob/2c37c1c04f835acb2f22e9d543e1f68bcef4cb30/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml#L9
They just have way less constraints and are easier to operate.
|
This is an acceptable change. We can switch back to sts later if needed. Would you check the docs and check if they need a change. |
barney-s
left a comment
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.
Thanks for the changes
| labels: | ||
| app: agent-sandbox-controller | ||
| spec: | ||
| serviceName: agent-sandbox-controller |
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.
While removing serviceName is correct for a Deployment, it's worth double-checking if any other part of the system implicitly relied on the stable pod names generated by the StatefulSet (e.g., in logging, monitoring, or custom scripts).
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.
ok actually found 1 reference in examples/jupyterlab/README.md but that's it (and it's good that nothing depended on this logic)
| --- | ||
|
|
||
| kind: StatefulSet | ||
| kind: Deployment |
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.
While changing the kind to Deployment is the correct move for a stateless controller, this is a breaking change for existing users. An upgrade will not be smooth as the new Deployment won't manage the old StatefulSet's pods.
Please add a note to the RELEASE.md or a dedicated upgrade guide explaining the manual steps required, which likely involve deleting the old StatefulSet before applying the new manifests.
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.
I am aware it's a breaking change but not really sure what's the actual process for documenting it should be. RELEASE.md feels wrong and an upgrade guide is overkill for such as simple change (especially since the project is in the early days and users should expect the internals to change)
Maybe something we just call out in the Github release notes somehow?
Signed-off-by: Anton Ippolitov <[email protected]>
aa548c2 to
1571613
Compare
|
/retest |
|
@antonipp: The following test failed, say
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. 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. |
Description
While trying out the agent-sandbox project, I noticed that the main controller is deployed as a StatefulSet. I couldn't really find a justification for it in the commit history, so this looks like an oversight. The controller is stateless and doesn't require a stable network identity, so I don't really see a reason to use a much heavier abstraction here. Moreover, STS ordered rollout semantics are unnecessary for a stateless controller and could complicate scaling/updates if leader election is enabled for HA.
So my PR switches the controller to be deployed as a simple Deployment, I think it will make operations easier for everyone