openstack-k8s-operators / barbican-operator

Apache License 2.0
5 stars 24 forks source link

[OSPRH-9371] Fix VerifySecret so it requeues when necessary #149

Closed abays closed 2 months ago

abays commented 2 months ago

We've come to realize three things recently:

  1. Returning an error to the reconciler along with a RequeueAfter will cause the reconciler to abandon the explicit requeue and only consider the error [1].
  2. The VerifySecret function in lib-common was returning an error along with a requeue, thus contributing to the problem listed in item 1. [2]
  3. Also, the error VerifySecret was returning was not a "not found" error, but a generic k8s error -- so it wouldn't be properly handled by callers looking for a "not found" error. [3]

Now VerifySecret only returns a non-empty ctrl.Result{} if the Secret is missing, so let's handle that case in a separate if-clause. [4]

Jira: https://issues.redhat.com/browse/OSPRH-9371

[1] https://github.com/openstack-k8s-operators/keystone-operator/pull/459 [2] https://github.com/openstack-k8s-operators/lib-common/blob/ad3edb6e67ab738cfdbf4e2e78ac403784a08ab7/modules/common/secret/secret.go#L423-L425 [3] https://github.com/openstack-k8s-operators/lib-common/blob/ad3edb6e67ab738cfdbf4e2e78ac403784a08ab7/modules/common/secret/secret.go#L425 [4] https://github.com/openstack-k8s-operators/lib-common/blob/579da98fa7a62b70b43cdba92e82d6497afe8835/modules/common/secret/secret.go#L425-L427

openshift-ci[bot] commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abays, stuggi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/openstack-k8s-operators/barbican-operator/blob/main/OWNERS)~~ [abays,stuggi] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
abays commented 3 weeks ago

/cherry-pick 18.0.0-proposed

openshift-cherrypick-robot commented 3 weeks ago

@abays: #149 failed to apply on top of branch "18.0.0-proposed":

Applying: Fix VerifySecret so it requeues when necessary
Using index info to reconstruct a base tree...
M   api/go.mod
M   api/go.sum
M   controllers/barbicanapi_controller.go
M   go.mod
M   go.sum
Falling back to patching base and 3-way merge...
Auto-merging go.sum
CONFLICT (content): Merge conflict in go.sum
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
Auto-merging api/go.sum
Auto-merging api/go.mod
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Fix VerifySecret so it requeues when necessary
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
In response to [this](https://github.com/openstack-k8s-operators/barbican-operator/pull/149#issuecomment-2358498331): >/cherry-pick 18.0.0-proposed Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.