Skip to content

K8SPSMDB-1413 skip setting controller owner on secrets owned by Certificates created by cert-manager#2135

Merged
hors merged 14 commits intomainfrom
K8SPSMDB-1413
Jan 9, 2026
Merged

K8SPSMDB-1413 skip setting controller owner on secrets owned by Certificates created by cert-manager#2135
hors merged 14 commits intomainfrom
K8SPSMDB-1413

Conversation

@gkech
Copy link
Copy Markdown
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.

☝🏽

the original issue seems that was resolved through this pr: #1850

in this pr we are keeping the unit test that was initially introduced to validate that the fix indeed was covered

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@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
@egegunes
Copy link
Copy Markdown
Contributor

why do we have so many unrelated changes?

@it-percona-cla
Copy link
Copy Markdown

it-percona-cla commented Dec 31, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 4 committers have signed the CLA.

✅ pooknull
✅ mayankshah1607
❌ sorenmat
❌ gkech
You have signed the CLA already but the status is still pending? Let us recheck it.

@gkech
Copy link
Copy Markdown
Contributor Author

gkech commented Jan 5, 2026

why do we have so many unrelated changes?

not sure why these commits appeared here, locally the same branch is fine, let me fix that

@pull-request-size pull-request-size bot added size/L 100-499 lines and removed size/XXL 1000+ lines labels Jan 5, 2026
@github-actions github-actions bot removed tests dependencies Pull requests that update a dependency file labels Jan 5, 2026
egegunes
egegunes previously approved these changes Jan 6, 2026
@gkech gkech requested a review from egegunes January 6, 2026 15:24
egegunes
egegunes previously approved these changes Jan 7, 2026
egegunes
egegunes previously approved these changes Jan 8, 2026
@gkech gkech requested a review from egegunes January 8, 2026 15:04
@JNKPercona
Copy link
Copy Markdown
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
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:00:00
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 failure 00:17:45
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:14:43
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 78/78
Job Duration 00:57:48
Total Test Time 00:32:29

commit: 77eaa03
image: perconalab/percona-server-mongodb-operator:PR-2135-77eaa039

@hors hors merged commit 0443a5f into main Jan 9, 2026
16 of 17 checks passed
@hors hors deleted the K8SPSMDB-1413 branch January 9, 2026 09:48
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.

7 participants