-
Notifications
You must be signed in to change notification settings - Fork 161
K8SPSMDB-1541: fix PSA #2153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
K8SPSMDB-1541: fix PSA #2153
Conversation
There was a problem hiding this 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 fixes the PSA (Primary-Secondary-Arbiter) configuration handling by simplifying version-specific logic and ensuring the unsafePSA flag is properly respected when adjusting replica set voting configuration.
- Removes redundant version comparison logic for determining unsafe PSA configuration (versions <= 1.15.0 vs >= 1.16.0)
- Fixes the vote adjustment logic to skip vote normalization when
unsafePSAis enabled - Removes extraneous whitespace
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/psmdb/mongo/mongo.go | Adds unsafePSA check to prevent vote normalization in unsafe PSA configurations and removes trailing whitespace |
| pkg/controller/perconaservermongodb/mgo.go | Simplifies unsafePSA determination by removing version-based conditional logic and using only cr.Spec.Unsafe.ReplsetSize |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this 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 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } else { | ||
| unsafePSA = cr.Spec.Unsafe.ReplsetSize && rs.Arbiter.Enabled && rs.Arbiter.Size == 1 && !rs.NonVoting.Enabled && rs.Size == 2 | ||
| } | ||
| unsafePSA := cr.Spec.Unsafe.ReplsetSize && rs.Arbiter.Enabled && rs.Arbiter.Size == 1 && !rs.NonVoting.Enabled && rs.Size == 2 |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change removes backward compatibility for operator versions 1.15.0 and earlier. The previous code checked the version and used cr.Spec.UnsafeConf for versions <= 1.15.0. While UnsafeConf is automatically migrated to Unsafe.ReplsetSize in the defaults code (see psmdb_defaults.go lines 115-124), this migration only happens when processing the CR. For existing clusters that were deployed with version 1.15.0 or earlier and are being upgraded, there could be a brief period where the old field hasn't been migrated yet.
Consider whether dropping support for these older versions is intentional. If it is, this should be documented in the PR description or migration guide. If backward compatibility should be maintained, the version check should be preserved to handle both UnsafeConf and Unsafe.ReplsetSize fields.
| unsafePSA := cr.Spec.Unsafe.ReplsetSize && rs.Arbiter.Enabled && rs.Arbiter.Size == 1 && !rs.NonVoting.Enabled && rs.Size == 2 | |
| unsafeReplsetSize := cr.Spec.Unsafe.ReplsetSize || cr.Spec.UnsafeConf | |
| unsafePSA := unsafeReplsetSize && rs.Arbiter.Enabled && rs.Arbiter.Size == 1 && !rs.NonVoting.Enabled && rs.Size == 2 |
commit: 75daeb1 |
https://perconadev.atlassian.net/browse/K8SPSMDB-1541
DESCRIPTION
Problem:
It's not possible to deploy a PSA (Primary-Secondary-Arbiter) cluster. Operator returns an error:
Cause:
When the cluster is deployed, operator adds each new member one by reconcile. When secondary is added, the operator enforces a rule to keep an odd number of voting members, so it sets the secondary to
votes: 0. That state leaves the replica set with only one voting member. However, to deploy PSA it's necessary to have two voting members to add an arbiter.Solution:
Ignore the rule of odd value of voting members when deploying a PSA cluster.
CHECKLIST
Jira
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability