Skip to content

Commit

Permalink
Handle issue where DB secret already exists by requeueing and restart…
Browse files Browse the repository at this point in the history
…ing the flow (#157)
  • Loading branch information
orishoshan authored Sep 15, 2024
1 parent 78fe3f2 commit 185a6e5
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ func (e *Reconciler) ensurePodUserAndPasswordSecret(ctx context.Context, pod *v1
secret := buildUserAndPasswordCredentialsSecret(secretName, pod.Namespace, username, password)
log.WithField("secret", secretName).Debug("Creating new secret with user-password credentials")
if err := e.client.Create(ctx, secret); err != nil {
if apierrors.IsAlreadyExists(err) {
return ctrl.Result{Requeue: true}, false, "", nil
}
return ctrl.Result{}, false, "", errors.Wrap(err)
}
return ctrl.Result{}, true, password, nil
Expand Down

0 comments on commit 185a6e5

Please sign in to comment.