Skip to content

Commit 46eaa51

Browse files
committed
revert: remove headless worker service
1 parent 71f0b24 commit 46eaa51

3 files changed

Lines changed: 24 additions & 33 deletions

File tree

rust/operator-binary/src/controller.rs

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -500,19 +500,13 @@ pub async fn reconcile_trino(
500500
)
501501
.context(LabelBuildSnafu)?;
502502

503-
let rg_headless_service = if trino_role.requires_headless_service() {
504-
Some(
505-
build_rolegroup_headless_service(
506-
trino,
507-
&role_group_ref,
508-
role_group_service_recommended_labels.clone(),
509-
role_group_service_selector.clone().into(),
510-
)
511-
.context(ServiceConfigurationSnafu)?,
512-
)
513-
} else {
514-
None
515-
};
503+
let rg_headless_service = build_rolegroup_headless_service(
504+
trino,
505+
&role_group_ref,
506+
role_group_service_recommended_labels.clone(),
507+
role_group_service_selector.clone().into(),
508+
)
509+
.context(ServiceConfigurationSnafu)?;
516510

517511
let rg_metrics_service = build_rolegroup_metrics_service(
518512
trino,
@@ -552,14 +546,13 @@ pub async fn reconcile_trino(
552546
&rbac_sa.name_any(),
553547
)?;
554548

555-
if let Some(rg_headless_service) = rg_headless_service {
556-
cluster_resources
557-
.add(client, rg_headless_service)
558-
.await
559-
.with_context(|_| ApplyRoleGroupServiceSnafu {
560-
rolegroup: role_group_ref.clone(),
561-
})?;
562-
}
549+
cluster_resources
550+
.add(client, rg_headless_service)
551+
.await
552+
.with_context(|_| ApplyRoleGroupServiceSnafu {
553+
rolegroup: role_group_ref.clone(),
554+
})?;
555+
563556
cluster_resources
564557
.add(client, rg_metrics_service)
565558
.await
@@ -1206,13 +1199,6 @@ fn build_rolegroup_statefulset(
12061199
.service_account_name(sa_name)
12071200
.security_context(PodSecurityContextBuilder::new().fs_group(1000).build());
12081201

1209-
let service_name = if trino_role.requires_headless_service() {
1210-
Some(rolegroup_headless_service_name(
1211-
&role_group_ref.object_name(),
1212-
))
1213-
} else {
1214-
None
1215-
};
12161202
let mut pod_template = pod_builder.build_template();
12171203
pod_template.merge_from(role.config.pod_overrides.clone());
12181204
pod_template.merge_from(rolegroup.config.pod_overrides.clone());
@@ -1247,7 +1233,9 @@ fn build_rolegroup_statefulset(
12471233
),
12481234
..LabelSelector::default()
12491235
},
1250-
service_name,
1236+
service_name: Some(rolegroup_headless_service_name(
1237+
&role_group_ref.object_name(),
1238+
)),
12511239
template: pod_template,
12521240
volume_claim_templates: Some(persistent_volume_claims),
12531241
..StatefulSetSpec::default()

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,6 @@ impl TrinoRole {
427427
Self::Worker => None,
428428
}
429429
}
430-
431-
pub fn requires_headless_service(&self) -> bool {
432-
self == &Self::Coordinator
433-
}
434430
}
435431

436432
#[derive(

tests/templates/kuttl/listener/10-assert.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ spec:
6060
---
6161
apiVersion: v1
6262
kind: Service
63+
metadata:
64+
name: test-trino-worker-default-headless
65+
spec:
66+
type: ClusterIP # by trino op
67+
---
68+
apiVersion: v1
69+
kind: Service
6370
metadata:
6471
name: test-trino-worker-default-metrics
6572
spec:

0 commit comments

Comments
 (0)