@@ -77,11 +77,11 @@ const MAX_PREPARE_LOG_FILE_SIZE: MemoryQuantity = MemoryQuantity {
7777
7878// Volume names. Each is shared between a `Volume`/PVC definition and one or more volume mounts; the
7979// strings must match, so they are defined once here rather than repeated at every call site.
80- const DATA_VOLUME_NAME : & str = "data" ;
81- const CONFIG_VOLUME_NAME : & str = "config" ;
82- const RW_CONFIG_VOLUME_NAME : & str = "rwconfig" ;
83- const LOG_VOLUME_NAME : & str = "log" ;
84- const LOG_CONFIG_VOLUME_NAME : & str = "log-config" ;
80+ stackable_operator :: constant! ( DATA_VOLUME_NAME : VolumeName = "data" ) ;
81+ stackable_operator :: constant! ( CONFIG_VOLUME_NAME : VolumeName = "config" ) ;
82+ stackable_operator :: constant! ( RW_CONFIG_VOLUME_NAME : VolumeName = "rwconfig" ) ;
83+ stackable_operator :: constant! ( LOG_VOLUME_NAME : VolumeName = "log" ) ;
84+ stackable_operator :: constant! ( LOG_CONFIG_VOLUME_NAME : VolumeName = "log-config" ) ;
8585
8686/// Name of the `prepare` init container (also used as its log subdirectory).
8787const PREPARE_CONTAINER_NAME : & str = "prepare" ;
@@ -182,7 +182,7 @@ pub fn build_server_rolegroup_statefulset(
182182 let data_pvc = resources_config
183183 . storage
184184 . data
185- . build_pvc ( DATA_VOLUME_NAME , Some ( vec ! [ "ReadWriteOnce" ] ) ) ;
185+ . build_pvc ( DATA_VOLUME_NAME . as_ref ( ) , Some ( vec ! [ "ReadWriteOnce" ] ) ) ;
186186 let original_pvcs = vec ! [ data_pvc] ;
187187 let resources: ResourceRequirements = resources_config. into ( ) ;
188188
@@ -250,13 +250,13 @@ pub fn build_server_rolegroup_statefulset(
250250 } ) ,
251251 ..EnvVar :: default ( )
252252 } ] )
253- . add_volume_mount ( DATA_VOLUME_NAME , STACKABLE_DATA_DIR )
253+ . add_volume_mount ( & * DATA_VOLUME_NAME , STACKABLE_DATA_DIR )
254254 . context ( AddVolumeMountSnafu ) ?
255- . add_volume_mount ( CONFIG_VOLUME_NAME , STACKABLE_CONFIG_DIR )
255+ . add_volume_mount ( & * CONFIG_VOLUME_NAME , STACKABLE_CONFIG_DIR )
256256 . context ( AddVolumeMountSnafu ) ?
257- . add_volume_mount ( RW_CONFIG_VOLUME_NAME , STACKABLE_RW_CONFIG_DIR )
257+ . add_volume_mount ( & * RW_CONFIG_VOLUME_NAME , STACKABLE_RW_CONFIG_DIR )
258258 . context ( AddVolumeMountSnafu ) ?
259- . add_volume_mount ( LOG_VOLUME_NAME , STACKABLE_LOG_DIR )
259+ . add_volume_mount ( & * LOG_VOLUME_NAME , STACKABLE_LOG_DIR )
260260 . context ( AddVolumeMountSnafu ) ?
261261 . resources (
262262 ResourceRequirementsBuilder :: new ( )
@@ -328,15 +328,15 @@ pub fn build_server_rolegroup_statefulset(
328328 )
329329 . add_container_port ( JMX_METRICS_PORT_NAME , i32:: from ( JMX_METRICS_PORT ) )
330330 . add_container_port ( METRICS_PROVIDER_HTTP_PORT_NAME , metrics_port. into ( ) )
331- . add_volume_mount ( DATA_VOLUME_NAME , STACKABLE_DATA_DIR )
331+ . add_volume_mount ( & * DATA_VOLUME_NAME , STACKABLE_DATA_DIR )
332332 . context ( AddVolumeMountSnafu ) ?
333- . add_volume_mount ( CONFIG_VOLUME_NAME , STACKABLE_CONFIG_DIR )
333+ . add_volume_mount ( & * CONFIG_VOLUME_NAME , STACKABLE_CONFIG_DIR )
334334 . context ( AddVolumeMountSnafu ) ?
335- . add_volume_mount ( LOG_CONFIG_VOLUME_NAME , STACKABLE_LOG_CONFIG_DIR )
335+ . add_volume_mount ( & * LOG_CONFIG_VOLUME_NAME , STACKABLE_LOG_CONFIG_DIR )
336336 . context ( AddVolumeMountSnafu ) ?
337- . add_volume_mount ( RW_CONFIG_VOLUME_NAME , STACKABLE_RW_CONFIG_DIR )
337+ . add_volume_mount ( & * RW_CONFIG_VOLUME_NAME , STACKABLE_RW_CONFIG_DIR )
338338 . context ( AddVolumeMountSnafu ) ?
339- . add_volume_mount ( LOG_VOLUME_NAME , STACKABLE_LOG_DIR )
339+ . add_volume_mount ( & * LOG_VOLUME_NAME , STACKABLE_LOG_DIR )
340340 . context ( AddVolumeMountSnafu ) ?
341341 . resources ( resources)
342342 . build ( ) ;
@@ -370,7 +370,7 @@ pub fn build_server_rolegroup_statefulset(
370370 } )
371371 . context ( AddVolumeSnafu ) ?
372372 . add_empty_dir_volume (
373- LOG_VOLUME_NAME ,
373+ & * LOG_VOLUME_NAME ,
374374 Some ( product_logging:: framework:: calculate_log_volume_size_limit (
375375 & [
376376 properties:: product_logging:: MAX_ZK_LOG_FILES_SIZE ,
@@ -408,17 +408,13 @@ pub fn build_server_rolegroup_statefulset(
408408 // parameterised at runtime via env vars that the `vector_container` injects. The validated
409409 // Vector log config is built up-front in the validate step.
410410 if let Some ( vector_log_config) = & rolegroup_config. config . logging . vector_container {
411- let config_volume_name = VolumeName :: from_str ( CONFIG_VOLUME_NAME )
412- . expect ( "CONFIG_VOLUME_NAME is a valid volume name" ) ;
413- let log_volume_name =
414- VolumeName :: from_str ( LOG_VOLUME_NAME ) . expect ( "LOG_VOLUME_NAME is a valid volume name" ) ;
415411 pod_builder. add_container ( vector_container (
416412 & VECTOR_CONTAINER_NAME ,
417413 resolved_product_image,
418414 vector_log_config,
419415 & resource_names,
420- & config_volume_name ,
421- & log_volume_name ,
416+ & CONFIG_VOLUME_NAME ,
417+ & LOG_VOLUME_NAME ,
422418 EnvVarSet :: new ( ) ,
423419 ) ) ;
424420 }
0 commit comments