Skip to content

Commit 399405f

Browse files
authored
Fix: headless svc for all roles as connection requires (#653)
* first working fix * Cleanup outdated comments and code
1 parent bce919d commit 399405f

File tree

2 files changed

+18
-27
lines changed

2 files changed

+18
-27
lines changed

rust/operator-binary/src/airflow_controller.rs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -514,23 +514,20 @@ pub async fn reconcile_airflow(
514514
)
515515
.context(LabelBuildSnafu)?;
516516

517-
// Only apply headless service for something exposing an HTTP port
518-
if airflow_role.get_http_port().is_some() {
519-
let rg_headless_service = build_rolegroup_headless_service(
520-
airflow,
521-
&rolegroup,
522-
role_group_service_recommended_labels.clone(),
523-
role_group_service_selector.clone().into(),
524-
)
525-
.context(ServiceConfigurationSnafu)?;
517+
let rg_headless_service = build_rolegroup_headless_service(
518+
airflow,
519+
&rolegroup,
520+
role_group_service_recommended_labels.clone(),
521+
role_group_service_selector.clone().into(),
522+
)
523+
.context(ServiceConfigurationSnafu)?;
526524

527-
cluster_resources
528-
.add(client, rg_headless_service)
529-
.await
530-
.context(ApplyRoleGroupServiceSnafu {
531-
rolegroup: rolegroup.clone(),
532-
})?;
533-
}
525+
cluster_resources
526+
.add(client, rg_headless_service)
527+
.await
528+
.context(ApplyRoleGroupServiceSnafu {
529+
rolegroup: rolegroup.clone(),
530+
})?;
534531

535532
let rg_metrics_service = build_rolegroup_metrics_service(
536533
airflow,
@@ -1158,7 +1155,7 @@ fn build_server_rolegroup_statefulset(
11581155
match_labels: Some(statefulset_match_labels.into()),
11591156
..LabelSelector::default()
11601157
},
1161-
service_name: stateful_set_service_name(airflow_role, rolegroup_ref),
1158+
service_name: stateful_set_service_name(rolegroup_ref),
11621159
template: pod_template,
11631160
volume_claim_templates: pvcs,
11641161
..StatefulSetSpec::default()

rust/operator-binary/src/service.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ use stackable_operator::{
88
role_utils::RoleGroupRef,
99
};
1010

11-
use crate::crd::{
12-
AirflowRole, HTTP_PORT, HTTP_PORT_NAME, METRICS_PORT, METRICS_PORT_NAME, v1alpha1,
13-
};
11+
use crate::crd::{HTTP_PORT, HTTP_PORT_NAME, METRICS_PORT, METRICS_PORT_NAME, v1alpha1};
1412

1513
pub const METRICS_SERVICE_SUFFIX: &str = "metrics";
1614
pub const HEADLESS_SERVICE_SUFFIX: &str = "headless";
@@ -111,15 +109,11 @@ pub fn build_rolegroup_metrics_service(
111109
}
112110

113111
pub fn stateful_set_service_name(
114-
airflow_role: &AirflowRole,
115112
rolegroup_ref: &RoleGroupRef<v1alpha1::AirflowCluster>,
116113
) -> Option<String> {
117-
match airflow_role {
118-
AirflowRole::Webserver => Some(rolegroup_headless_service_name(
119-
&rolegroup_ref.object_name(),
120-
)),
121-
AirflowRole::Scheduler | AirflowRole::Worker => None,
122-
}
114+
Some(rolegroup_headless_service_name(
115+
&rolegroup_ref.object_name(),
116+
))
123117
}
124118

125119
/// Returns the metrics rolegroup service name `<cluster>-<role>-<rolegroup>-<METRICS_SERVICE_SUFFIX>`.

0 commit comments

Comments
 (0)