@@ -76,11 +76,14 @@ use crate::{
7676 command:: create_init_container_command_args,
7777 config:: jvm:: { construct_non_heap_jvm_args, construct_zk_server_heap_env} ,
7878 crd:: {
79- DOCKER_IMAGE_BASE_NAME , JVM_SECURITY_PROPERTIES_FILE , MAX_PREPARE_LOG_FILE_SIZE ,
80- MAX_ZK_LOG_FILES_SIZE , METRICS_PORT , METRICS_PORT_NAME , METRICS_PROVIDER_HTTP_PORT ,
81- METRICS_PROVIDER_HTTP_PORT_KEY , STACKABLE_CONFIG_DIR , STACKABLE_DATA_DIR ,
79+ DOCKER_IMAGE_BASE_NAME , JMX_METRICS_PORT , JMX_METRICS_PORT_NAME ,
80+ JVM_SECURITY_PROPERTIES_FILE , MAX_PREPARE_LOG_FILE_SIZE , MAX_ZK_LOG_FILES_SIZE ,
81+ METRICS_PROVIDER_HTTP_PORT , METRICS_PROVIDER_HTTP_PORT_KEY ,
82+ METRICS_PROVIDER_HTTP_PORT_NAME , STACKABLE_CONFIG_DIR , STACKABLE_DATA_DIR ,
8283 STACKABLE_LOG_CONFIG_DIR , STACKABLE_LOG_DIR , STACKABLE_RW_CONFIG_DIR ,
83- ZOOKEEPER_ELECTION_PORT , ZOOKEEPER_LEADER_PORT , ZOOKEEPER_PROPERTIES_FILE , ZookeeperRole ,
84+ ZOOKEEPER_ELECTION_PORT , ZOOKEEPER_ELECTION_PORT_NAME , ZOOKEEPER_LEADER_PORT ,
85+ ZOOKEEPER_LEADER_PORT_NAME , ZOOKEEPER_PROPERTIES_FILE , ZOOKEEPER_SERVER_PORT_NAME ,
86+ ZookeeperRole ,
8487 security:: { self , ZookeeperSecurity } ,
8588 v1alpha1:: { self , ZookeeperServerRoleConfig } ,
8689 } ,
@@ -693,15 +696,13 @@ fn build_server_rolegroup_headless_service(
693696 cluster_ip : Some ( "None" . to_string ( ) ) ,
694697 ports : Some ( vec ! [
695698 ServicePort {
696- // TODO (@NickLarsenNZ): Use a const
697- name: Some ( "zk-leader" . to_string( ) ) ,
699+ name: Some ( ZOOKEEPER_LEADER_PORT_NAME . to_string( ) ) ,
698700 port: ZOOKEEPER_LEADER_PORT as i32 ,
699701 protocol: Some ( "TCP" . to_string( ) ) ,
700702 ..ServicePort :: default ( )
701703 } ,
702704 ServicePort {
703- // TODO (@NickLarsenNZ): Use a const
704- name: Some ( "zk-election" . to_string( ) ) ,
705+ name: Some ( ZOOKEEPER_ELECTION_PORT_NAME . to_string( ) ) ,
705706 port: ZOOKEEPER_ELECTION_PORT as i32 ,
706707 protocol: Some ( "TCP" . to_string( ) ) ,
707708 ..ServicePort :: default ( )
@@ -757,15 +758,14 @@ fn build_server_rolegroup_metrics_service(
757758 cluster_ip : Some ( "None" . to_string ( ) ) ,
758759 ports : Some ( vec ! [
759760 ServicePort {
760- name: Some ( METRICS_PORT_NAME . to_string( ) ) ,
761- port: METRICS_PORT . into ( ) ,
761+ name: Some ( JMX_METRICS_PORT_NAME . to_string( ) ) ,
762+ port: JMX_METRICS_PORT as i32 ,
762763 protocol: Some ( "TCP" . to_string( ) ) ,
763764 ..ServicePort :: default ( )
764765 } ,
765766 ServicePort {
766- // TODO (@NickLarsenNZ): Use a const: METRICS_PROVIDER_HTTP_PORT_NAME
767- name: Some ( "native-metrics" . to_string( ) ) ,
768- port: metrics_port_from_rolegroup_config( rolegroup_config) . into( ) ,
767+ name: Some ( METRICS_PROVIDER_HTTP_PORT_NAME . to_string( ) ) ,
768+ port: metrics_port_from_rolegroup_config( rolegroup_config) as i32 ,
769769 protocol: Some ( "TCP" . to_string( ) ) ,
770770 ..ServicePort :: default ( )
771771 } ,
@@ -983,13 +983,15 @@ fn build_server_rolegroup_statefulset(
983983 period_seconds : Some ( 1 ) ,
984984 ..Probe :: default ( )
985985 } )
986- // TODO (@NickLarsenNZ): Use consts for the port names (since they are used in multiple places)
987- . add_container_port ( "zk" , zookeeper_security. client_port ( ) . into ( ) )
988- . add_container_port ( "zk-leader" , ZOOKEEPER_LEADER_PORT as i32 )
989- . add_container_port ( "zk-election" , ZOOKEEPER_ELECTION_PORT as i32 )
990- . add_container_port ( "metrics" , 9505 )
991986 . add_container_port (
992- "native-metrics" ,
987+ ZOOKEEPER_SERVER_PORT_NAME ,
988+ zookeeper_security. client_port ( ) as i32 ,
989+ )
990+ . add_container_port ( ZOOKEEPER_LEADER_PORT_NAME , ZOOKEEPER_LEADER_PORT as i32 )
991+ . add_container_port ( ZOOKEEPER_ELECTION_PORT_NAME , ZOOKEEPER_ELECTION_PORT as i32 )
992+ . add_container_port ( JMX_METRICS_PORT_NAME , 9505 )
993+ . add_container_port (
994+ METRICS_PROVIDER_HTTP_PORT_NAME ,
993995 metrics_port_from_rolegroup_config ( server_config) . into ( ) ,
994996 )
995997 . add_volume_mount ( "data" , STACKABLE_DATA_DIR )
0 commit comments