Skip to content

Commit f24849e

Browse files
committed
adjustsments on the logic
1 parent 6c9d857 commit f24849e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

internal/controller/postgrescluster/postgres.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"bytes"
99
"context"
1010
"fmt"
11+
log "github.com/sirupsen/logrus"
1112
"io"
1213
"net"
1314
"net/url"
@@ -60,6 +61,8 @@ func (r *Reconciler) generatePostgresUserSecret(
6061
intent.SetGroupVersionKind(corev1.SchemeGroupVersion.WithKind("Secret"))
6162
initialize.Map(&intent.Data)
6263

64+
log.Info("User existing secret:", "secret", existing)
65+
6366
// Populate the Secret with libpq keywords for connecting through
6467
// the primary Service.
6568
// - https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
@@ -583,17 +586,15 @@ func (r *Reconciler) reconcilePostgresUserSecrets(
583586

584587
if err == nil {
585588
userSecrets[userName], err = r.generatePostgresUserSecret(cluster, user, secret)
586-
}
587-
if err == nil {
588589
err = errors.WithStack(r.apply(ctx, userSecrets[userName]))
589590
}
590591
}
591592

592593
return specUsers, userSecrets, err
593594
}
594595

595-
// updateCustomSecretLabels checks if a custom secret exists and updates it
596-
// with required labels if they are missing that enabled the
596+
// updateCustomSecretLabels checks if a custom secret exists - can be created manually through kubectl apply
597+
// and updates it with required labels if they are missing that enabled the
597598
// naming.AsSelector(naming.ClusterPostgresUsers(cluster.Name)) to identify them.
598599
func (r *Reconciler) updateCustomSecretLabels(
599600
ctx context.Context, cluster *v1beta1.PostgresCluster, user v1beta1.PostgresUserSpec,

0 commit comments

Comments
 (0)