Ensure StatefulSetSelector matches deployed labels. - #2220
Conversation
ai-assisted=yes
17d88ba to
2e10a6b
Compare
|
🤖 AI code review — this was generated by Claude Code (an AI coding agent) and is being posted by a human reviewer who is checking these findings before acting on them. Treat as input to review, not as an authoritative verdict. Ran a high-effort automated review of this PR's new StatefulSet-selector validation guard. 5 findings, all independently verified: Correctness
Cleanup
Findings 1 and 2 share the same root cause: validation only considers the new object's selector-vs-template state in isolation, and only when a selector override is explicitly present. |
Widens ValidateStatefulSetSelector to run whenever a StatefulSet override is present, not just when spec.override.statefulSet.spec.selector is explicitly set, so a pod-template-label-only override that breaks the default selector match is caught before the API server rejects the StatefulSet and reconciliation gets stuck permanently failing. Also rejects an explicit empty selector, which would otherwise match every pod in the namespace and pass validation trivially. Gives selector-override failures a distinct reconcile-failure reason (InvalidStatefulSetSelectorOverride) instead of the generic "Error", following the existing ErrInvalidEnvConfig/InvalidConfiguration pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This closes #2218