@@ -842,6 +842,10 @@ fn build_rolegroup_config_map(
842842 } )
843843}
844844
845+ pub fn rolegroup_service_name ( rolegroup : & RoleGroupRef < v1alpha1:: DruidCluster > ) -> String {
846+ format ! ( "{name}-metrics" , name = rolegroup. object_name( ) )
847+ }
848+
845849/// The rolegroup [`Service`] is a headless service that allows direct access to the instances of a certain rolegroup
846850///
847851/// This is mostly useful for internal communication between peers, or for clients that perform client-side load balancing.
@@ -860,7 +864,7 @@ fn build_rolegroup_service(
860864 Ok ( Service {
861865 metadata : ObjectMetaBuilder :: new ( )
862866 . name_and_namespace ( druid)
863- . name ( format ! ( "{name}-metrics" , name = rolegroup. object_name ( ) ) )
867+ . name ( rolegroup_service_name ( rolegroup) )
864868 . ownerreference_from_resource ( druid, None , Some ( true ) )
865869 . context ( ObjectMissingMetadataForOwnerRefSnafu ) ?
866870 . with_recommended_labels ( build_recommended_labels (
@@ -1260,10 +1264,7 @@ fn build_rolegroup_statefulset(
12601264 ) ,
12611265 ..LabelSelector :: default ( )
12621266 } ,
1263- service_name : Some ( format ! (
1264- "{name}-metrics" ,
1265- name = rolegroup_ref. object_name( )
1266- ) ) ,
1267+ service_name : Some ( rolegroup_service_name ( rolegroup_ref) ) ,
12671268 template : pod_template,
12681269 volume_claim_templates : pvcs,
12691270 ..StatefulSetSpec :: default ( )
0 commit comments