@@ -10,6 +10,7 @@ use kube::runtime::events::{Recorder, Reporter};
1010use crate :: { controllers:: jobs:: CallbackStore , metrics:: Metrics } ;
1111
1212pub const DEFAULT_KOPIA_IMAGE : & str = "kopia/kopia:0.22.3" ;
13+ pub const DEFAULT_DEPLOYMENT_READY_TIMEOUT_SECS : u64 = 30 * 60 ;
1314
1415pub struct Context {
1516 pub client : Client ,
@@ -27,6 +28,12 @@ pub struct Context {
2728 /// Base URL the operator is reachable at from within the cluster,
2829 /// e.g. `http://postgres-restore-operator.pgro-system.svc:8080`.
2930 pub callback_base_url : String ,
31+ /// Seconds to wait for a restore's postgres Deployment to become Ready
32+ /// after the kopia restore Job completes, before marking the restore
33+ /// Failed. Configurable via the `DEPLOYMENT_READY_TIMEOUT_SECS` env
34+ /// var so it can be raised for replicas with large data dirs (slower
35+ /// WAL replay) without needing a code release.
36+ pub deployment_ready_timeout_secs : u64 ,
3037 /// Unix timestamp of the last successful entry into a reconcile function.
3138 /// Used by `/livez` to detect a stuck reconciliation loop.
3239 pub last_reconcile : Arc < AtomicI64 > ,
@@ -39,6 +46,7 @@ impl Context {
3946 kopia_image : String ,
4047 use_port_forward : bool ,
4148 callback_base_url : String ,
49+ deployment_ready_timeout_secs : u64 ,
4250 ) -> Self {
4351 let reporter = Reporter :: from ( "postgres-restore-operator" ) ;
4452 let recorder = Recorder :: new ( client. clone ( ) , reporter) ;
@@ -55,6 +63,7 @@ impl Context {
5563 snapshot_results : Arc :: new ( CallbackStore :: default ( ) ) ,
5664 schema_migration_results : Arc :: new ( CallbackStore :: default ( ) ) ,
5765 callback_base_url,
66+ deployment_ready_timeout_secs,
5867 last_reconcile : Arc :: new ( AtomicI64 :: new ( Timestamp :: now ( ) . as_second ( ) ) ) ,
5968 }
6069 }
0 commit comments