Skip to content

K8SPSMDB-1488 | minio configuration changes are not synced with PBM#2189

Merged
mayankshah1607 merged 16 commits intomainfrom
K8SPSMDB-1488-refactor
Jan 16, 2026
Merged

K8SPSMDB-1488 | minio configuration changes are not synced with PBM#2189
mayankshah1607 merged 16 commits intomainfrom
K8SPSMDB-1488-refactor

Conversation

@mayankshah1607
Copy link
Member

@mayankshah1607 mayankshah1607 commented Jan 12, 2026

K8SPSMDB-1488 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:

Changing Minio configuration does not get synced with PBM.

Cause:
The isResyncNeeded helper does not take Minio configuration into account

Solution:

Update isResyncNeeded to check Minio configuration

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>
mayankshah1607 and others added 2 commits January 12, 2026 14:20
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@egegunes
Copy link
Contributor

please add description

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 refactors the isResyncNeeded function to fix an issue where Minio configuration changes were not properly synced with PBM (Percona Backup for MongoDB). The refactoring replaces explicit field-by-field comparisons with cleaner switch-case logic that delegates to Equal methods provided by the storage package.

Changes:

  • Simplified the isResyncNeeded function by replacing verbose field comparisons with Equal method calls for all storage types
  • Added support for Minio storage type configuration change detection
  • Added import for github.com/percona/percona-backup-mongodb/pbm/storage package

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

@pull-request-size pull-request-size bot added size/L 100-499 lines and removed size/M 30-99 lines labels Jan 12, 2026
Copilot AI review requested due to automatic review settings January 12, 2026 09:59
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 1 comment.


💡 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 13, 2026
Copilot AI review requested due to automatic review settings January 13, 2026 06:42
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 no new comments.


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

gkech
gkech previously approved these changes Jan 13, 2026
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copilot AI review requested due to automatic review settings January 14, 2026 10:58
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 3 out of 3 changed files in this pull request and generated 2 comments.


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

Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copilot AI review requested due to automatic review settings January 14, 2026 16:16
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 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

pkg/psmdb/backup/pbm.go:359

  • The ForcePathStyle field is missing from GetPBMStorageMinioConfig, but it's checked in isResyncNeeded (line 237 of pbm.go) and exists in the BackupStorageMinioSpec struct. This field should be added to the Minio config initialization, similar to how it's set for S3 on line 408. Without this, changes to ForcePathStyle won't be properly synced to PBM even though the resync check will detect them.
		Minio: &mio.Config{
			Region:                stg.Minio.Region,
			Endpoint:              stg.Minio.EndpointURL,
			Bucket:                stg.Minio.Bucket,
			Prefix:                stg.Minio.Prefix,
			InsecureSkipTLSVerify: stg.Minio.InsecureSkipTLSVerify,
			DebugTrace:            stg.Minio.DebugTrace,
			PartSize:              stg.Minio.PartSize,
			Secure:                stg.Minio.Secure,
		},

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

Comment on lines 215 to 225
if currentCfg.Storage.S3 != nil && newCfg.Storage.S3 != nil {
if currentCfg.Storage.S3.Bucket != newCfg.Storage.S3.Bucket {
return true
}

if currentCfg.Storage.S3.Region != newCfg.Storage.S3.Region {
return true
}

if currentCfg.Storage.S3.EndpointURL != newCfg.Storage.S3.EndpointURL {
return true
}

if currentCfg.Storage.S3.Prefix != newCfg.Storage.S3.Prefix {
return true
}

if currentCfg.Storage.S3.Credentials.AccessKeyID != newCfg.Storage.S3.Credentials.AccessKeyID {
if currentCfg.Storage.S3.Bucket != newCfg.Storage.S3.Bucket ||
currentCfg.Storage.S3.Region != newCfg.Storage.S3.Region ||
currentCfg.Storage.S3.EndpointURL != newCfg.Storage.S3.EndpointURL ||
currentCfg.Storage.S3.Prefix != newCfg.Storage.S3.Prefix ||
currentCfg.Storage.S3.Credentials.AccessKeyID != newCfg.Storage.S3.Credentials.AccessKeyID ||
currentCfg.Storage.S3.Credentials.SecretAccessKey != newCfg.Storage.S3.Credentials.SecretAccessKey {
return true
}
}
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The S3 configuration check is missing the ForcePathStyle field comparison. This field is being set in GetPBMStorageS3Config (line 408 of pbm.go) and is a pointer type (*bool) in the spec. It should be checked using ptr.Equal like it is for Minio on line 237, otherwise changes to S3's ForcePathStyle setting won't trigger a resync.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

@mayankshah1607 should we add this check?

Signed-off-by: Mayank Shah <mayank.shah@percona.com>
Copilot AI review requested due to automatic review settings January 15, 2026 11:32
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
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 3 out of 3 changed files in this pull request and generated 2 comments.


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

return true
}

if currentCfg.Storage.S3.ForcePathStyle != newCfg.Storage.S3.ForcePathStyle {
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Inconsistent handling of ForcePathStyle comparison. S3's ForcePathStyle is a pointer type (*bool) in the API spec, but is being compared directly as a bool here, while MinIO's ForcePathStyle (also *bool) is correctly compared using ptr.Equal on line 279. This should use ptr.Equal for pointer comparison to handle nil values correctly.

Suggested change
if currentCfg.Storage.S3.ForcePathStyle != newCfg.Storage.S3.ForcePathStyle {
if !ptr.Equal(currentCfg.Storage.S3.ForcePathStyle, newCfg.Storage.S3.ForcePathStyle) {

Copilot uses AI. Check for mistakes.
Comment on lines +390 to +417
{
"minio: nothing changed",
&config.Config{
Storage: config.StorageConf{
Type: storage.Minio,
Minio: &mio.Config{
Bucket: "operator-testing",
Region: "us-east-1",
Endpoint: "operator-testing.com",
Secure: true,
InsecureSkipTLSVerify: false,
},
},
},
&config.Config{
Storage: config.StorageConf{
Type: storage.Minio,
Minio: &mio.Config{
Bucket: "operator-testing",
Region: "us-east-1",
Endpoint: "operator-testing.com",
Secure: true,
InsecureSkipTLSVerify: false,
},
},
},
false,
},
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Missing test coverage for MinIO ForcePathStyle changes. The isResyncNeeded function checks for ForcePathStyle changes in MinIO configuration (line 279 in pbm.go), but there's no corresponding test case to verify this behavior. Consider adding a test case similar to the ones for other MinIO configuration changes.

Copilot uses AI. Check for mistakes.
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
gkech
gkech previously approved these changes Jan 15, 2026
egegunes
egegunes previously approved these changes Jan 15, 2026
Signed-off-by: Mayank Shah <mayank.shah@percona.com>
@mayankshah1607 mayankshah1607 dismissed stale reviews from egegunes and gkech via f255ff2 January 16, 2026 05:36
Copilot AI review requested due to automatic review settings January 16, 2026 05:36
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 3 out of 3 changed files in this pull request and generated 2 comments.


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

@JNKPercona
Copy link
Collaborator

Test Name Result Time
arbiter passed 00:11:51
balancer passed 00:19:10
cross-site-sharded passed 00:19:35
custom-replset-name passed 00:10:07
custom-tls passed 00:14:49
custom-users-roles passed 00:10:49
custom-users-roles-sharded passed 00:12:13
data-at-rest-encryption passed 00:12:57
data-sharded passed 00:24:28
demand-backup passed 00:17:01
demand-backup-eks-credentials-irsa passed 00:00:08
demand-backup-fs passed 00:24:12
demand-backup-if-unhealthy passed 00:12:34
demand-backup-incremental passed 00:48:52
demand-backup-incremental-sharded passed 01:02:51
demand-backup-physical-parallel passed 00:09:34
demand-backup-physical-aws passed 00:13:12
demand-backup-physical-azure passed 00:11:58
demand-backup-physical-gcp-s3 passed 00:12:25
demand-backup-physical-gcp-native passed 00:11:49
demand-backup-physical-minio passed 00:21:33
demand-backup-physical-minio-native passed 00:22:33
demand-backup-physical-sharded-parallel passed 00:11:51
demand-backup-physical-sharded-aws passed 00:18:59
demand-backup-physical-sharded-azure passed 00:18:23
demand-backup-physical-sharded-gcp-native passed 00:18:11
demand-backup-physical-sharded-minio passed 00:18:22
demand-backup-physical-sharded-minio-native passed 00:18:23
demand-backup-sharded passed 00:26:39
disabled-auth passed 00:16:52
expose-sharded passed 00:34:13
finalizer passed 00:10:38
ignore-labels-annotations passed 00:08:04
init-deploy passed 00:13:14
ldap passed 00:08:57
ldap-tls passed 00:13:02
limits passed 00:06:35
liveness passed 00:09:03
mongod-major-upgrade passed 00:12:16
mongod-major-upgrade-sharded passed 00:22:28
monitoring-2-0 passed 00:25:40
monitoring-pmm3 passed 00:26:26
multi-cluster-service passed 00:13:23
multi-storage passed 00:19:21
non-voting-and-hidden passed 00:17:47
one-pod passed 00:08:46
operator-self-healing-chaos passed 00:13:19
pitr passed 00:33:04
pitr-physical passed 01:02:22
pitr-sharded passed 00:21:18
pitr-to-new-cluster passed 00:26:35
pitr-physical-backup-source passed 00:55:46
preinit-updates passed 00:05:56
pvc-resize passed 00:12:34
recover-no-primary passed 00:28:45
replset-overrides passed 00:17:44
replset-remapping passed 00:15:15
replset-remapping-sharded passed 00:17:17
rs-shard-migration passed 00:14:44
scaling passed 00:11:33
scheduled-backup passed 00:17:46
security-context passed 00:07:21
self-healing-chaos passed 00:15:51
service-per-pod passed 00:19:26
serviceless-external-nodes passed 00:07:52
smart-update passed 00:08:33
split-horizon passed 00:13:59
stable-resource-version passed 00:05:03
storage passed 00:08:24
tls-issue-cert-manager passed 00:30:44
unsafe-psa passed 00:08:08
upgrade passed 00:10:22
upgrade-consistency passed 00:08:09
upgrade-consistency-sharded-tls passed 00:57:28
upgrade-sharded passed 00:19:54
upgrade-partial-backup passed 00:17:00
users passed 00:18:10
users-vault passed 00:13:59
version-service passed 00:25:44
Summary Value
Tests Run 79/79
Job Duration 02:48:07
Total Test Time 24:12:54

commit: f255ff2
image: perconalab/percona-server-mongodb-operator:PR-2189-f255ff24

@mayankshah1607 mayankshah1607 merged commit e605e88 into main Jan 16, 2026
23 checks passed
@mayankshah1607 mayankshah1607 deleted the K8SPSMDB-1488-refactor branch January 16, 2026 08:42
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.

6 participants