Skip to content

Commit f0ed7f5

Browse files
tadjik1egegunes
andauthored
K8SPSMDB-1035: Allow empty secretName for backup jobs (#1377)
* Allow empty secretName for backup jobs * gofmt --------- Co-authored-by: Ege Güneş <ege.gunes@percona.com>
1 parent 4b6c1c9 commit f0ed7f5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pkg/controller/perconaservermongodb/backup.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,14 +386,16 @@ func (r *ReconcilePerconaServerMongoDB) updatePITR(ctx context.Context, cr *api.
386386
secretName = storage.Azure.CredentialsSecret
387387
}
388388

389-
exists, err := secretExists(ctx, r.client, types.NamespacedName{Name: secretName, Namespace: cr.Namespace})
390-
if err != nil {
391-
return errors.Wrap(err, "check storage credentials secret")
392-
}
389+
if secretName != "" {
390+
exists, err := secretExists(ctx, r.client, types.NamespacedName{Name: secretName, Namespace: cr.Namespace})
391+
if err != nil {
392+
return errors.Wrap(err, "check storage credentials secret")
393+
}
393394

394-
if !exists {
395-
log.Error(nil, "Storage credentials secret does not exist", "secret", secretName)
396-
return nil
395+
if !exists {
396+
log.Error(nil, "Storage credentials secret does not exist", "secret", secretName)
397+
return nil
398+
}
397399
}
398400

399401
err = pbm.SetConfig(ctx, r.client, cr, storage)

0 commit comments

Comments
 (0)