Skip to content

K8SPG-532 add logs #1128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/controller/postgrescluster/pgbackrest.go
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,7 @@ func (r *Reconciler) reconcilePostgresClusterDataSource(ctx context.Context,
rootCA *pki.RootCertificateAuthority,
backupsSpecFound bool,
) error {

log := logging.FromContext(ctx).WithValues("reconcileResource", "clusterDataSource")
// grab cluster, namespaces and repo name information from the data source
sourceClusterName := dataSource.ClusterName
// if the data source name is empty then we're restoring in-place and use the current cluster
Expand Down Expand Up @@ -1699,6 +1699,10 @@ func (r *Reconciler) reconcilePostgresClusterDataSource(ctx context.Context,
client.ObjectKey{Name: sourceClusterName, Namespace: sourceClusterNamespace},
sourceCluster); err != nil {
if apierrors.IsNotFound(err) {
log.Error(err, "DataSource refers to a non-existent PostgresCluster",
"name", sourceClusterName,
"namespace", sourceClusterNamespace,
)
r.Recorder.Eventf(cluster, corev1.EventTypeWarning, "InvalidDataSource",
"PostgresCluster %q does not exist", sourceClusterName)
return nil
Expand Down
Loading