@@ -40,18 +40,17 @@ use stackable_operator::{
4040 product_logging:: {
4141 self ,
4242 framework:: { create_vector_shutdown_file_command, remove_vector_shutdown_file_command} ,
43- spec:: {
44- AppenderConfig , AutomaticContainerLogConfig , ContainerLogConfig ,
45- ContainerLogConfigChoice , LogLevel ,
46- } ,
43+ spec:: { AppenderConfig , AutomaticContainerLogConfig , LogLevel } ,
4744 } ,
4845 utils:: { COMMON_BASH_TRAP_FUNCTIONS , cluster_info:: KubernetesClusterInfo } ,
4946 v2:: {
5047 builder:: {
5148 meta:: ownerreference_from_resource,
5249 pod:: container:: { EnvVarSet , new_container_builder} ,
5350 } ,
54- product_logging:: framework:: { STACKABLE_LOG_DIR , vector_container} ,
51+ product_logging:: framework:: {
52+ STACKABLE_LOG_DIR , ValidatedContainerLogConfigChoice , vector_container,
53+ } ,
5554 types:: {
5655 common:: Port ,
5756 kubernetes:: { ContainerName , VolumeName } ,
@@ -61,8 +60,10 @@ use stackable_operator::{
6160
6261use super :: service:: { self , APP_PORT , APP_PORT_NAME } ;
6362use crate :: {
64- controller:: { RoleGroupName , ValidatedCluster , ValidatedRoleGroup , build} ,
65- crd:: { Container , DEFAULT_SERVER_GRACEFUL_SHUTDOWN_TIMEOUT , OpaConfig , user_info_fetcher} ,
63+ controller:: {
64+ OpaRoleGroupConfig , RoleGroupName , ValidatedCluster , ValidatedOpaConfig , build,
65+ } ,
66+ crd:: { Container , DEFAULT_SERVER_GRACEFUL_SHUTDOWN_TIMEOUT , user_info_fetcher} ,
6667 operations:: graceful_shutdown:: add_graceful_shutdown_config,
6768} ;
6869
@@ -237,14 +238,14 @@ fn http_liveness_probe(path: &str, port: IntOrString, scheme: Option<String>) ->
237238pub fn build_server_rolegroup_daemonset (
238239 cluster : & ValidatedCluster ,
239240 role_group_name : & RoleGroupName ,
240- role_group : & ValidatedRoleGroup ,
241+ role_group : & OpaRoleGroupConfig ,
241242 opa_bundle_builder_image : & str ,
242243 user_info_fetcher_image : & str ,
243244 service_account : & ServiceAccount ,
244245 cluster_info : & KubernetesClusterInfo ,
245246) -> Result < DaemonSet > {
246247 let resolved_product_image = & cluster. image ;
247- let rolegroup_config = & role_group. config ;
248+ let rolegroup_config = role_group;
248249 // All overrides were already merged (role group over role over defaults) in the validate step.
249250 let merged_config = & rolegroup_config. config ;
250251
@@ -567,7 +568,7 @@ pub fn build_server_rolegroup_daemonset(
567568
568569 // The Vector logging config was validated up-front (see `ValidatedLogging`); a `Some` here means
569570 // the Vector agent is enabled and the aggregator discovery ConfigMap name is valid.
570- if let Some ( vector_log_config) = & role_group . logging . vector_container {
571+ if let Some ( vector_log_config) = & merged_config . logging . vector_container {
571572 pb. add_container ( vector_container (
572573 & container_name ( & Container :: Vector ) ,
573574 resolved_product_image,
@@ -661,7 +662,7 @@ fn add_stackable_rust_cli_env_vars(
661662}
662663
663664fn build_opa_start_command (
664- merged_config : & OpaConfig ,
665+ merged_config : & ValidatedOpaConfig ,
665666 container_name : & str ,
666667 tls_enabled : bool ,
667668 cli_overrides : & BTreeMap < String , String > ,
@@ -671,9 +672,8 @@ fn build_opa_start_command(
671672 let mut server_log_level = DEFAULT_SERVER_LOG_LEVEL ;
672673 let mut decision_log_level = DEFAULT_DECISION_LOG_LEVEL ;
673674
674- if let Some ( ContainerLogConfig {
675- choice : Some ( ContainerLogConfigChoice :: Automatic ( log_config) ) ,
676- } ) = merged_config. logging . containers . get ( & Container :: Opa )
675+ if let Some ( ValidatedContainerLogConfigChoice :: Automatic ( log_config) ) =
676+ merged_config. logging . containers . get ( & Container :: Opa )
677677 {
678678 if let Some ( AppenderConfig {
679679 level : Some ( log_level) ,
@@ -749,14 +749,15 @@ fn build_opa_start_command(
749749 }
750750}
751751
752- fn build_bundle_builder_start_command ( merged_config : & OpaConfig , container_name : & str ) -> String {
752+ fn build_bundle_builder_start_command (
753+ merged_config : & ValidatedOpaConfig ,
754+ container_name : & str ,
755+ ) -> String {
753756 let mut console_logging_off = false ;
754757
755758 // We need to check if the console logging is deactivated (NONE)
756759 // This will result in not using `tee` later on in the start command
757- if let Some ( ContainerLogConfig {
758- choice : Some ( ContainerLogConfigChoice :: Automatic ( log_config) ) ,
759- } ) = merged_config
760+ if let Some ( ValidatedContainerLogConfigChoice :: Automatic ( log_config) ) = merged_config
760761 . logging
761762 . containers
762763 . get ( & Container :: BundleBuilder )
@@ -812,12 +813,11 @@ fn build_bundle_builder_start_command(merged_config: &OpaConfig, container_name:
812813///
813814/// Context: https://docs.stackable.tech/home/stable/concepts/logging/
814815fn sidecar_container_log_level (
815- merged_config : & OpaConfig ,
816+ merged_config : & ValidatedOpaConfig ,
816817 sidecar_container : & Container ,
817818) -> build:: properties:: product_logging:: BundleBuilderLogLevel {
818- if let Some ( ContainerLogConfig {
819- choice : Some ( ContainerLogConfigChoice :: Automatic ( log_config) ) ,
820- } ) = merged_config. logging . containers . get ( sidecar_container)
819+ if let Some ( ValidatedContainerLogConfigChoice :: Automatic ( log_config) ) =
820+ merged_config. logging . containers . get ( sidecar_container)
821821 && let Some ( logger) = log_config
822822 . loggers
823823 . get ( AutomaticContainerLogConfig :: ROOT_LOGGER )
@@ -828,11 +828,13 @@ fn sidecar_container_log_level(
828828 build:: properties:: product_logging:: BundleBuilderLogLevel :: Info
829829}
830830
831- fn build_prepare_start_command ( merged_config : & OpaConfig , container_name : & str ) -> Vec < String > {
831+ fn build_prepare_start_command (
832+ merged_config : & ValidatedOpaConfig ,
833+ container_name : & str ,
834+ ) -> Vec < String > {
832835 let mut prepare_container_args = vec ! [ ] ;
833- if let Some ( ContainerLogConfig {
834- choice : Some ( ContainerLogConfigChoice :: Automatic ( log_config) ) ,
835- } ) = merged_config. logging . containers . get ( & Container :: Prepare )
836+ if let Some ( ValidatedContainerLogConfigChoice :: Automatic ( log_config) ) =
837+ merged_config. logging . containers . get ( & Container :: Prepare )
836838 {
837839 prepare_container_args. push ( product_logging:: framework:: capture_shell_output (
838840 STACKABLE_LOG_DIR ,
0 commit comments