Skip to content

Conversation

@gkech
Copy link
Contributor

@gkech gkech commented Dec 11, 2025

K8SPSMDB-1413 Powered by Pull Request Badge

CHANGE DESCRIPTION

Problem:

When secrets are owned by certmanager through OwnerReference, the operator is still trying to set the owner, resulting to an error. With this PR we are handling the error so that AlreadyOwnedError errors are not blocking the flow.

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/M 30-99 lines label Dec 11, 2025
@pull-request-size pull-request-size bot added size/L 100-499 lines and removed size/M 30-99 lines labels Dec 11, 2025
@egegunes egegunes added this to the v1.22.0 milestone Dec 15, 2025
@gkech gkech marked this pull request as ready for review December 17, 2025 11:47
Copy link
Contributor

@egegunes egegunes left a comment

Choose a reason for hiding this comment

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

@gkech please add description to the PR

@hors hors requested a review from mayankshah1607 December 18, 2025 10:34
Comment on lines 316 to 320
// cert-manager sets the Certificate as the controller owner.
// In that case, the operator should not set a new controller reference.
if metav1.GetControllerOf(secret) != nil {
continue
}
Copy link
Member

@mayankshah1607 mayankshah1607 Dec 18, 2025

Choose a reason for hiding this comment

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

We can just check if the error below (when calling SetControllerReference) returns a controllerutil.AlreadyOwnedError{} type using errors.Is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, we can switch to that.

mayankshah1607 and others added 6 commits December 18, 2025 16:19
)

* fix backup/smart-upgrde deadlock

Signed-off-by: Mayank Shah <[email protected]>

* add comments

Signed-off-by: Mayank Shah <[email protected]>

* fix unit test

Signed-off-by: Mayank Shah <[email protected]>

* unit test

Signed-off-by: Mayank Shah <[email protected]>

* unit tests for conditions

Signed-off-by: Mayank Shah <[email protected]>

* linting

Signed-off-by: Mayank Shah <[email protected]>

* remove debug statements

Signed-off-by: Mayank Shah <[email protected]>

* linting

Signed-off-by: Mayank Shah <[email protected]>

* Update pkg/controller/perconaservermongodb/status_test.go

Co-authored-by: Copilot <[email protected]>

* Update pkg/apis/psmdb/v1/psmdb_types.go

Co-authored-by: Copilot <[email protected]>

* fix test semantics

Signed-off-by: Mayank Shah <[email protected]>

* wrap error

Signed-off-by: Mayank Shah <[email protected]>

---------

Signed-off-by: Mayank Shah <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Ege Güneş <[email protected]>
* K8SPSMDB-1448: sync user secrets with vault

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

* use `github.com/pkg/errors`

* add `serviceAccountTokenPath`

* Update pkg/apis/psmdb/v1/psmdb_defaults.go

Co-authored-by: Copilot <[email protected]>

* `go mod tidy`

* add `tlsSecret` field

* use `errors.Wrap`

* fix validation message

* add unit-tests

* fix users-vault test

* improve validation

* small fixes

* small go mod change

* add test cases

* improve test

* implement cached vault

* fix tests

* refactor

* remove debug prints

* small improvements

* small fix

* `make manifests`

* fix unit-tests

* address comments

* return on logged error

* fix cached vault

* secret client per cluster + provider handler for future secret storages

* mac fix

* logging improvements

* implement critical errors

* fix wrapped errors

* small fix

* fix if condition

* fix unit-tests

* apply copilot suggestions

* make `endpointURL` required

* fix test

* fix validation error

* improve logs

* continue reconcile on failed connection to the vault

* small test fix

* fix test

* block reconcile when user secret doesn't exist

* final fix for `users-vault` test

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Mayank Shah <[email protected]>
Co-authored-by: Viacheslav Sarzhan <[email protected]>
* K8SPSMDB-1429: improve cluster status

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

* small fix

---------

Co-authored-by: Mayank Shah <[email protected]>
Co-authored-by: Viacheslav Sarzhan <[email protected]>
* Setting appProtocol for service objects

* Setting appProtocol for service objects

* update compare version

* small improvement

* fix unit-test

* change `mongo` to `mongodb`

* add appProtocol to mongos service and fix tests

* fix unit-tests

* fix unit-test

* fix `TestReconcileReplsetServices`

* switch back to `mongo`

* fix init-deploy

---------

Co-authored-by: Andrii Dema <[email protected]>
Co-authored-by: Viacheslav Sarzhan <[email protected]>
@pull-request-size pull-request-size bot added size/XXL 1000+ lines and removed size/L 100-499 lines labels Dec 23, 2025
@github-actions github-actions bot added tests dependencies Pull requests that update a dependency file labels Dec 23, 2025
fakeBackup "github.com/percona/percona-server-mongodb-operator/pkg/psmdb/backup/fake"
faketls "github.com/percona/percona-server-mongodb-operator/pkg/psmdb/tls/fake"
"github.com/percona/percona-server-mongodb-operator/pkg/version"
"github.com/stretchr/testify/assert"
Copy link
Contributor

Choose a reason for hiding this comment

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

[goimports-reviser] reported by reviewdog 🐶

Suggested change
"github.com/stretchr/testify/assert"

@JNKPercona
Copy link
Collaborator

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

commit: b9c4516
image: perconalab/percona-server-mongodb-operator:PR-2135-b9c4516c

@egegunes
Copy link
Contributor

why do we have so many unrelated changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file size/XXL 1000+ lines tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants