Skip to content

Commit

Permalink
Wait for store to be ready before running controller reconcilers
Browse files Browse the repository at this point in the history
  • Loading branch information
nightkr committed Jul 5, 2023
1 parent 14e84ee commit 6752a9b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kube-runtime/src/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ where
let (scheduler_tx, scheduler_rx) =
channel::mpsc::channel::<ScheduleRequest<ReconcileRequest<K>>>(APPLIER_REQUEUE_BUF_SIZE);
let error_policy = Arc::new(error_policy);
let delay_store = store.clone();
// Create a stream of ObjectRefs that need to be reconciled
trystream_try_via(
// input: stream combining scheduled tasks and user specified inputs event
Expand Down Expand Up @@ -319,6 +320,11 @@ where
None => future::err(Error::ObjectNotFound(request.obj_ref.erase())).right_future(),
}
})
.delay_tasks_until(async move {
tracing::debug!("applier runner held until store is ready");
delay_store.wait_until_ready().await;

Check warning on line 325 in kube-runtime/src/controller/mod.rs

View workflow job for this annotation

GitHub Actions / msrv

unused `std::result::Result` that must be used
tracing::debug!("store is ready, starting runner");
})
.on_complete(async { tracing::debug!("applier runner terminated") })
},
)
Expand Down

0 comments on commit 6752a9b

Please sign in to comment.