@@ -621,55 +621,48 @@ fn build_node_rolegroup_service(
621621 resolved_product_image : & ResolvedProductImage ,
622622 rolegroup : & RoleGroupRef < SupersetCluster > ,
623623) -> Result < Service > {
624- Ok ( Service {
625- metadata : ObjectMetaBuilder :: new ( )
626- . name_and_namespace ( superset)
627- . name ( rolegroup. object_name ( ) )
628- . ownerreference_from_resource ( superset, None , Some ( true ) )
629- . context ( ObjectMissingMetadataForOwnerRefSnafu ) ?
630- . with_recommended_labels ( build_recommended_labels (
631- superset,
632- SUPERSET_CONTROLLER_NAME ,
633- & resolved_product_image. app_version_label ,
634- & rolegroup. role ,
635- & rolegroup. role_group ,
636- ) )
637- . context ( MetadataBuildSnafu ) ?
638- . with_label ( Label :: try_from ( ( "prometheus.io/scrape" , "true" ) ) . context ( LabelBuildSnafu ) ?)
639- . build ( ) ,
640- spec : Some ( ServiceSpec {
641- // Internal communication does not need to be exposed
642- type_ : Some ( "ClusterIP" . to_owned ( ) ) ,
643- cluster_ip : Some ( "None" . to_owned ( ) ) ,
644- ports : Some ( vec ! [
645- ServicePort {
646- name: Some ( APP_PORT_NAME . to_owned( ) ) ,
647- port: APP_PORT . into( ) ,
648- protocol: Some ( "TCP" . to_owned( ) ) ,
649- ..ServicePort :: default ( )
650- } ,
651- ServicePort {
652- name: Some ( METRICS_PORT_NAME . to_owned( ) ) ,
653- port: METRICS_PORT . into( ) ,
654- protocol: Some ( "TCP" . to_owned( ) ) ,
655- ..ServicePort :: default ( )
656- } ,
657- ] ) ,
658- selector : Some (
659- Labels :: role_group_selector (
660- superset,
661- APP_NAME ,
662- & rolegroup. role ,
663- & rolegroup. role_group ,
664- )
624+ let metadata = ObjectMetaBuilder :: new ( )
625+ . name_and_namespace ( superset)
626+ . name ( format ! ( "{name}-metrics" , name = rolegroup. object_name( ) ) )
627+ . ownerreference_from_resource ( superset, None , Some ( true ) )
628+ . context ( ObjectMissingMetadataForOwnerRefSnafu ) ?
629+ . with_recommended_labels ( build_recommended_labels (
630+ superset,
631+ SUPERSET_CONTROLLER_NAME ,
632+ & resolved_product_image. app_version_label ,
633+ & rolegroup. role ,
634+ & rolegroup. role_group ,
635+ ) )
636+ . context ( MetadataBuildSnafu ) ?
637+ . with_label ( Label :: try_from ( ( "prometheus.io/scrape" , "true" ) ) . context ( LabelBuildSnafu ) ?)
638+ . build ( ) ;
639+
640+ let spec = Some ( ServiceSpec {
641+ // Internal communication does not need to be exposed
642+ type_ : Some ( "ClusterIP" . to_owned ( ) ) ,
643+ cluster_ip : Some ( "None" . to_owned ( ) ) ,
644+ ports : Some ( vec ! [ ServicePort {
645+ name: Some ( METRICS_PORT_NAME . to_owned( ) ) ,
646+ port: METRICS_PORT . into( ) ,
647+ protocol: Some ( "TCP" . to_owned( ) ) ,
648+ ..ServicePort :: default ( )
649+ } ] ) ,
650+ selector : Some (
651+ Labels :: role_group_selector ( superset, APP_NAME , & rolegroup. role , & rolegroup. role_group )
665652 . context ( LabelBuildSnafu ) ?
666653 . into ( ) ,
667- ) ,
668- publish_not_ready_addresses : Some ( true ) ,
669- ..ServiceSpec :: default ( )
670- } ) ,
654+ ) ,
655+ publish_not_ready_addresses : Some ( true ) ,
656+ ..ServiceSpec :: default ( )
657+ } ) ;
658+
659+ let service = Service {
660+ metadata,
661+ spec,
671662 status : None ,
672- } )
663+ } ;
664+
665+ Ok ( service)
673666}
674667
675668pub fn build_group_listener (
0 commit comments