Skip to content

Commit b4be861

Browse files
committed
chore: move results backend and broker to clusterConfig
1 parent ce34efa commit b4be861

2 files changed

Lines changed: 19 additions & 17 deletions

File tree

rust/operator-binary/src/airflow_controller.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -393,23 +393,23 @@ pub async fn reconcile_airflow(
393393
.cluster_config
394394
.metadata_database
395395
.sqlalchemy_connection_details_with_templating("METADATA", &templating_mechanism);
396-
let celery_database_connection_details = match &airflow.spec.executor {
397-
AirflowExecutor::CeleryExecutors {
398-
result_backend: celery_result_backend,
399-
broker: celery_broker,
400-
..
401-
} => {
402-
let celery_result_backend = celery_result_backend
396+
397+
let celery_database_connection_details =
398+
if let (Some(celery_results_backend), Some(celery_broker)) = (
399+
&airflow.spec.cluster_config.celery_results_backend,
400+
&airflow.spec.cluster_config.celery_broker,
401+
) {
402+
let celery_results_backend = celery_results_backend
403403
.celery_connection_details_with_templating(
404404
"CELERY_RESULT_BACKEND",
405405
&templating_mechanism,
406406
);
407407
let celery_broker = celery_broker
408408
.celery_connection_details_with_templating("CELERY_BROKER", &templating_mechanism);
409-
Some((celery_result_backend, celery_broker))
410-
}
411-
_ => None,
412-
};
409+
Some((celery_results_backend, celery_broker))
410+
} else {
411+
None
412+
};
413413

414414
let mut roles = HashMap::new();
415415

rust/operator-binary/src/crd/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,14 @@ pub mod versioned {
309309
#[serde(default)]
310310
pub database_initialization: DatabaseInitializationConfig,
311311

312+
#[serde(skip_serializing_if = "Option::is_none")]
313+
/// Connection information for the celery backend database.
314+
pub celery_results_backend: Option<CeleryResultBackendConnection>,
315+
316+
#[serde(skip_serializing_if = "Option::is_none")]
317+
/// Connection information for the celery broker queue.
318+
pub celery_broker: Option<CeleryBrokerConnection>,
319+
312320
/// Name of the Vector aggregator [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery).
313321
/// It must contain the key `ADDRESS` with the address of the Vector aggregator.
314322
/// Follow the [logging tutorial](DOCS_BASE_URL_PLACEHOLDER/tutorials/logging-vector-aggregator)
@@ -857,12 +865,6 @@ pub enum AirflowExecutor {
857865
CeleryExecutors {
858866
#[serde(flatten)]
859867
config: Box<AirflowRoleType>,
860-
861-
/// Connection information for the celery backend database.
862-
result_backend: CeleryResultBackendConnection,
863-
864-
/// Connection information for the celery broker queue.
865-
broker: CeleryBrokerConnection,
866868
},
867869

868870
/// With the Kubernetes executor, executor Pods are created on demand.

0 commit comments

Comments
 (0)