K8SPSMDB-1413 skip setting controller owner on secrets owned by Certificates created by cert-manager#2135
K8SPSMDB-1413 skip setting controller owner on secrets owned by Certificates created by cert-manager#2135
Conversation
…ficates created by cert-manager
pkg/psmdb/tls/certmanager.go
Outdated
| // 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 | ||
| } |
There was a problem hiding this comment.
We can just check if the error below (when calling SetControllerReference) returns a controllerutil.AlreadyOwnedError{} type using errors.Is
There was a problem hiding this comment.
good point, we can switch to that.
|
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 |
commit: 77eaa03 |
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 thatAlreadyOwnedErrorerrors 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
Needs Doc) and QA (Needs QA)?Tests
compare/*-oc.yml)?Config/Logging/Testability