Skip to content

K8SPSMDB-1488: fix isResyncNeeded#2202

Merged
hors merged 5 commits intomainfrom
K8SPSMDB-1488-storage-resync
Jan 19, 2026
Merged

K8SPSMDB-1488: fix isResyncNeeded#2202
hors merged 5 commits intomainfrom
K8SPSMDB-1488-storage-resync

Conversation

@mayankshah1607
Copy link
Member

@mayankshah1607 mayankshah1607 commented Jan 16, 2026

K8SPSMDB-1488 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:
Changing minio config leads to constant storage resync reconciliations

Solution:

Use IsSameStorage since that's what PBM uses to detect resyncs - https://github.com/percona/percona-backup-mongodb/blob/968f87a3b1763abe700e4a6dedd168672019aa18/cmd/pbm/config.go#L163-L165

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?

Signed-off-by: Mayank Shah <mayank.shah@percona.com>
true,
},
{
"s3: endpointUrl changed",
Copy link
Member Author

Choose a reason for hiding this comment

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

IsSameStorage does not compare endpoint URL for S3 and Azure, probably because we don't expect them to change (this is not the case for Minio)

Copy link
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 fixes an issue where changing Minio configuration leads to constant storage resync reconciliations. The solution delegates the storage comparison logic to PBM's IsSameStorage method, which is what PBM itself uses to detect when resyncs are needed.

Changes:

  • Simplified isResyncNeeded function to use PBM's IsSameStorage method instead of manual field comparisons
  • Removed manual field-by-field comparison logic for all storage types (S3, Minio, GCS, Azure, Filesystem)
  • Removed unused k8s.io/utils/ptr import
  • Removed test cases for endpoint URL changes in S3 and Azure that are no longer relevant with the new comparison logic

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/controller/perconaservermongodb/pbm.go Replaced manual storage comparison with call to IsSameStorage method and removed unused import
pkg/controller/perconaservermongodb/pbm_test.go Removed test cases for S3 and Azure endpoint URL changes that are no longer needed

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Mayank Shah <mayank.shah@percona.com>
egegunes
egegunes previously approved these changes Jan 16, 2026
Copilot AI review requested due to automatic review settings January 19, 2026 04:23
Copy link
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 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

},
true,
},
// TODO: uncomment this when we have PBM 2.13.0
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The TODO comment refers to "PBM 2.13.0" but should verify this is the correct version. Consider adding a link to the relevant PBM issue or PR that will include the EndpointURL in the IsSameStorage check for better context and tracking.

Suggested change
// TODO: uncomment this when we have PBM 2.13.0
// TODO: uncomment this when PBM includes EndpointURL in IsSameStorage check

Copilot uses AI. Check for mistakes.
},
true,
},
// TODO: uncomment this when we have PBM 2.13.0
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The TODO comment refers to "PBM 2.13.0" but should verify this is the correct version. Consider adding a link to the relevant PBM issue or PR that will include the EndpointURL in the IsSameStorage check for better context and tracking.

Suggested change
// TODO: uncomment this when we have PBM 2.13.0
// TODO: uncomment this when PBM includes Azure EndpointURL in the IsSameStorage check

Copilot uses AI. Check for mistakes.
},
// TODO: uncomment this when we have PBM 2.13.0
// {
// "azure: endpointUrl changed",
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO instead of commenting out we can do

			if tt.skip {
				t.Skip()
			}

The mean reason for not commenting out for me is to protect the test from a refactor and rename a type or field with the code silently becoming stale. Skipped tests still compile, so we catch changes.
Skipped tests are also visible to the test output.

Copy link
Member Author

Choose a reason for hiding this comment

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

okay, updated

Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copilot AI review requested due to automatic review settings January 19, 2026 09:38
Copy link
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@hors hors merged commit 1d685d5 into main Jan 19, 2026
14 checks passed
@hors hors deleted the K8SPSMDB-1488-storage-resync branch January 19, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L 100-499 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants