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-675: allow enabling/disabling sharding on a running cluster #1706

Merged
merged 13 commits into from
Dec 3, 2024

Conversation

pooknull
Copy link
Contributor

@pooknull pooknull commented Nov 5, 2024

K8SPSMDB-675 Powered by Pull Request Badge

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

DESCRIPTION

Problem:
If backup is enabled, it is not possible to switch the spec.sharding.enabled setting because PBM is unable to detect the change.

Solution:
When backup is enabled and a change is made to spec.sharding.enabled, the operator will first pause the cluster. During this pause, the statefulsets will be updated. After the updates are complete, the operator will then unpause the cluster.

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?

@pull-request-size pull-request-size bot added the size/XXL 1000+ lines label Nov 5, 2024
@pooknull pooknull marked this pull request as ready for review November 11, 2024 08:04
@@ -57,7 +59,9 @@ const (

// CheckNSetDefaults sets default options, overwrites wrong settings
// and checks if other options' values valid
func (cr *PerconaServerMongoDB) CheckNSetDefaults(platform version.Platform, log logr.Logger) error {
func (cr *PerconaServerMongoDB) CheckNSetDefaults(ctx context.Context, platform version.Platform) error {
log := logf.FromContext(ctx)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we use it anywhere?

@@ -262,6 +262,8 @@ const (
AppStatePaused AppState = "paused"
AppStateReady AppState = "ready"
AppStateError AppState = "error"

AppStateSharding AppState = "sharding"
Copy link
Contributor

Choose a reason for hiding this comment

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

i don't think this should be type AppState but I know that we use a custom condition struct rather than using the one exported from meta/v1. we need to start using it in near future

Comment on lines 327 to 328
ConditionEnabled ConditionStatus = "Enabled"
ConditionDisabled ConditionStatus = "Disabled"
Copy link
Contributor

Choose a reason for hiding this comment

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

can't we use ConditionTrue and ConditionFalse instead of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +1204 to +1210
for i, cond := range s.Conditions {
if cond.Type != c.Type {
continue
}
s.Conditions[i] = c
}
s.Conditions = append(s.Conditions, c)
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm we're changing our behavior but i think it's OK.

@egegunes egegunes added this to the v1.19.0 milestone Nov 25, 2024
@JNKPercona
Copy link
Collaborator

Test name Status
arbiter passed
balancer passed
custom-replset-name passed
custom-tls passed
custom-users-roles passed
custom-users-roles-sharded passed
cross-site-sharded passed
data-at-rest-encryption passed
data-sharded passed
demand-backup passed
demand-backup-fs passed
demand-backup-eks-credentials-irsa passed
demand-backup-physical failure
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 passed
multi-cluster-service failure
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
replset-overrides passed
rs-shard-migration passed
scaling passed
scheduled-backup passed
security-context passed
self-healing-chaos passed
service-per-pod passed
serviceless-external-nodes failure
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 53 out of 53

commit: 9945cb5
image: perconalab/percona-server-mongodb-operator:PR-1706-9945cb50

@hors hors merged commit dc110de into main Dec 3, 2024
9 of 13 checks passed
@hors hors deleted the dev/K8SPSMDB-675 branch December 3, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL 1000+ lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants