fix: [AAP-81880] support topology spread constraints (and affinity) for the EDA kind - #365
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe EDA watch now preserves embedded Kubernetes field names. A Molecule test verifies that API topology spread constraints render correctly in the API Deployment. ChangesEDA topology spread propagation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to No merge-blocking issue was identified for this focused field-preservation change. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use Comment |
There was a problem hiding this comment.
@snagoor I have just one small observation: since the main intent of this PR/commit became adding the topology spread constraints feature, could you please amend the commit so it reflects that in the title and make it meaningful for this purpose? The fix is something that needed to be done regardless so it can be explained in the commit body, but the main contribution here is the topology spread constraints, so I think the title could be updated.
Thanks in advance!
…for the EDA kind
topology_spread_constraints set on an EDA CR never made it into the
generated Deployments. The reconcile failed with an HTTP 422:
spec.template.spec.topologySpreadConstraints[0].maxSkew:
Invalid value: 0: must be greater than zero
spec.template.spec.topologySpreadConstraints[0].topologyKey:
Required value: can not be empty
Root cause: the EDA entry in watches.yaml was missing
snakeCaseParameters: False (EDABackup and EDARestore already set it).
Without it, ansible-operator snake_cases the CR spec recursively, so
maxSkew -> max_skew and topologyKey -> topology_key. Those keys were
rendered into the Deployment, the API server pruned them as unknown
fields, and the required fields were left unset.
Every EDA spec field the roles consume is already snake_case, so the
conversion is not needed; the only camelCase fields in the CRD are
native Kubernetes structures that must stay camelCase.
This also fixes affinity, which had the same problem, and
strategy.rollingUpdate, which was silently falling back to its 25%
default instead of using the configured values.
Add a molecule check that patches the CR with a constraint and asserts
the API Deployment renders it with camelCase keys and the CR's values.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Updated as requested. |



Problem
topology_spread_constraintsset on an EDA CR never make it into the generated Deployments.The reconcile fails with an HTTP 422:
Cause
The
EDAentry inwatches.yamlwas missingsnakeCaseParameters: False(theEDABackupandEDARestoreentries already have it). Without it, ansible-operator snake_cases the CR specrecursively, so
maxSkew→max_skew,topologyKey→topology_key, and so on. Those keys getrendered into the Deployment, the API server prunes them as unknown fields, and the required fields
are left unset.
The Jinja templates are fine — they were already fixed in #275.
Fix
Add
snakeCaseParameters: Falseto theEDAwatch entry. Every EDA spec field the roles consume isalready snake_case, so the conversion isn't needed; the only camelCase fields in the CRD are native
Kubernetes structures that must stay camelCase.
This also fixes
affinity(same problem) andstrategy.rollingUpdate, which was silently fallingback to its
25%default instead of using the configured values.Testing
Added a molecule check that patches the CR with a constraint and asserts the API Deployment renders
it with camelCase keys and the CR's values.
Note:
watches.yamlis baked into the operator image, so this needs an image rebuild, not just a CRreapply.
Assisted-by: Claude Opus 5 noreply@anthropic.com
Summary by CodeRabbit
New Features
Bug Fixes