Skip to content

K8SPSMDB-1503: keep old .spec.replsets[].replsetOverrides logic#2171

Merged
hors merged 4 commits intomainfrom
K8SPSMDB-1503-pr-fix
Jan 7, 2026
Merged

K8SPSMDB-1503: keep old .spec.replsets[].replsetOverrides logic#2171
hors merged 4 commits intomainfrom
K8SPSMDB-1503-pr-fix

Conversation

@pooknull
Copy link
Copy Markdown
Contributor

@pooknull pooknull commented Jan 5, 2026

K8SPSMDB-1503 Powered by Pull Request Badge

https://perconadev.atlassian.net/browse/K8SPSMDB-1503

CHANGE DESCRIPTION

Problem:
Previous PR (#2157) changed the logic of .spec.replsets[].replsetOverrides field. With this change, replsetOverrides are 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[].replsetOverrides horizons even when they are not specified in the .spec.replsets[].splitHorizons.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported MongoDB version?
  • Does the change support oldest and newest supported Kubernetes version?

Copilot AI review requested due to automatic review settings January 5, 2026 10:44
@pull-request-size pull-request-size bot added the size/M 30-99 lines label Jan 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 fixDomain helper function to handle port addition/removal logic consistently
  • Introduced a two-pass approach: first processing main Horizons with override merging, then adding any additional horizons from ReplsetOverrides that weren't already processed
  • Added comprehensive test coverage for scenarios where only ReplsetOverrides are defined without main Horizons

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>
Copilot AI review requested due to automatic review settings January 5, 2026 12:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pooknull pooknull marked this pull request as ready for review January 6, 2026 10:00
@pooknull pooknull requested a review from hors as a code owner January 6, 2026 10:00
Copilot AI review requested due to automatic review settings January 6, 2026 10:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 802 to 804
if podHorizons, ok := horizons[podName]; !ok || podHorizons == nil {
horizons[podName] = make(map[string]string)
}
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@JNKPercona
Copy link
Copy Markdown
Collaborator

Test Name Result Time
arbiter passed 00:11:22
balancer passed 00:18:13
cross-site-sharded passed 00:17:46
custom-replset-name passed 00:10:25
custom-tls passed 00:15:33
custom-users-roles passed 00:10:41
custom-users-roles-sharded passed 00:11:34
data-at-rest-encryption passed 00:13:04
data-sharded passed 00:23:24
demand-backup passed 00:16:17
demand-backup-eks-credentials-irsa passed 00:00:07
demand-backup-fs passed 00:22:52
demand-backup-if-unhealthy passed 00:08:30
demand-backup-incremental passed 00:42:59
demand-backup-incremental-sharded passed 00:59:54
demand-backup-physical-parallel passed 00:08:06
demand-backup-physical-aws passed 00:11:53
demand-backup-physical-azure passed 00:11:16
demand-backup-physical-gcp-s3 passed 00:12:13
demand-backup-physical-gcp-native passed 00:11:04
demand-backup-physical-minio passed 00:20:20
demand-backup-physical-minio-native passed 00:19:27
demand-backup-physical-sharded-parallel passed 00:10:32
demand-backup-physical-sharded-aws passed 00:17:20
demand-backup-physical-sharded-azure passed 00:17:40
demand-backup-physical-sharded-gcp-native passed 00:17:40
demand-backup-physical-sharded-minio passed 00:17:26
demand-backup-physical-sharded-minio-native passed 00:17:05
demand-backup-sharded passed 00:25:17
expose-sharded passed 00:33:32
finalizer passed 00:09:36
ignore-labels-annotations passed 00:07:42
init-deploy passed 00:12:53
ldap passed 00:09:00
ldap-tls passed 00:12:48
limits passed 00:06:17
liveness passed 00:08:11
mongod-major-upgrade passed 00:11:49
mongod-major-upgrade-sharded passed 00:21:23
monitoring-2-0 passed 00:25:34
monitoring-pmm3 passed 00:28:41
multi-cluster-service passed 00:14:47
multi-storage passed 00:18:31
non-voting-and-hidden passed 00:16:34
one-pod passed 00:08:08
operator-self-healing-chaos passed 00:12:29
pitr passed 00:31:32
pitr-physical passed 01:01:58
pitr-sharded passed 00:21:04
pitr-to-new-cluster passed 00:25:44
pitr-physical-backup-source passed 00:56:09
preinit-updates passed 00:05:06
pvc-resize passed 00:12:54
recover-no-primary passed 00:27:44
replset-overrides passed 00:16:22
replset-remapping passed 00:08:25
replset-remapping-sharded passed 00:17:28
rs-shard-migration passed 00:14:31
scaling passed 00:11:11
scheduled-backup passed 00:17:24
security-context passed 00:07:15
self-healing-chaos passed 00:15:04
service-per-pod passed 00:19:33
serviceless-external-nodes passed 00:07:36
smart-update passed 00:08:22
split-horizon passed 00:14:16
stable-resource-version passed 00:04:46
storage passed 00:08:26
tls-issue-cert-manager passed 00:29:30
unsafe-psa passed 00:07:44
upgrade passed 00:10:35
upgrade-consistency passed 00:07:10
upgrade-consistency-sharded-tls passed 00:52:02
upgrade-sharded passed 00:20:00
upgrade-partial-backup passed 00:14:40
users passed 00:17:31
users-vault passed 00:13:48
version-service passed 00:24:49
Summary Value
Tests Run 78/78
Job Duration 04:14:35
Total Test Time 22:49:12

commit: a2f4caa
image: perconalab/percona-server-mongodb-operator:PR-2171-a2f4caa1

@hors hors merged commit 425a6bc into main Jan 7, 2026
13 checks passed
@hors hors deleted the K8SPSMDB-1503-pr-fix branch January 7, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M 30-99 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants