@@ -37,9 +37,8 @@ use stackable_operator::{
3737 api:: {
3838 apps:: v1:: { StatefulSet , StatefulSetSpec } ,
3939 core:: v1:: {
40- ConfigMap , ConfigMapVolumeSource , EmptyDirVolumeSource , EnvVar , EnvVarSource ,
41- Probe , SecretKeySelector , Service , ServicePort , ServiceSpec , TCPSocketAction ,
42- Volume ,
40+ ConfigMap , ConfigMapVolumeSource , EmptyDirVolumeSource , Probe , Service ,
41+ ServicePort , ServiceSpec , TCPSocketAction , Volume ,
4342 } ,
4443 } ,
4544 apimachinery:: pkg:: {
@@ -66,7 +65,7 @@ use stackable_operator::{
6665 CustomContainerLogConfig ,
6766 } ,
6867 } ,
69- role_utils:: { GenericRoleConfig , JavaCommonConfig , Role , RoleGroupRef } ,
68+ role_utils:: { GenericRoleConfig , RoleGroupRef } ,
7069 status:: condition:: {
7170 compute_conditions, operations:: ClusterOperationsConditionBuilder ,
7271 statefulset:: StatefulSetConditionBuilder ,
@@ -81,11 +80,10 @@ use crate::{
8180 command:: build_container_command_args,
8281 config:: jvm:: { construct_hadoop_heapsize_env, construct_non_heap_jvm_args} ,
8382 crd:: {
84- v1alpha1, Container , HiveClusterStatus , HiveRole , MetaStoreConfig , MetaStoreConfigFragment ,
85- APP_NAME , CORE_SITE_XML , DB_PASSWORD_ENV , DB_USERNAME_ENV , HIVE_ENV_SH , HIVE_PORT ,
86- HIVE_PORT_NAME , HIVE_SITE_XML , JVM_SECURITY_PROPERTIES_FILE , METRICS_PORT ,
87- METRICS_PORT_NAME , STACKABLE_CONFIG_DIR , STACKABLE_CONFIG_DIR_NAME ,
88- STACKABLE_CONFIG_MOUNT_DIR , STACKABLE_CONFIG_MOUNT_DIR_NAME ,
83+ v1alpha1, Container , HiveClusterStatus , HiveRole , MetaStoreConfig , APP_NAME , CORE_SITE_XML ,
84+ DB_PASSWORD_ENV , DB_USERNAME_ENV , HIVE_PORT , HIVE_PORT_NAME , HIVE_SITE_XML ,
85+ JVM_SECURITY_PROPERTIES_FILE , METRICS_PORT , METRICS_PORT_NAME , STACKABLE_CONFIG_DIR ,
86+ STACKABLE_CONFIG_DIR_NAME , STACKABLE_CONFIG_MOUNT_DIR , STACKABLE_CONFIG_MOUNT_DIR_NAME ,
8987 STACKABLE_LOG_CONFIG_MOUNT_DIR , STACKABLE_LOG_CONFIG_MOUNT_DIR_NAME , STACKABLE_LOG_DIR ,
9088 STACKABLE_LOG_DIR_NAME ,
9189 } ,
@@ -387,7 +385,6 @@ pub async fn reconcile_hive(
387385 PropertyNameKind :: Env ,
388386 PropertyNameKind :: Cli ,
389387 PropertyNameKind :: File ( HIVE_SITE_XML . to_string( ) ) ,
390- PropertyNameKind :: File ( HIVE_ENV_SH . to_string( ) ) ,
391388 PropertyNameKind :: File ( JVM_SECURITY_PROPERTIES_FILE . to_string( ) ) ,
392389 ] ,
393390 role. clone ( ) ,
@@ -460,7 +457,6 @@ pub async fn reconcile_hive(
460457 hive,
461458 & hive_namespace,
462459 & resolved_product_image,
463- role,
464460 & rolegroup,
465461 rolegroup_config,
466462 s3_connection_spec. as_ref ( ) ,
@@ -604,7 +600,6 @@ fn build_metastore_rolegroup_config_map(
604600 hive : & v1alpha1:: HiveCluster ,
605601 hive_namespace : & str ,
606602 resolved_product_image : & ResolvedProductImage ,
607- role : & Role < MetaStoreConfigFragment , GenericRoleConfig , JavaCommonConfig > ,
608603 rolegroup : & RoleGroupRef < v1alpha1:: HiveCluster > ,
609604 role_group_config : & HashMap < PropertyNameKind , BTreeMap < String , String > > ,
610605 s3_connection_spec : Option < & S3ConnectionSpec > ,
@@ -613,35 +608,9 @@ fn build_metastore_rolegroup_config_map(
613608 cluster_info : & KubernetesClusterInfo ,
614609) -> Result < ConfigMap > {
615610 let mut hive_site_data = String :: new ( ) ;
616- let mut hive_env_data = String :: new ( ) ;
617611
618612 for ( property_name_kind, config) in role_group_config {
619613 match property_name_kind {
620- PropertyNameKind :: File ( file_name) if file_name == HIVE_ENV_SH => {
621- let mut data = BTreeMap :: from ( [
622- (
623- "HADOOP_HEAPSIZE" . to_string ( ) ,
624- construct_hadoop_heapsize_env ( merged_config)
625- . context ( ConstructJvmArgumentsSnafu ) ?,
626- ) ,
627- (
628- "HADOOP_OPTS" . to_string ( ) ,
629- construct_non_heap_jvm_args ( hive, role, & rolegroup. role_group )
630- . context ( ConstructJvmArgumentsSnafu ) ?,
631- ) ,
632- ] ) ;
633-
634- // other properties / overrides
635- for ( property_name, property_value) in config {
636- data. insert ( property_name. to_string ( ) , property_value. to_string ( ) ) ;
637- }
638-
639- hive_env_data = data
640- . into_iter ( )
641- . map ( |( key, value) | format ! ( "export {key}=\" {value}\" " ) )
642- . collect :: < Vec < String > > ( )
643- . join ( "\n " ) ;
644- }
645614 PropertyNameKind :: File ( file_name) if file_name == HIVE_SITE_XML => {
646615 let mut data = BTreeMap :: new ( ) ;
647616
@@ -724,7 +693,6 @@ fn build_metastore_rolegroup_config_map(
724693 . build ( ) ,
725694 )
726695 . add_data ( HIVE_SITE_XML , hive_site_data)
727- . add_data ( HIVE_ENV_SH , hive_env_data)
728696 . add_data (
729697 JVM_SECURITY_PROPERTIES_FILE ,
730698 to_java_properties_string ( jvm_sec_props. iter ( ) ) . with_context ( |_| {
@@ -827,6 +795,27 @@ fn build_metastore_rolegroup_statefulset(
827795 name : APP_NAME . to_string ( ) ,
828796 } ) ?;
829797
798+ let credentials_secret_name = hive. spec . cluster_config . database . credentials_secret . clone ( ) ;
799+
800+ container_builder
801+ // load database credentials to environment variables: these will be used to replace
802+ // the placeholders in hive-site.xml so that the operator does not "touch" the secret.
803+ . add_env_var_from_secret ( DB_USERNAME_ENV , & credentials_secret_name, "username" )
804+ . add_env_var_from_secret ( DB_PASSWORD_ENV , & credentials_secret_name, "password" )
805+ . add_env_var (
806+ "HADOOP_HEAPSIZE" ,
807+ construct_hadoop_heapsize_env ( merged_config) . context ( ConstructJvmArgumentsSnafu ) ?,
808+ )
809+ . add_env_var (
810+ "HADOOP_OPTS" ,
811+ construct_non_heap_jvm_args ( hive, role, & rolegroup_ref. role_group )
812+ . context ( ConstructJvmArgumentsSnafu ) ?,
813+ )
814+ . add_env_var (
815+ "CONTAINERDEBUG_LOG_DIRECTORY" ,
816+ format ! ( "{STACKABLE_LOG_DIR}/containerdebug" ) ,
817+ ) ;
818+
830819 for ( property_name_kind, config) in metastore_config {
831820 if property_name_kind == & PropertyNameKind :: Env {
832821 // overrides
@@ -844,21 +833,6 @@ fn build_metastore_rolegroup_statefulset(
844833 }
845834 }
846835
847- // load database credentials to environment variables: these will be used to replace
848- // the placeholders in hive-site.xml so that the operator does not "touch" the secret.
849- let credentials_secret_name = hive. spec . cluster_config . database . credentials_secret . clone ( ) ;
850-
851- container_builder. add_env_vars ( vec ! [
852- env_var_from_secret( DB_USERNAME_ENV , & credentials_secret_name, "username" ) ,
853- env_var_from_secret( DB_PASSWORD_ENV , & credentials_secret_name, "password" ) ,
854- // Needed for the `containerdebug` process to log it's tracing information to.
855- EnvVar {
856- name: "CONTAINERDEBUG_LOG_DIRECTORY" . to_string( ) ,
857- value: Some ( format!( "{STACKABLE_LOG_DIR}/containerdebug" ) ) ,
858- value_from: None ,
859- } ,
860- ] ) ;
861-
862836 let mut pod_builder = PodBuilder :: new ( ) ;
863837
864838 if let Some ( hdfs) = & hive. spec . cluster_config . hdfs {
@@ -1127,21 +1101,6 @@ fn build_metastore_rolegroup_statefulset(
11271101 } )
11281102}
11291103
1130- fn env_var_from_secret ( var_name : & str , secret : & str , secret_key : & str ) -> EnvVar {
1131- EnvVar {
1132- name : String :: from ( var_name) ,
1133- value_from : Some ( EnvVarSource {
1134- secret_key_ref : Some ( SecretKeySelector {
1135- name : String :: from ( secret) ,
1136- key : String :: from ( secret_key) ,
1137- ..Default :: default ( )
1138- } ) ,
1139- ..Default :: default ( )
1140- } ) ,
1141- ..Default :: default ( )
1142- }
1143- }
1144-
11451104pub fn error_policy (
11461105 _obj : Arc < DeserializeGuard < v1alpha1:: HiveCluster > > ,
11471106 error : & Error ,
0 commit comments