File tree Expand file tree Collapse file tree
crates/stackable-operator/src/v2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,6 +97,22 @@ impl ResourceNames {
9797 . expect ( "should be a valid Service name" )
9898 }
9999
100+ pub fn metrics_service_name ( & self ) -> ServiceName {
101+ const SUFFIX : & str = "-metrics" ;
102+
103+ // compile-time checks
104+ const _: ( ) = assert ! (
105+ QualifiedRoleGroupName :: MAX_LENGTH + SUFFIX . len( ) <= ServiceName :: MAX_LENGTH ,
106+ "The string `<cluster_name>-<role_name>-<role_group_name>-metrics` must not exceed the \
107+ limit of Service names."
108+ ) ;
109+ let _ = QualifiedRoleGroupName :: IS_RFC_1035_LABEL_NAME ;
110+ let _ = QualifiedRoleGroupName :: IS_VALID_LABEL_VALUE ;
111+
112+ ServiceName :: from_str ( & format ! ( "{}{SUFFIX}" , self . qualified_role_group_name( ) ) )
113+ . expect ( "should be a valid Service name" )
114+ }
115+
100116 pub fn listener_name ( & self ) -> ListenerName {
101117 // compile-time checks
102118 const _: ( ) = assert ! (
@@ -145,6 +161,10 @@ mod tests {
145161 ServiceName :: from_str_unsafe( "test-cluster-data-nodes-ssd-storage-headless" ) ,
146162 resource_names. headless_service_name( )
147163 ) ;
164+ assert_eq ! (
165+ ServiceName :: from_str_unsafe( "test-cluster-data-nodes-ssd-storage-metrics" ) ,
166+ resource_names. metrics_service_name( )
167+ ) ;
148168 assert_eq ! (
149169 ListenerName :: from_str_unsafe( "test-cluster-data-nodes-ssd-storage" ) ,
150170 resource_names. listener_name( )
You can’t perform that action at this time.
0 commit comments