Skip to content

fix(etcd): resolve member actions through the current leader#3237

Draft
weicao wants to merge 3 commits into
martin/etcd-memberjoin-idempotencyfrom
martin/etcd-stale-leader-endpoint
Draft

fix(etcd): resolve member actions through the current leader#3237
weicao wants to merge 3 commits into
martin/etcd-memberjoin-idempotencyfrom
martin/etcd-stale-leader-endpoint

Conversation

@weicao

@weicao weicao commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What this changes

  • execute etcd member join/leave on the Pod selected by the current leader role instead of relying on a Pod-creation-time LEADER_POD_FQDN
  • verify the selected local endpoint is still the authoritative etcd leader before any membership mutation
  • derive a bounded, canonical contact list from the action-time member list
  • keep client TLS and peer TLS inputs separate
  • preserve raw uint64 member-ID comparisons and reject malformed or ambiguous member ownership
  • keep join/leave replay-safe with at most one membership mutation
  • bound etcdctl calls to fit the lifecycle action deadline

Closes #3236.

Stacked delivery boundary

This PR is intentionally based on martin/etcd-memberjoin-idempotency, the exact head of #3235 (79c82e3ba6adb532625295a78046b82edd3a2d90). It contains only the follow-up commits through f130ae036bc999868a01d61a656c1c31c1682e3d.

Do not retarget Test from #3235 to this PR implicitly. This stacked PR starts with runtime N=0 and needs its own exact-head Test contract after the code/CI gate closes.

Verification

  • genuine RED on the prior implementation for stale contact selection and canonical multi-owner ambiguity
  • memberJoin focused: 65/0
  • join + leave focused: 83/0
  • full etcd ShellSpec: 116/0
  • ambiguous pre-read: rc1, member-list-invalid, retry-safe no, mutation0, read1
  • BusyBox production-function boundary: duplicate canonical owner rejected
  • ShellCheck, Bash 3.2/5.3 syntax, diff-check, Helm lint/render: PASS
  • independent B1 rereview: APPROVE/0 for exact f130ae036bc999868a01d61a656c1c31c1682e3d

The real-etcd matrix is N=1/version and supports only the bounded etcdctl timing claim; it does not execute the Kubernetes lifecycle action and is not a product Test or release verdict.

@weicao
weicao requested review from a team and leon-ape as code owners July 18, 2026 08:52
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 483 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (79c82e3) to head (f130ae0).

Files with missing lines Patch % Lines
addons/etcd/scripts-ut-spec/member_join_spec.sh 0.00% 261 Missing ⚠️
addons/etcd/scripts-ut-spec/member_leave_spec.sh 0.00% 222 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                         @@
##           martin/etcd-memberjoin-idempotency   #3237    +/-   ##
===================================================================
  Coverage                                0.00%   0.00%            
===================================================================
  Files                                     150     150            
  Lines                                   23843   24254   +411     
===================================================================
- Misses                                  23843   24254   +411     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@weicao
weicao marked this pull request as draft July 18, 2026 16:18
@weicao
weicao removed request for a team and leon-ape July 18, 2026 16:19
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.

2 participants