Skip to content
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

K8SPSMDB-1002: add crd preferer primary node #1629

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

sergelogvinov
Copy link
Contributor

@sergelogvinov sergelogvinov commented Aug 27, 2024

K8SPSMDB-1002 Powered by Pull Request Badge

Add crd parameter to prefer primary node in cluster.

CHANGE DESCRIPTION

Problem:

K8SPSMDB-1002: The ability to change the primary node through the operator

Cause:

During the planned zone switchover process, the only way to change the primary node is to scale down the operator, adjust the node priority, and then scale the operator back up.

Solution:

CRD changes:

spec:
  replsets:
    primaryPreferTagSelector:
      region: region-1
      zone: region-1a

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?
  • Did we add proper logging messages for operator actions? (Configuring member votes and priorities - already exists)
  • 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?

@egegunes
Copy link
Contributor

egegunes commented Sep 17, 2024

Hi @sergelogvinov, thank you for your contribution. This looks good but I want to test these changes before approving. @hors if everything is OK, are you OK with including this to v1.18.0?

I only have doubts about the new field name primaryPreferTagSelector, which @spron-in can provide his input, and changes in SetVotes.

egegunes
egegunes previously approved these changes Sep 17, 2024
inelpandzic
inelpandzic previously approved these changes Sep 17, 2024
@sergelogvinov
Copy link
Contributor Author

The name primaryPreferTagSelector reminds me of the Kubernetes naming style - Prefer, similar to the affinity preference selector, and TagSelector, resembling the NodeSelector. The term primary is also a common role associated with databases.

Regarding SetVotes, after discussing it with my colleagues, it seems that only those with experience in MongoDB are familiar with its meaning.

Would you mind asking your colleagues for their thoughts on this? I can change it at any time.

@inelpandzic
Copy link
Contributor

@sergelogvinov @egegunes @hors I tested this PR and everything is ok. The field name is also good.
We can merge this one.
Thanks @sergelogvinov for the contribution!

Copy link
Collaborator

@hors hors left a comment

Choose a reason for hiding this comment

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

@sergelogvinov, please add a new field to https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/cr.yaml and comment it by default. We use this file as an example, so all fields should be present.

Add crd parameter to prefer primary node in cluster.
@sergelogvinov
Copy link
Contributor Author

@sergelogvinov, please add a new field to https://github.com/percona/percona-server-mongodb-operator/blob/main/deploy/cr.yaml and comment it by default. We use this file as an example, so all fields should be present.

done

@JNKPercona
Copy link
Collaborator

Test name Status
arbiter passed
balancer passed
custom-replset-name passed
custom-tls passed
cross-site-sharded passed
data-at-rest-encryption passed
data-sharded passed
demand-backup passed
demand-backup-eks-credentials passed
demand-backup-physical passed
demand-backup-physical-sharded passed
demand-backup-sharded passed
expose-sharded passed
ignore-labels-annotations passed
init-deploy passed
finalizer passed
ldap passed
ldap-tls passed
limits passed
liveness passed
mongod-major-upgrade passed
mongod-major-upgrade-sharded passed
monitoring-2-0 failure
multi-cluster-service passed
non-voting passed
one-pod passed
operator-self-healing-chaos passed
pitr passed
pitr-sharded passed
pitr-physical passed
pvc-resize passed
recover-no-primary passed
rs-shard-migration passed
scaling passed
scheduled-backup passed
security-context passed
self-healing-chaos passed
service-per-pod passed
serviceless-external-nodes passed
smart-update passed
split-horizon passed
storage passed
tls-issue-cert-manager passed
upgrade passed
upgrade-consistency passed
upgrade-consistency-sharded-tls passed
upgrade-sharded passed
users passed
version-service passed
We run 49 out of 49

commit: 9c3717a
image: perconalab/percona-server-mongodb-operator:PR-1629-9c3717a0

@hors hors merged commit ae93484 into percona:main Sep 20, 2024
13 of 14 checks passed
@hors
Copy link
Collaborator

hors commented Sep 20, 2024

@sergelogvinov thank you for your contribution. We will include this improvement in the next PSMDBO release (1.18.0).

@sergelogvinov sergelogvinov deleted the primary-prefer branch September 20, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community size/L 100-499 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants