K8SPSMDB-1503: keep old .spec.replsets[].replsetOverrides logic#2171
K8SPSMDB-1503: keep old .spec.replsets[].replsetOverrides logic#2171
.spec.replsets[].replsetOverrides logic#2171Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the GetHorizons method to properly support the old .spec.replsets[].replsetOverrides logic, ensuring that horizons defined in ReplsetOverrides are preserved even when they don't exist in the main Horizons specification.
Key Changes
- Extracted a
fixDomainhelper function to handle port addition/removal logic consistently - Introduced a two-pass approach: first processing main
Horizonswith override merging, then adding any additional horizons fromReplsetOverridesthat weren't already processed - Added comprehensive test coverage for scenarios where only
ReplsetOverridesare defined without mainHorizons
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/apis/psmdb/v1/psmdb_types.go | Refactored GetHorizons method to support legacy ReplsetOverrides behavior with a two-pass processing approach |
| pkg/apis/psmdb/v1/psmdb_types_test.go | Enhanced test coverage with additional horizon entries and two new test cases for ReplsetOverrides-only scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if podHorizons, ok := horizons[podName]; !ok || podHorizons == nil { | ||
| horizons[podName] = make(map[string]string) | ||
| } |
There was a problem hiding this comment.
The map initialization logic is duplicated from lines 792-794. Consider extracting this pattern into a helper function or simplifying the check since make(map[string]string) never returns nil, making the podHorizons == nil check unnecessary.
commit: a2f4caa |
https://perconadev.atlassian.net/browse/K8SPSMDB-1503
CHANGE DESCRIPTION
Problem:
Previous PR (#2157) changed the logic of
.spec.replsets[].replsetOverridesfield. With this change,replsetOverridesare no longer included in the final list of horizon domains unless they are specified in the.spec.replsets[].splitHorizons.Solution:
Keep the old logic by including
.spec.replsets[].replsetOverrideshorizons even when they are not specified in the.spec.replsets[].splitHorizons.CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability