Skip to content

Commit

Permalink
Merge pull request #149 from abays/fix_9371
Browse files Browse the repository at this point in the history
[OSPRH-9371] Fix VerifySecret so it requeues when necessary
  • Loading branch information
openshift-merge-bot[bot] authored Aug 9, 2024
2 parents bda570a + f6d79f2 commit 56b5125
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/onsi/ginkgo/v2 v2.19.1
github.com/onsi/gomega v1.34.1
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808054407-ac8a151e3cca
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808095747-579da98fa7a6
k8s.io/api v0.28.12
k8s.io/apimachinery v0.28.12
k8s.io/client-go v0.28.12
Expand Down
4 changes: 2 additions & 2 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ github.com/onsi/ginkgo/v2 v2.19.1 h1:QXgq3Z8Crl5EL1WBAC98A5sEBHARrAJNzAmMxzLcRF0
github.com/onsi/ginkgo/v2 v2.19.1/go.mod h1:O3DtEWQkPa/F7fBMgmZQKKsluAy8pd3rEQdrjkPb9zA=
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808054407-ac8a151e3cca h1:ymNDlXtzuatPd+Oj+hL2YULEbKVsbHbytO+6HDoPwm4=
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808054407-ac8a151e3cca/go.mod h1:hCT/Ba8kRkRB23d07YEsCzELsYcJGpD/Uw4NDh+LD6w=
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808095747-579da98fa7a6 h1:QrqPZPnJuJoYRFXL3aE4b+onLjjEUq8b3JjuptUkOoE=
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808095747-579da98fa7a6/go.mod h1:hCT/Ba8kRkRB23d07YEsCzELsYcJGpD/Uw4NDh+LD6w=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
17 changes: 9 additions & 8 deletions controllers/barbicanapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,24 @@ func (r *BarbicanAPIReconciler) getSecret(
expectedFields []string,
envVars *map[string]env.Setter,
) (ctrl.Result, error) {
Log := r.GetLogger(ctx)
hash, result, err := secret.VerifySecret(ctx, types.NamespacedName{Name: secretName, Namespace: instance.Namespace}, expectedFields, h.GetClient(), time.Second*10)
if err != nil {
if k8s_errors.IsNotFound(err) {
instance.Status.Conditions.Set(condition.FalseCondition(
condition.InputReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.InputReadyWaitingMessage))
return result, fmt.Errorf("OpenStack secret %s not found", secretName)
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.InputReadyCondition,
condition.ErrorReason,
condition.SeverityWarning,
condition.InputReadyErrorMessage,
err.Error()))
return ctrl.Result{}, err
} else if (result != ctrl.Result{}) {
Log.Info(fmt.Sprintf("OpenStack secret %s not found", secretName))
instance.Status.Conditions.Set(condition.FalseCondition(
condition.InputReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.InputReadyWaitingMessage))
return result, nil
}

// Add a prefix to the var name to avoid accidental collision with other non-secret
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/openstack-k8s-operators/barbican-operator/api v0.0.0-00010101000000-000000000000
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240806064941-b443f719b8b7
github.com/openstack-k8s-operators/keystone-operator/api v0.4.1-0.20240806171358-1c577c9ef576
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808054407-ac8a151e3cca
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808095747-579da98fa7a6
github.com/openstack-k8s-operators/lib-common/modules/storage v0.4.1-0.20240808054407-ac8a151e3cca
github.com/openstack-k8s-operators/lib-common/modules/test v0.4.1-0.20240808054407-ac8a151e3cca
github.com/openstack-k8s-operators/mariadb-operator/api v0.4.1-0.20240806091527-f02e6eab246b
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240806064941-b
github.com/openstack-k8s-operators/infra-operator/apis v0.4.1-0.20240806064941-b443f719b8b7/go.mod h1:dobs750SWnLGGP8Z1Y6Rn4uRU/a9PkKaklKlcE7kIVA=
github.com/openstack-k8s-operators/keystone-operator/api v0.4.1-0.20240806171358-1c577c9ef576 h1:9XTSwNHHfjamTID0YMgK/Mb/x6oItdUl0OFXuUqGdIk=
github.com/openstack-k8s-operators/keystone-operator/api v0.4.1-0.20240806171358-1c577c9ef576/go.mod h1:nAeWBizvWIMtbHEAzmIupqADriOF92V8MOox6doWupA=
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808054407-ac8a151e3cca h1:ymNDlXtzuatPd+Oj+hL2YULEbKVsbHbytO+6HDoPwm4=
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808054407-ac8a151e3cca/go.mod h1:hCT/Ba8kRkRB23d07YEsCzELsYcJGpD/Uw4NDh+LD6w=
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808095747-579da98fa7a6 h1:QrqPZPnJuJoYRFXL3aE4b+onLjjEUq8b3JjuptUkOoE=
github.com/openstack-k8s-operators/lib-common/modules/common v0.4.1-0.20240808095747-579da98fa7a6/go.mod h1:hCT/Ba8kRkRB23d07YEsCzELsYcJGpD/Uw4NDh+LD6w=
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.4.1-0.20240808054407-ac8a151e3cca h1:KuNnvh3MEQ4tgG7X9k2wWC7uFVwE1lOqRBAaaJ0+WHQ=
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.4.1-0.20240808054407-ac8a151e3cca/go.mod h1:Z9QhWZexP9fYcZrBRI5rrcRwTh6LSsd5XB7NWzdphaE=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.4.1-0.20240808054407-ac8a151e3cca h1:QCHc/473ywfiABLVSlhw5DEK6XpqH8tCdem88KRZXtA=
Expand Down

0 comments on commit 56b5125

Please sign in to comment.