Skip to content

Commit 4d4c560

Browse files
authored
fix: Delay controller startup to avoid 404 in initial list (#756)
* fix: Delay controller startup to avoid 404 in initial list * chore: Add changelog entry
1 parent 151ed3a commit 4d4c560

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
### Fixed
2020

21+
- Fix "404 page not found" error for the initial object list ([#756]).
2122
- Default `API_WORKERS` to 1 (instead of letting Airflow default to 4) to prevent crashloop and update/correct docs to reflect this ([#727]).
2223
- Prevent unnecessary Pod restarts when initially creating an AirflowCluster.
2324
This is achieved by applying the StatefulSet after all ConfigMaps and Secrets that it mounts ([#734]).
@@ -30,6 +31,7 @@
3031
[#741]: https://github.com/stackabletech/airflow-operator/pull/741
3132
[#742]: https://github.com/stackabletech/airflow-operator/pull/742
3233
[#752]: https://github.com/stackabletech/airflow-operator/pull/752
34+
[#756]: https://github.com/stackabletech/airflow-operator/pull/756
3335

3436
## [25.11.0] - 2025-11-07
3537

rust/operator-binary/src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async fn main() -> anyhow::Result<()> {
192192
)
193193
.map(anyhow::Ok);
194194

195-
let webhook_server = create_webhook_server(
195+
let (webhook_server, initial_reconcile_rx) = create_webhook_server(
196196
&operator_environment,
197197
maintenance.disable_crd_maintenance,
198198
client.as_kube_client(),
@@ -203,7 +203,12 @@ async fn main() -> anyhow::Result<()> {
203203
.run(sigterm_watcher.handle())
204204
.map_err(|err| anyhow!(err).context("failed to run webhook server"));
205205

206-
futures::try_join!(airflow_controller, webhook_server, eos_checker)?;
206+
let delayed_airflow_controller = async {
207+
let _ = initial_reconcile_rx.await;
208+
airflow_controller.await
209+
};
210+
211+
futures::try_join!(delayed_airflow_controller, webhook_server, eos_checker)?;
207212
}
208213
}
209214

rust/operator-binary/src/webhooks/conversion.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use stackable_operator::{
77
webhooks::{ConversionWebhook, ConversionWebhookOptions},
88
},
99
};
10+
use tokio::sync::oneshot;
1011

1112
use crate::crd::{AirflowCluster, AirflowClusterVersion, FIELD_MANAGER};
1213

@@ -26,7 +27,7 @@ pub async fn create_webhook_server(
2627
operator_environment: &OperatorEnvironmentOptions,
2728
disable_crd_maintenance: bool,
2829
client: Client,
29-
) -> Result<WebhookServer, Error> {
30+
) -> Result<(WebhookServer, oneshot::Receiver<()>), Error> {
3031
let crds_and_handlers = vec![(
3132
AirflowCluster::merged_crd(AirflowClusterVersion::V1Alpha2).context(MergeCrdSnafu)?,
3233
AirflowCluster::try_convert,
@@ -37,7 +38,7 @@ pub async fn create_webhook_server(
3738
field_manager: FIELD_MANAGER.to_owned(),
3839
};
3940

40-
let (conversion_webhook, _initial_reconcile_rx) =
41+
let (conversion_webhook, initial_reconcile_rx) =
4142
ConversionWebhook::new(crds_and_handlers, client, conversion_webhook_options);
4243

4344
let webhook_server_options = WebhookServerOptions {
@@ -46,7 +47,10 @@ pub async fn create_webhook_server(
4647
webhook_service_name: operator_environment.operator_service_name.to_owned(),
4748
};
4849

49-
WebhookServer::new(vec![Box::new(conversion_webhook)], webhook_server_options)
50-
.await
51-
.context(CreateWebhookSnafu)
50+
let webhook_server =
51+
WebhookServer::new(vec![Box::new(conversion_webhook)], webhook_server_options)
52+
.await
53+
.context(CreateWebhookSnafu)?;
54+
55+
Ok((webhook_server, initial_reconcile_rx))
5256
}

0 commit comments

Comments
 (0)