Skip to content

K8SPSMDB-1524: add default s3 region#2191

Merged
hors merged 14 commits intomainfrom
K8SPSMDB-1524
Jan 19, 2026
Merged

K8SPSMDB-1524: add default s3 region#2191
hors merged 14 commits intomainfrom
K8SPSMDB-1524

Conversation

@nmarukovich
Copy link
Contributor

@nmarukovich nmarukovich commented Jan 13, 2026

K8SPSMDB-1524 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:
Short explanation of the problem.
PBM defaults S3 storage region to us-east-1 when not specified. The operator compares the CR spec (region: "") with PBM config (region: "us-east-1"), detects a mismatch, and triggers continuous reconciliation loops attempting to remove the region from PBM config.

2025-11-20T14:40:23.838Z        INFO    PBM     Setting config  {"controller": "psmdb-controller", "controllerGroup": "psmdb.percona.com", "controllerKind": "PerconaServerMongoDB", "PerconaServerMongoDB": {"name":"some-name2","namespace":"demand-backup-physical-minio-21454"}, "namespace": "demand-backup-physical-minio-21454", "name": "some-name2", "reconcileID": "97fe6758-d089-4983-8593-9068915fdf6f", "cluster": "some-name2", "mainStorage": "minio"}
2025-11-20T14:40:23.847Z        INFO    PBM     main storage changed. starting resync   {"controller": "psmdb-controller", "controllerGroup": "psmdb.percona.com", "controllerKind": "PerconaServerMongoDB", "PerconaServerMongoDB": {"name":"some-name2","namespace":"demand-backup-physical-minio-21454"}, "namespace": "demand-backup-physical-minio-21454", "name": "some-name2", "reconcileID": "97fe6758-d089-4983-8593-9068915fdf6f", "old": {"type":"s3","s3":{"region":"us-east-1","endpointUrl":"http://minio-service:9000/","forcePathStyle":true,"bucket":"operator-testing","prefix":"mongodb/sample","maxUploadParts":10000,"storageClass":"STANDARD","insecureSkipTLSVerify":true,"retryer":{"numMaxRetries":3,"minRetryDelay":100000000000,"maxRetryDelay":300000000000}}}, "new": {"type":"s3","s3":{"region":"","endpointUrl":"http://minio-service:9000/","bucket":"operator-testing","prefix":"mongodb/sample","insecureSkipTLSVerify":true,"retryer":{"numMaxRetries":3,"minRetryDelay":100000000000,"maxRetryDelay":300000000000}}}}
2025-11-20T14:40:31.052Z        INFO    PBM     configuration changed or resync is needed       {"controller": "psmdb-controller", "controllerGroup": "psmdb.percona.com", "controllerKind": "PerconaServerMongoDB", "PerconaServerMongoDB": {"name":"some-name2","namespace":"demand-backup-physical-minio-21454"}, "namespace": "demand-backup-physical-minio-21454", "name": "some-name2", "reconcileID": "91e84779-55c6-41bd-af26-81e75b34a988", "oldHash": "0734ccf6981f329883e7274f9bd82a7d83de9b6f4b84f0dd79450d21db82d49f", "newHash": "0734ccf6981f329883e7274f9bd82a7d83de9b6f4b84f0dd79450d21db82d49f"}
2025-11-20T14:40:31.071Z        INFO    PBM     Setting config  {"controller": "psmdb-controller", "controllerGroup": "psmdb.percona.com", "controllerKind": "PerconaServerMongoDB", "PerconaServerMongoDB": {"name":"some-name2","namespace":"demand-backup-physical-minio-21454"}, "namespace": "demand-backup-physical-minio-21454", "name": "some-name2", "reconcileID": "91e84779-55c6-41bd-af26-81e75b34a988", "cluster": "some-name2", "mainStorage": "minio"}
2025-11-20T14:40:31.081Z        INFO    PBM     main storage changed. starting resync   {"controller": "psmdb-controller", "controllerGroup": "psmdb.percona.com", "controllerKind": "PerconaServerMongoDB", "PerconaServerMongoDB": {"name":"some-name2","namespace":"demand-backup-physical-minio-21454"}, "namespace": "demand-backup-physical-minio-21454", "name": "some-name2", "reconcileID": "91e84779-55c6-41bd-af26-81e75b34a988", "old": {"type":"s3","s3":{"region":"us-east-1","endpointUrl":"http://minio-service:9000/","forcePathStyle":true,"bucket":"operator-testing","prefix":"mongodb/sample","maxUploadParts":10000,"storageClass":"STANDARD","insecureSkipTLSVerify":true,"retryer":{"numMaxRetries":3,"minRetryDelay":100000000000,"maxRetryDelay":300000000000}}}, "new": {"type":"s3","s3":{"region":"","endpointUrl":"http://minio-service:9000/","bucket":"operator-testing","prefix":"mongodb/sample","insecureSkipTLSVerify":true,"retryer":{"numMaxRetries":3,"minRetryDelay":100000000000,"maxRetryDelay":300000000000}}}}

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
Short explanation of the solution we are providing with this PR.

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/XS 0-9 lines label Jan 13, 2026
@pull-request-size pull-request-size bot added size/S 10-29 lines and removed size/XS 0-9 lines labels Jan 13, 2026
@mayankshah1607
Copy link
Member

@nmarukovich please check this PR - #2189

I think it will fix the reconcile flip-flops because call to storage.Cast() will apply the storage defaults used by PBM

check_backup_in_storage ${backup_name_minio} minio rs0

reconciliation_count=$(kubectl_bin logs ${OPERATOR_NS:+-n $OPERATOR_NS} $(get_operator_pod) \
| grep "main storage changed. starting resync" \
Copy link
Contributor

Choose a reason for hiding this comment

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

this log will be removed, see #2193

please check for configuration changed or resync is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@egegunes it looks like @mayankshah1607 returned this code.
Could you check one more time

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll remove this log entry @nmarukovich

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found! I will update test.

@egegunes egegunes changed the title K8SPSMDB-1524 add default K8SPSMDB-1524: add default s3 region Jan 14, 2026
@nmarukovich
Copy link
Contributor Author

@nmarukovich please check this PR - #2189

I think it will fix the reconcile flip-flops because call to storage.Cast() will apply the storage defaults used by PBM

I rechecked. It looks like your PR fixed it. I close this one.

@nmarukovich nmarukovich reopened this Jan 14, 2026
Comment on lines 58 to 59
# wait_backup "${backup_name_gcp}"
# check_backup_in_storage ${backup_name_gcp} gcs rs0
Copy link
Contributor

Choose a reason for hiding this comment

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

please revert these

# minRetryDelay: 30ms
# maxRetryDelay: 5m
# region: us-west-2
# region: us-east-1
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are changing this, I believe we should adjust the values of the storages names.

Copy link
Contributor

Choose a reason for hiding this comment

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

note that we configure them using the word west

Copy link
Contributor Author

Choose a reason for hiding this comment

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

didn't catch the comment. I change the region here because pbm use us-east-1 as default and adds it to pbm config if region is missed.

Copy link
Contributor

Choose a reason for hiding this comment

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

so should we change the following?

storages:
#      s3-us-west:
....

wait_backup "${backup_name_minio}"
check_backup_in_storage ${backup_name_minio} minio rs0

reconciliation_count=$(kubectl_bin logs ${OPERATOR_NS:+-n $OPERATOR_NS} $(get_operator_pod) \
Copy link
Contributor

Choose a reason for hiding this comment

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

why this check is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need to test somehow that the problem fixed. we discussed with @eleo007 and it is the only idea that we have.

}

if cr.CompareVersion("1.22.0") >= 0 && stg.S3.Region == "" {
stg.S3.Region = "us-east-1"
Copy link
Contributor

Choose a reason for hiding this comment

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

i would move this to a default defaultS3Region = "us-east-1"

@nmarukovich nmarukovich requested a review from egegunes January 16, 2026 16:02
nmarukovich and others added 4 commits January 16, 2026 17:06
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@nmarukovich nmarukovich requested a review from gkech January 19, 2026 09:12
@JNKPercona
Copy link
Collaborator

Test Name Result Time
arbiter passed 00:00:00
balancer passed 00:00:00
cross-site-sharded passed 00:00:00
custom-replset-name passed 00:00:00
custom-tls passed 00:00:00
custom-users-roles passed 00:00:00
custom-users-roles-sharded passed 00:00:00
data-at-rest-encryption passed 00:00:00
data-sharded passed 00:00:00
demand-backup passed 00:00:00
demand-backup-eks-credentials-irsa passed 00:00:00
demand-backup-fs passed 00:00:00
demand-backup-if-unhealthy passed 00:00:00
demand-backup-incremental passed 00:00:00
demand-backup-incremental-sharded passed 00:00:00
demand-backup-physical-parallel passed 00:00:00
demand-backup-physical-aws passed 00:00:00
demand-backup-physical-azure passed 00:00:00
demand-backup-physical-gcp-s3 passed 00:00:00
demand-backup-physical-gcp-native passed 00:00:00
demand-backup-physical-minio passed 00:00:00
demand-backup-physical-minio-native passed 00:00:00
demand-backup-physical-sharded-parallel passed 00:00:00
demand-backup-physical-sharded-aws passed 00:00:00
demand-backup-physical-sharded-azure passed 00:00:00
demand-backup-physical-sharded-gcp-native passed 00:00:00
demand-backup-physical-sharded-minio passed 00:00:00
demand-backup-physical-sharded-minio-native passed 00:00:00
demand-backup-sharded passed 00:00:00
disabled-auth passed 00:00:00
expose-sharded passed 00:00:00
finalizer passed 00:00:00
ignore-labels-annotations passed 00:00:00
init-deploy passed 00:00:00
ldap passed 00:00:00
ldap-tls passed 00:00:00
limits passed 00:00:00
liveness passed 00:00:00
mongod-major-upgrade passed 00:00:00
mongod-major-upgrade-sharded passed 00:00:00
monitoring-2-0 passed 00:00:00
monitoring-pmm3 passed 00:00:00
multi-cluster-service passed 00:12:23
multi-storage passed 00:00:00
non-voting-and-hidden passed 00:00:00
one-pod passed 00:00:00
operator-self-healing-chaos passed 00:00:00
pitr passed 00:00:00
pitr-physical passed 00:00:00
pitr-sharded passed 00:00:00
pitr-to-new-cluster passed 00:00:00
pitr-physical-backup-source passed 00:00:00
preinit-updates passed 00:00:00
pvc-resize passed 00:00:00
recover-no-primary passed 00:00:00
replset-overrides passed 00:00:00
replset-remapping passed 00:00:00
replset-remapping-sharded passed 00:00:00
rs-shard-migration passed 00:00:00
scaling passed 00:00:00
scheduled-backup passed 00:00:00
security-context passed 00:00:00
self-healing-chaos passed 00:00:00
service-per-pod passed 00:00:00
serviceless-external-nodes passed 00:00:00
smart-update passed 00:00:00
split-horizon passed 00:00:00
stable-resource-version passed 00:00:00
storage passed 00:00:00
tls-issue-cert-manager passed 00:00:00
unsafe-psa passed 00:00:00
upgrade passed 00:00:00
upgrade-consistency passed 00:00:00
upgrade-consistency-sharded-tls passed 00:00:00
upgrade-sharded passed 00:00:00
upgrade-partial-backup passed 00:00:00
users passed 00:00:00
users-vault passed 00:00:00
version-service passed 00:00:00
Summary Value
Tests Run 79/79
Job Duration 00:40:32
Total Test Time 00:12:23

commit: d5bed1c
image: perconalab/percona-server-mongodb-operator:PR-2191-d5bed1c7

@hors hors merged commit c9718ad into main Jan 19, 2026
13 checks passed
@hors hors deleted the K8SPSMDB-1524 branch January 19, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S 10-29 lines tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants