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
  • Loading branch information
orishoshan committed Aug 25, 2024
1 parent 1786af1 commit 9cad447
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 9cad447

Please sign in to comment.