Skip to content

Implementation of basic controller logic - #20

Closed
Kirill Ilin (sircthulhu) wants to merge 2 commits into
mainfrom
13-basic-operator-controller-logic
Closed

Kirill Ilin (sircthulhu) wants to merge 2 commits into
mainfrom
13-basic-operator-controller-logic

Conversation

@sircthulhu

Copy link
Copy Markdown
Collaborator

Controller now can successfully bootstrap etcd cluster :)

  • Controller creates Service, ConfigMap and StatefulSet based on EtcdCluster CR
  • Only EmptyDir storage is supported
  • Initialized status is being set and updated

- sts, svc and cm are created by operator
- "Initialized" status is being set and updated
- etcd cluster successfully bootstraps
@sircthulhu

Copy link
Copy Markdown
Collaborator Author

Broke things up because of squash and git branch from webhooks branch. Will open new PR with cherry picked commit.

@sircthulhu
Kirill Ilin (sircthulhu) deleted the 13-basic-operator-controller-logic branch March 14, 2024 17:16
Terry Tang (saymololy) pushed a commit to saymololy/etcd-operator that referenced this pull request Nov 2, 2026
…zystack#20)

ensurePod previously returned the existing Pod regardless of whose
EtcdMember owned it. Mirror ensurePVC's safety check: a podOwnedBy
helper that requires an EtcdMember owner ref whose UID matches the
current EtcdMember; refuse adoption otherwise with an error that
prompts controller-runtime to back off and retry on the next
reconcile.

Failure modes the gate now prevents:
  - Same-named Pod left behind by a deleted prior EtcdMember whose GC
    hasn't completed yet. Adoption would have the operator reconciling
    a Pod whose spec was written by a different controller generation.
  - Pod with no owner refs (manually created, or leaked from a prior
    incarnation). Adoption would silently bind unowned state.
  - Pod owned by some other resource (a ReplicaSet, another operator's
    CR). Adoption would mount foreign state into the etcd member.

Less load-bearing than the PVC equivalent — Pod corruption is
recoverable since the operator can drop and recreate the Pod —  but
the inconsistency was a footgun: future Pod-recreate flows (in-place
version upgrade) would need this gate to be safe.

Test trio mirrors TestEnsurePVC_RefusesStaleOwner / RefusesPVCWith
NoOwnerRefs / RefusesPVCOwnedByOther / AcceptsOwnPVC against Pods.

Closes cozystack#8.

Signed-off-by: Timofei Larkin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant