Skip to content

Commit f72003f

Browse files
committed
feat(canopy): forward fail_restore reason to RestoreVerification.error
fail_restore now takes a short reason string. Each call site supplies what actually went wrong (kopia Job failed after backoff, version detection Job failed, deployment not Ready within timeout, etc.), and the canopy verification target passes it to canopy in the RestoreVerification's `error` field. Operators see the reason on canopy's UI without having to trawl the operator's k8s events.
1 parent 8381961 commit f72003f

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/controllers/restore.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ async fn fail_restore(
224224
name: &str,
225225
replica_name: &str,
226226
status_patch: serde_json::Value,
227+
error: &str,
227228
) -> Result<Action> {
228229
update_restore_status(&ctx.client, namespace, name, status_patch).await?;
229230

@@ -297,10 +298,8 @@ async fn fail_restore(
297298
}
298299

299300
// Canopy verification (signal 3, failure) — no-op unless the replica
300-
// has spec.canopy_source. The status_patch usually carries an error
301-
// message on `.status.conditions[?type=='RestoreFailed'].message`, but
302-
// we don't have it in a stable spot here; keep the report to
303-
// outcome+snapshot for now.
301+
// has spec.canopy_source. The caller passes a short reason so
302+
// operators see it on canopy's UI without having to trawl k8s events.
304303
let restores: Api<PostgresPhysicalRestore> = Api::namespaced(ctx.client.clone(), namespace);
305304
if let (Ok(restore), Ok(replica)) = (restores.get(name).await, replicas.get(replica_name).await)
306305
{
@@ -309,7 +308,7 @@ async fn fail_restore(
309308
&replica,
310309
&restore,
311310
bestool_canopy::Outcome::Failure,
312-
None,
311+
Some(error),
313312
)
314313
.await;
315314
}
@@ -592,6 +591,7 @@ async fn reconcile_restoring(
592591
"phase": "Failed",
593592
},
594593
}),
594+
"kopia restore Job failed after backoff exhausted",
595595
)
596596
.await;
597597
}
@@ -819,6 +819,7 @@ async fn reconcile_ready(
819819
name,
820820
replica_name,
821821
serde_json::json!({ "phase": "Failed" }),
822+
"version detection Job succeeded but did not report a postgres version",
822823
)
823824
.await;
824825
}
@@ -838,6 +839,7 @@ async fn reconcile_ready(
838839
name,
839840
replica_name,
840841
serde_json::json!({ "phase": "Failed" }),
842+
"version detection Job failed after backoff exhausted",
841843
)
842844
.await;
843845
}
@@ -906,6 +908,10 @@ async fn reconcile_ready(
906908
name,
907909
replica_name,
908910
serde_json::json!({ "phase": "Failed" }),
911+
&format!(
912+
"postgres Deployment did not become Ready within {timeout_secs}s of \
913+
restore completion"
914+
),
909915
)
910916
.await;
911917
}

0 commit comments

Comments
 (0)