Skip to content

Commit 16432ac

Browse files
committed
consolidate service name
1 parent 3d8d7ca commit 16432ac

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

rust/operator-binary/src/history/history_controller.rs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -328,19 +328,20 @@ pub async fn reconcile(
328328
.add(client, sts)
329329
.await
330330
.context(ApplyStatefulSetSnafu)?;
331-
332-
let rg_group_listener = build_group_listener(
333-
shs,
334-
&resolved_product_image,
335-
&rgr,
336-
shs.node_listener_class().to_string(),
337-
)?;
338-
cluster_resources
339-
.add(client, rg_group_listener)
340-
.await
341-
.context(ApplyGroupListenerSnafu)?;
342331
}
343332

333+
let rg_group_listener = build_group_listener(
334+
shs,
335+
&resolved_product_image,
336+
&role_name,
337+
shs.node_listener_class().to_string(),
338+
)?;
339+
340+
cluster_resources
341+
.add(client, rg_group_listener)
342+
.await
343+
.context(ApplyGroupListenerSnafu)?;
344+
344345
let role_config = &shs.spec.nodes.role_config;
345346
add_pdbs(
346347
&role_config.common.pod_disruption_budget,
@@ -364,15 +365,12 @@ pub async fn reconcile(
364365
fn build_group_listener(
365366
shs: &v1alpha1::SparkHistoryServer,
366367
resolved_product_image: &ResolvedProductImage,
367-
rolegroup: &RoleGroupRef<v1alpha1::SparkHistoryServer>,
368+
role: &str,
368369
listener_class: String,
369370
) -> Result<listener::v1alpha1::Listener, Error> {
370-
let listener_name = rolegroup.object_name();
371-
let recommended_object_labels = labels(
372-
shs,
373-
&resolved_product_image.app_version_label,
374-
&rolegroup.role_group,
375-
);
371+
let listener_name = group_listener_name(shs, role);
372+
373+
let recommended_object_labels = labels(shs, &resolved_product_image.app_version_label, "none");
376374

377375
let listener_ports = [listener::v1alpha1::ListenerPort {
378376
name: "http".to_string(),
@@ -390,6 +388,10 @@ fn build_group_listener(
390388
.context(BuildListenerSnafu)
391389
}
392390

391+
fn group_listener_name(shs: &v1alpha1::SparkHistoryServer, role: &str) -> String {
392+
format!("{cluster}-{role}", cluster = shs.name_any())
393+
}
394+
393395
pub fn error_policy(
394396
_obj: Arc<DeserializeGuard<v1alpha1::SparkHistoryServer>>,
395397
error: &Error,
@@ -595,7 +597,7 @@ fn build_stateful_set(
595597
// cluster-internal) as the address should still be consistent.
596598
let volume_claim_templates = Some(vec![
597599
ListenerOperatorVolumeSourceBuilder::new(
598-
&ListenerReference::ListenerName(rolegroupref.object_name()),
600+
&ListenerReference::ListenerName(group_listener_name(shs, &rolegroupref.role)),
599601
&recommended_labels,
600602
)
601603
.context(BuildListenerVolumeSnafu)?

0 commit comments

Comments
 (0)