Repository navigation
fix(chi): gate aborted auto-recovery on operator ready label - #2108
Tyagiquamar wants to merge 1 commit into
Conversation
Re-enqueue aborted CHIs when the clickhouse.altinity.com/ready label transitions to yes, not on kubelet container readiness alone. Fixes Altinity#2106
PR #2108 — Code ReviewPR: #2108 Verdict: Changes requested The PR changes two files and attempts to fix issue #2106 by triggering recovery when the operator's There are two significant issues with this approach. Finding 1 — [P1] The new trigger can prevent recovery indefinitelyFile: pkg/controller/chi/worker-pod-retry.go The PR replaces the Pod NotReady → Ready trigger with an operator-label if !isPodOperatorReadyLabelNotReadyToReadyTransition(oldPod, newPod, cr) {
return
}This creates a circular dependency. The operator normally sets the label to Consider the exact failure described in issue #2106:
Unless another event initiates reconciliation, the CHI can remain Aborted and replica 0-1 can remain excluded indefinitely. This is supported by the existing call chain:
Required change: Do not make automatic recovery depend exclusively on a label that recovery itself must restore. Finding 2 — [P1] The original Service-outage risk remainsFile: pkg/controller/chi/worker-status-helpers.go PR #2108 changes only the recovery trigger. It does not change how the reconciler decides whether another replica is safe to rely on.
That predicate is used by:
Therefore, if a reconcile is triggered by a CHI update or another event, the original sequence can still occur:
The safety check can incorrectly count 0-1 as a healthy peer, authorize exclusion of 0-0, and leave the Service without eligible replicas. Required change: Ensure the peer-safety and recovery-ordering decisions account for A dedicated Service-eligibility predicate may be preferable to changing every use of Tests need to cover the actual failureThe new unit tests correctly exercise the label-transition helper, but they encode the problematic behavior: {"kubelet ready but label still no", pod(false), pod(true), false},That is exactly the event that needs to initiate recovery in issue #2106. PR #2108 — Code ReviewPR: #2108 Verdict: Changes requested The PR changes two files and attempts to fix issue #2106 by triggering recovery when the operator's I found two significant issues with this approach. Finding 1 — [P1] The new trigger can prevent recovery indefinitelyFile: pkg/controller/chi/worker-pod-retry.go The PR replaces the Pod NotReady → Ready trigger with an operator-label if !isPodOperatorReadyLabelNotReadyToReadyTransition(oldPod, newPod, cr) {
return
}This creates a circular dependency. The operator normally sets the label to Consider the exact failure described in issue #2106:
Unless another event initiates reconciliation, the CHI can remain Aborted and replica 0-1 can remain excluded indefinitely. This is supported by the existing call chain:
Required change: Do not make automatic recovery depend exclusively on a label that recovery itself must restore. Finding 2 — [P1] The original Service-outage risk remainsFile: pkg/controller/chi/worker-status-helpers.go PR #2108 changes only the recovery trigger. It does not change how the reconciler decides whether another replica is safe to rely on.
That predicate is used by:
Therefore, if a reconcile is triggered by a CHI update or another event, the original sequence can still occur:
The safety check can incorrectly count 0-1 as a healthy peer, authorize exclusion of 0-0, and leave the Service without eligible replicas. Required change: Ensure the peer-safety and recovery-ordering decisions account for A dedicated Service-eligibility predicate may be preferable to changing every use of Tests need to cover the actual failureThe new unit tests correctly exercise the label-transition helper, but they encode the problematic behavior: {"kubelet ready but label still no", pod(false), pod(true), false},That is exactly the event that needs to initiate recovery in issue #2106. I would request a regression test with one shard and two replicas, asserting that:
CI statusAt the time of review:
|
Summary
clickhouse.altinity.com/readylabel transitions toyes, instead of on kubelet container readiness alone.Test plan
go test ./pkg/controller/chi -run 'TestIsPodOperatorReadyLabelNotReadyToReadyTransition|TestShouldTriggerAutoRecovery'(not run locally; CI-first A1)gh pr checkson this PRFixes #2106