Skip to content

Commit

Permalink
Merge pull request #602 from abays/fix_verify_secret
Browse files Browse the repository at this point in the history
Fix VerifySecret so it properly requeues when necessary
  • Loading branch information
openshift-merge-bot[bot] authored Aug 8, 2024
2 parents 16470c3 + 6e4343d commit 6fd33f8
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions controllers/glance_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ package controllers
import (
"context"
"fmt"
"time"

"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
oko_secret "github.com/openstack-k8s-operators/lib-common/modules/common/secret"
"k8s.io/apimachinery/pkg/types"
"time"

glancev1 "github.com/openstack-k8s-operators/glance-operator/api/v1beta1"
"github.com/openstack-k8s-operators/glance-operator/pkg/glance"
Expand Down Expand Up @@ -81,23 +82,23 @@ func ensureSecret(

hash, res, err := oko_secret.VerifySecret(ctx, secretName, expectedFields, reader, requeueTimeout)
if err != nil {
if k8s_errors.IsNotFound(err) {
log.FromContext(ctx).Info(fmt.Sprintf("OpenStack secret %s not found", secretName))
conditionUpdater.Set(condition.FalseCondition(
condition.InputReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.InputReadyWaitingMessage))
return "", glance.ResultRequeue, nil
}
conditionUpdater.Set(condition.FalseCondition(
condition.InputReadyCondition,
condition.ErrorReason,
condition.SeverityWarning,
condition.InputReadyErrorMessage,
err.Error()))
return "", res, err
} else if (res != ctrl.Result{}) {
log.FromContext(ctx).Info(fmt.Sprintf("OpenStack secret %s not found", secretName))
conditionUpdater.Set(condition.FalseCondition(
condition.InputReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
condition.InputReadyWaitingMessage))
return "", res, nil
}

return hash, ctrl.Result{}, nil
}

Expand Down

0 comments on commit 6fd33f8

Please sign in to comment.