@@ -15,6 +15,7 @@ use product_config::{
1515use snafu:: { OptionExt , ResultExt , Snafu } ;
1616use stackable_operator:: {
1717 builder:: {
18+ self ,
1819 configmap:: ConfigMapBuilder ,
1920 meta:: ObjectMetaBuilder ,
2021 pod:: {
@@ -46,7 +47,9 @@ use stackable_operator::{
4647 } ,
4748 product_logging:: {
4849 self ,
49- framework:: { create_vector_shutdown_file_command, remove_vector_shutdown_file_command} ,
50+ framework:: {
51+ create_vector_shutdown_file_command, remove_vector_shutdown_file_command, LoggingError ,
52+ } ,
5053 spec:: Logging ,
5154 } ,
5255 role_utils:: { GenericRoleConfig , RoleGroupRef } ,
@@ -57,12 +60,13 @@ use stackable_operator::{
5760 time:: Duration ,
5861 utils:: COMMON_BASH_TRAP_FUNCTIONS ,
5962} ;
60- use stackable_superset_crd:: authentication:: SupersetAuthenticationClassResolved ;
6163use stackable_superset_crd:: {
62- authentication:: SupersetClientAuthenticationDetailsResolved , Container , SupersetCluster ,
63- SupersetClusterStatus , SupersetConfig , SupersetConfigOptions , SupersetRole , APP_NAME ,
64- PYTHONPATH , STACKABLE_CONFIG_DIR , STACKABLE_LOG_CONFIG_DIR , STACKABLE_LOG_DIR ,
65- SUPERSET_CONFIG_FILENAME ,
64+ authentication:: {
65+ SupersetAuthenticationClassResolved , SupersetClientAuthenticationDetailsResolved ,
66+ } ,
67+ Container , SupersetCluster , SupersetClusterStatus , SupersetConfig , SupersetConfigOptions ,
68+ SupersetRole , APP_NAME , PYTHONPATH , STACKABLE_CONFIG_DIR , STACKABLE_LOG_CONFIG_DIR ,
69+ STACKABLE_LOG_DIR , SUPERSET_CONFIG_FILENAME ,
6670} ;
6771use strum:: { EnumDiscriminants , IntoStaticStr } ;
6872
@@ -259,6 +263,17 @@ pub enum Error {
259263 "failed to write to String (Vec<u8> to be precise) containing superset config"
260264 ) ) ]
261265 WriteToConfigFileString { source : std:: io:: Error } ,
266+
267+ #[ snafu( display( "failed to configure logging" ) ) ]
268+ ConfigureLogging { source : LoggingError } ,
269+
270+ #[ snafu( display( "failed to add needed volume" ) ) ]
271+ AddVolume { source : builder:: pod:: Error } ,
272+
273+ #[ snafu( display( "failed to add needed volumeMount" ) ) ]
274+ AddVolumeMount {
275+ source : builder:: pod:: container:: Error ,
276+ } ,
262277}
263278
264279type Result < T , E = Error > = std:: result:: Result < T , E > ;
@@ -742,9 +757,9 @@ fn build_server_rolegroup_statefulset(
742757 superset_cb
743758 . image_from_product_image ( resolved_product_image)
744759 . add_container_port ( "http" , APP_PORT . into ( ) )
745- . add_volume_mount ( CONFIG_VOLUME_NAME , STACKABLE_CONFIG_DIR )
746- . add_volume_mount ( LOG_CONFIG_VOLUME_NAME , STACKABLE_LOG_CONFIG_DIR )
747- . add_volume_mount ( LOG_VOLUME_NAME , STACKABLE_LOG_DIR )
760+ . add_volume_mount ( CONFIG_VOLUME_NAME , STACKABLE_CONFIG_DIR ) . context ( AddVolumeMountSnafu ) ?
761+ . add_volume_mount ( LOG_CONFIG_VOLUME_NAME , STACKABLE_LOG_CONFIG_DIR ) . context ( AddVolumeMountSnafu ) ?
762+ . add_volume_mount ( LOG_VOLUME_NAME , STACKABLE_LOG_DIR ) . context ( AddVolumeMountSnafu ) ?
748763 . add_env_var_from_secret ( "ADMIN_USERNAME" , secret, "adminUser.username" )
749764 . add_env_var_from_secret ( "ADMIN_FIRSTNAME" , secret, "adminUser.firstname" )
750765 . add_env_var_from_secret ( "ADMIN_LASTNAME" , secret, "adminUser.lastname" )
@@ -839,22 +854,26 @@ fn build_server_rolegroup_statefulset(
839854 pb. add_volumes ( controller_commons:: create_volumes (
840855 & rolegroup_ref. object_name ( ) ,
841856 merged_config. logging . containers . get ( & Container :: Superset ) ,
842- ) ) ;
857+ ) )
858+ . context ( AddVolumeSnafu ) ?;
843859 pb. add_container ( metrics_container) ;
844860
845861 if merged_config. logging . enable_vector_agent {
846- pb. add_container ( product_logging:: framework:: vector_container (
847- resolved_product_image,
848- CONFIG_VOLUME_NAME ,
849- LOG_VOLUME_NAME ,
850- merged_config. logging . containers . get ( & Container :: Vector ) ,
851- ResourceRequirementsBuilder :: new ( )
852- . with_cpu_request ( "250m" )
853- . with_cpu_limit ( "500m" )
854- . with_memory_request ( "128Mi" )
855- . with_memory_limit ( "128Mi" )
856- . build ( ) ,
857- ) ) ;
862+ pb. add_container (
863+ product_logging:: framework:: vector_container (
864+ resolved_product_image,
865+ CONFIG_VOLUME_NAME ,
866+ LOG_VOLUME_NAME ,
867+ merged_config. logging . containers . get ( & Container :: Vector ) ,
868+ ResourceRequirementsBuilder :: new ( )
869+ . with_cpu_request ( "250m" )
870+ . with_cpu_limit ( "500m" )
871+ . with_memory_request ( "128Mi" )
872+ . with_memory_limit ( "128Mi" )
873+ . build ( ) ,
874+ )
875+ . context ( ConfigureLoggingSnafu ) ?,
876+ ) ;
858877 }
859878
860879 let mut pod_template = pb. build_template ( ) ;
0 commit comments