@@ -9,7 +9,7 @@ use stackable_operator::{
99
1010use crate :: controller:: {
1111 OpaRoleGroupConfig , RoleGroupName , ValidatedCluster ,
12- build:: properties:: { ConfigFileName , config_json, user_info_fetcher} ,
12+ build:: properties:: { ConfigFileName , config_json, product_logging , user_info_fetcher} ,
1313} ;
1414
1515#[ derive( Snafu , Debug ) ]
@@ -32,13 +32,12 @@ type Result<T, E = Error> = std::result::Result<T, E>;
3232/// The rolegroup [`ConfigMap`] configures the rolegroup based on the configuration given by the
3333/// administrator.
3434///
35- /// `vector_config` is the Vector agent config (`vector.yaml`) built by the caller; it is `None`
36- /// when the Vector agent is disabled .
35+ /// The Vector agent config (`vector.yaml`) is added only when the Vector agent is enabled for this
36+ /// role group .
3737pub fn build_rolegroup_config_map (
3838 cluster : & ValidatedCluster ,
3939 role_group_name : & RoleGroupName ,
4040 rolegroup_config : & OpaRoleGroupConfig ,
41- vector_config : Option < String > ,
4241) -> Result < ConfigMap > {
4342 let mut cm_builder = ConfigMapBuilder :: new ( ) ;
4443
@@ -65,8 +64,11 @@ pub fn build_rolegroup_config_map(
6564 ) ;
6665 }
6766
68- if let Some ( vector_config) = vector_config {
69- cm_builder. add_data ( VECTOR_CONFIG_FILE , vector_config) ;
67+ if rolegroup_config. config . logging . vector_container . is_some ( ) {
68+ cm_builder. add_data (
69+ VECTOR_CONFIG_FILE ,
70+ product_logging:: vector_config_file_content ( ) ,
71+ ) ;
7072 }
7173
7274 cm_builder. build ( ) . with_context ( |_| AssembleSnafu {
@@ -93,7 +95,7 @@ mod tests {
9395 . next ( )
9496 . expect ( "the default role group should exist" ) ;
9597
96- build_rolegroup_config_map ( & validated, role_group_name, rg, None )
98+ build_rolegroup_config_map ( & validated, role_group_name, rg)
9799 . expect ( "the config map should build" )
98100 }
99101
0 commit comments