Skip to content

Commit 7fa7676

Browse files
nmarukovichhors
andauthored
K8SPG-532 add logs (#1128)
* K8SPG-532 add logs * fix error message * fix * fix --------- Co-authored-by: Viacheslav Sarzhan <[email protected]>
1 parent 56cbc36 commit 7fa7676

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: internal/controller/postgrescluster/pgbackrest.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,7 @@ func (r *Reconciler) reconcilePostgresClusterDataSource(ctx context.Context,
16081608
rootCA *pki.RootCertificateAuthority,
16091609
backupsSpecFound bool,
16101610
) error {
1611-
1611+
log := logging.FromContext(ctx).WithValues("reconcileResource", "clusterDataSource")
16121612
// grab cluster, namespaces and repo name information from the data source
16131613
sourceClusterName := dataSource.ClusterName
16141614
// if the data source name is empty then we're restoring in-place and use the current cluster
@@ -1699,6 +1699,10 @@ func (r *Reconciler) reconcilePostgresClusterDataSource(ctx context.Context,
16991699
client.ObjectKey{Name: sourceClusterName, Namespace: sourceClusterNamespace},
17001700
sourceCluster); err != nil {
17011701
if apierrors.IsNotFound(err) {
1702+
log.Error(err, "DataSource refers to a non-existent PostgresCluster",
1703+
"name", sourceClusterName,
1704+
"namespace", sourceClusterNamespace,
1705+
)
17021706
r.Recorder.Eventf(cluster, corev1.EventTypeWarning, "InvalidDataSource",
17031707
"PostgresCluster %q does not exist", sourceClusterName)
17041708
return nil

0 commit comments

Comments
 (0)