Skip to content

Replace StatefulSets with a customized controller#363

Open
ahrtr wants to merge 1 commit into
mainfrom
20260615_customized_controller
Open

Replace StatefulSets with a customized controller#363
ahrtr wants to merge 1 commit into
mainfrom
20260615_customized_controller

Conversation

@ahrtr

@ahrtr ahrtr commented Jun 15, 2026

Copy link
Copy Markdown
Member

Fix #362

Each etcd member maps 1-to-1 to a Pod owned directly by EtcdCluster. All startup configuration (initial cluster state, initial cluster peers, data dir) is embedded in the Pod spec's env vars, not in a shared ConfigMap. A Pod is immutable once created — if a member needs to be replaced, the old Pod (and its PVC) is deleted and a fresh Pod is created.

This is a AI-generated first version.

@nwnt do you have bandwidth to continue to finish this PR? Pls feel free to fork a new branch and continue to work on it.

Each etcd member maps 1-to-1 to a Pod owned directly by EtcdCluster.
All startup configuration (initial cluster state, initial cluster peers,
data dir) is embedded in the Pod spec's env vars, not in a shared ConfigMap.
A Pod is immutable once created — if a member needs to be replaced, the
old Pod (and its PVC) is deleted and a fresh Pod is created.

Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
@k8s-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahrtr

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

Copy link
Copy Markdown

@ahrtr: 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
pull-etcd-operator-test-e2e 72dd89d link true /test pull-etcd-operator-test-e2e

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.

logger.Info("Decreasing StatefulSet replicas to remove the unneeded Pod.", "oldReplicaCount", targetReplica, "newReplicaCount", newReplicaCount)
if _, err := reconcileStatefulSet(ctx, logger, s.cluster, r.Client, newReplicaCount, r.Scheme); err != nil {
// A member was removed from etcd but the pod was not yet deleted.
logger.Info("Deleting pod for already-removed etcd member")

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.

Apologies, how do we know, which is the pod/member which has actually failed, is relying on the last member the right approach?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point. For now, we follow the same logic as Statefulset. Eventually we will need to compare etcd member names and POD names and figure out which POD to remove.

@nwnt

nwnt commented Jun 15, 2026

Copy link
Copy Markdown
Member

Yes I will have a look tonight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace Statefulsets with customized controller

4 participants