Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
18 changes: 9 additions & 9 deletions Cargo.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions crate-hashes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This will need changes in our and upstream error types.
#![allow(clippy::result_large_err)]

use std::{os::unix::prelude::FileTypeExt, path::PathBuf};
use std::{future::Future, os::unix::prelude::FileTypeExt, path::PathBuf};

use anyhow::{Context, Ok, anyhow};
use clap::Parser;
Expand All @@ -24,7 +24,6 @@ use stackable_operator::{
telemetry::Tracing,
utils::signal::SignalWatcher,
};
use tokio::sync::oneshot;
use tokio_stream::wrappers::UnixListenerStream;
use tonic::transport::Server;
use utils::{TonicUnixStream, uds_bind_private};
Expand Down Expand Up @@ -209,6 +208,12 @@ async fn main() -> anyhow::Result<()> {
)
.await?;

// Here, we multiply the initial reconcile signal received by the oneshot receiver
// to be able to pass it to both the default custom resource deployer and to delay
// the startup of the controller.
let initial_reconcile_signal =
SignalWatcher::new(initial_reconcile_rx.map(|_| ()));

let webhook_server = webhook_server
.run(sigterm_watcher.handle())
.map_err(|err| anyhow!(err).context("failed to run webhook server"));
Expand All @@ -217,7 +222,7 @@ async fn main() -> anyhow::Result<()> {
.unwrap_or(operator_environment.operator_namespace.clone());

let default_secretclass = create_default_secretclass(
initial_reconcile_rx,
initial_reconcile_signal.handle(),
ca_secret_namespace,
client.clone(),
)
Expand All @@ -232,8 +237,13 @@ async fn main() -> anyhow::Result<()> {
)
.map(anyhow::Ok);

let delayed_truststore_controller = async {
let _ = initial_reconcile_signal.handle().await;
truststore_controller.await
};

try_join!(
truststore_controller,
delayed_truststore_controller,
default_secretclass,
webhook_server,
eos_checker,
Expand All @@ -247,11 +257,11 @@ async fn main() -> anyhow::Result<()> {
}

async fn create_default_secretclass(
initial_reconcile_rx: oneshot::Receiver<()>,
initial_reconcile_signal: impl Future<Output = ()>,
ca_secret_namespace: String,
client: Client,
) -> anyhow::Result<()> {
initial_reconcile_rx.await?;
initial_reconcile_signal.await;

tracing::info!("applying default secretclass");

Expand Down