Replace StatefulSets with a customized controller#363
Conversation
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>
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@ahrtr: 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. DetailsInstructions 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") |
There was a problem hiding this comment.
Apologies, how do we know, which is the pod/member which has actually failed, is relying on the last member the right approach?
There was a problem hiding this comment.
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.
|
Yes I will have a look tonight |
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.