Skip to content

Commit 3575263

Browse files
committed
fix: Allow multiple Airflows in the same namespace to use Kubernetes executors
1 parent ce469d2 commit 3575263

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
- Don't panic on invalid authorization config. Previously, a missing OPA ConfigMap would crash the operator ([#667]).
1212
- Fix OPA authorization for Airflow 3. Airflow 3 needs to be configured via env variables, the operator now does this correctly ([#668]).
13+
- Allow multiple Airflows in the same namespace to use Kubernetes executors.
14+
Previously, the operator would always use the same name for the executor Pod template ConfigMap.
15+
In case you had multiple Airflows, the two "fought" over writing to that ConfigMap.
1316

1417
[#667]: https://github.com/stackabletech/airflow-operator/pull/667
1518
[#668]: https://github.com/stackabletech/airflow-operator/pull/668

rust/operator-binary/src/airflow_controller.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ use crate::{
8888
AirflowConfigOptions, AirflowExecutor, AirflowRole, CONFIG_PATH, Container, ExecutorConfig,
8989
ExecutorConfigFragment, HTTP_PORT, HTTP_PORT_NAME, LISTENER_VOLUME_DIR,
9090
LISTENER_VOLUME_NAME, LOG_CONFIG_DIR, METRICS_PORT, METRICS_PORT_NAME, OPERATOR_NAME,
91-
STACKABLE_LOG_DIR, TEMPLATE_CONFIGMAP_NAME, TEMPLATE_LOCATION, TEMPLATE_NAME,
92-
TEMPLATE_VOLUME_NAME,
91+
STACKABLE_LOG_DIR, TEMPLATE_LOCATION, TEMPLATE_NAME, TEMPLATE_VOLUME_NAME,
9392
authentication::{
9493
AirflowAuthenticationClassResolved, AirflowClientAuthenticationDetailsResolved,
9594
},
@@ -1110,7 +1109,7 @@ fn build_server_rolegroup_statefulset(
11101109
if let AirflowExecutor::KubernetesExecutor { .. } = executor {
11111110
pb.add_volume(
11121111
VolumeBuilder::new(TEMPLATE_VOLUME_NAME)
1113-
.with_config_map(TEMPLATE_CONFIGMAP_NAME)
1112+
.with_config_map(airflow.executor_template_configmap_name())
11141113
.build(),
11151114
)
11161115
.context(AddVolumeSnafu)?;
@@ -1329,7 +1328,7 @@ fn build_executor_template_config_map(
13291328
.metadata(
13301329
ObjectMetaBuilder::new()
13311330
.name_and_namespace(airflow)
1332-
.name(TEMPLATE_CONFIGMAP_NAME)
1331+
.name(airflow.executor_template_configmap_name())
13331332
.ownerreference_from_resource(airflow, None, Some(true))
13341333
.context(ObjectMissingMetadataForOwnerRefSnafu)?
13351334
.with_recommended_labels(build_recommended_labels(

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ pub const AIRFLOW_HOME: &str = "/stackable/airflow";
7070
pub const AIRFLOW_CONFIG_FILENAME: &str = "webserver_config.py";
7171

7272
pub const TEMPLATE_VOLUME_NAME: &str = "airflow-executor-pod-template";
73-
pub const TEMPLATE_CONFIGMAP_NAME: &str = "airflow-executor-pod-template";
7473
pub const TEMPLATE_LOCATION: &str = "/templates";
7574
pub const TEMPLATE_NAME: &str = "airflow_executor_pod_template.yaml";
7675

@@ -379,6 +378,10 @@ impl v1alpha1::AirflowCluster {
379378
self.spec.cluster_config.volume_mounts.clone()
380379
}
381380

381+
pub fn executor_template_configmap_name(&self) -> String {
382+
format!("{}-executor-pod-template", self.name_any())
383+
}
384+
382385
/// Retrieve and merge resource configs for role and role groups
383386
pub fn merged_config(
384387
&self,

0 commit comments

Comments
 (0)