fix: reconcile/builder correctness bugs with unit tests - #96
Open
chideat wants to merge 4 commits into
Open
Conversation
Surgical, behavior-preserving fixes (no new logic), each with a unit test. - ops/failover patch-labels: add missing `return` so a Monitor().Master() error no longer falls through to a nil-pointer panic - valkey/failover manual monitor: return nil on successful promotion instead of falling through to the "No available node to failover" error - clientset UpdatePod: submit the merged oldPod (with server ResourceVersion), not the caller's stale pod argument - builder configmap (cluster+failover): fix memory-sizing guard `&&`->`||` so the Limits->Requests memory fallback actually fires - controller failover: return after finalizer removal so it is not re-added to an object being deleted (mirrors cluster_controller) - config.Getenv: return the matched non-empty default, not always defaults[0] - rds webhook: correct the inverted "spec.resources is required" message - builder statefulset (cluster+failover): set PVC OwnerReferences via index so RetainAfterDeleted is honored (range-copy bug) - helper sync: fix etcd object-size guard constant (~1Gi -> ~1Mi) via a small pure `exceedsConfigMapSizeLimit` helper - remove dead util.CheckRule/CheckUserRuleUpdate/AuthConfig and their tests Full unit suite incl. envtest (controller/webhook) is green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Align the mock method tables with gofmt so the new/modified test files pass the format check. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
…e guard Addresses code-review follow-ups (all test-only / no production behavior change): - add internal/testutil with configurable FakeFailoverInstance and FakeValkeyNode, replacing three near-identical per-package mocks (failoverbuilder, ops/failover/actor, valkey/failover/monitor). The certmetav1.ObjectReference deprecation now surfaces once instead of 3x. - simplify exceedsConfigMapSizeLimit to take a single dataSize (oldTotal and oldData always cancelled to 0 at the only call site); behavior unchanged. Verified: ACL-rule validation is fully handled by pkg/types/user.Rule.Validate (user webhook + pkg/security/acl), so the earlier dead-code removal left no gap. Full unit suite incl. envtest is green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chideat
enabled auto-merge (squash)
June 22, 2026 03:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A batch of surgical, behavior-preserving correctness fixes (no new logic) across the reconcile, builder, webhook, config, and helper layers, each shipped with a unit test. Found via an architecture review; scoped down to verified bugs only.
Every fix was cross-checked against the surrounding logic and controller-runtime semantics. For the trickiest ones (R2/R3/R5/R10) the regression test was proven to fail against the buggy code and pass after the fix.
Fixes
ops/failover/actor/actor_patch_labels.goreturn→ nil-pointer panic whenMonitor().Master()errorsreturnvalkey/failover/monitor/manual_monitor.goreturn nilon successpkg/kubernetes/clientset/pod.goUpdatePodsubmits the stale arg, not the mergedoldPodUpdate(ctx, oldPod)builder/{cluster,failover}builder/configmap.go&&is always false → Limits→Requests fallback never fires&&→||controller/failover_controller.goreturn)returnafter removal (mirrors cluster)config/env.goGetenvreturnsdefaults[0]instead of the matched defaultreturn vwebhook/rds/v1alpha1/valkey_webhook.gobuilder/{cluster,failover}builder/statefulset.goOwnerReferencesset on a range-copy →RetainAfterDeletedignoredcmd/helper/sync/controller.goexceedsConfigMapSizeLimit, fix constantinternal/util/auth.goCheckRule/CheckUserRuleUpdate/AuthConfig)Deliberately out of scope
actor.RequeueAfter'stime.Sleepis intentional — owner-triggered reconciles preempt the requeue timer, so the sleep is a load-bearing pacing floor, not redundant. Left as-is.Testing
internal/controller,internal/webhook/rds/...) is green (go test -count=1, 35 packages, 0 failures).api/type changes → nomake manifests/make generateneeded.🤖 Generated with Claude Code