@@ -37,9 +37,8 @@ use stackable_operator::{
37
37
api:: {
38
38
apps:: v1:: { StatefulSet , StatefulSetSpec } ,
39
39
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 ,
43
42
} ,
44
43
} ,
45
44
apimachinery:: pkg:: {
@@ -66,7 +65,7 @@ use stackable_operator::{
66
65
CustomContainerLogConfig ,
67
66
} ,
68
67
} ,
69
- role_utils:: { GenericRoleConfig , JavaCommonConfig , Role , RoleGroupRef } ,
68
+ role_utils:: { GenericRoleConfig , RoleGroupRef } ,
70
69
status:: condition:: {
71
70
compute_conditions, operations:: ClusterOperationsConditionBuilder ,
72
71
statefulset:: StatefulSetConditionBuilder ,
@@ -81,11 +80,10 @@ use crate::{
81
80
command:: build_container_command_args,
82
81
config:: jvm:: { construct_hadoop_heapsize_env, construct_non_heap_jvm_args} ,
83
82
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 ,
89
87
STACKABLE_LOG_CONFIG_MOUNT_DIR , STACKABLE_LOG_CONFIG_MOUNT_DIR_NAME , STACKABLE_LOG_DIR ,
90
88
STACKABLE_LOG_DIR_NAME ,
91
89
} ,
@@ -387,7 +385,6 @@ pub async fn reconcile_hive(
387
385
PropertyNameKind :: Env ,
388
386
PropertyNameKind :: Cli ,
389
387
PropertyNameKind :: File ( HIVE_SITE_XML . to_string( ) ) ,
390
- PropertyNameKind :: File ( HIVE_ENV_SH . to_string( ) ) ,
391
388
PropertyNameKind :: File ( JVM_SECURITY_PROPERTIES_FILE . to_string( ) ) ,
392
389
] ,
393
390
role. clone ( ) ,
@@ -460,7 +457,6 @@ pub async fn reconcile_hive(
460
457
hive,
461
458
& hive_namespace,
462
459
& resolved_product_image,
463
- role,
464
460
& rolegroup,
465
461
rolegroup_config,
466
462
s3_connection_spec. as_ref ( ) ,
@@ -604,7 +600,6 @@ fn build_metastore_rolegroup_config_map(
604
600
hive : & v1alpha1:: HiveCluster ,
605
601
hive_namespace : & str ,
606
602
resolved_product_image : & ResolvedProductImage ,
607
- role : & Role < MetaStoreConfigFragment , GenericRoleConfig , JavaCommonConfig > ,
608
603
rolegroup : & RoleGroupRef < v1alpha1:: HiveCluster > ,
609
604
role_group_config : & HashMap < PropertyNameKind , BTreeMap < String , String > > ,
610
605
s3_connection_spec : Option < & S3ConnectionSpec > ,
@@ -613,35 +608,9 @@ fn build_metastore_rolegroup_config_map(
613
608
cluster_info : & KubernetesClusterInfo ,
614
609
) -> Result < ConfigMap > {
615
610
let mut hive_site_data = String :: new ( ) ;
616
- let mut hive_env_data = String :: new ( ) ;
617
611
618
612
for ( property_name_kind, config) in role_group_config {
619
613
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
- }
645
614
PropertyNameKind :: File ( file_name) if file_name == HIVE_SITE_XML => {
646
615
let mut data = BTreeMap :: new ( ) ;
647
616
@@ -724,7 +693,6 @@ fn build_metastore_rolegroup_config_map(
724
693
. build ( ) ,
725
694
)
726
695
. add_data ( HIVE_SITE_XML , hive_site_data)
727
- . add_data ( HIVE_ENV_SH , hive_env_data)
728
696
. add_data (
729
697
JVM_SECURITY_PROPERTIES_FILE ,
730
698
to_java_properties_string ( jvm_sec_props. iter ( ) ) . with_context ( |_| {
@@ -827,6 +795,27 @@ fn build_metastore_rolegroup_statefulset(
827
795
name : APP_NAME . to_string ( ) ,
828
796
} ) ?;
829
797
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
+
830
819
for ( property_name_kind, config) in metastore_config {
831
820
if property_name_kind == & PropertyNameKind :: Env {
832
821
// overrides
@@ -844,21 +833,6 @@ fn build_metastore_rolegroup_statefulset(
844
833
}
845
834
}
846
835
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
-
862
836
let mut pod_builder = PodBuilder :: new ( ) ;
863
837
864
838
if let Some ( hdfs) = & hive. spec . cluster_config . hdfs {
@@ -1127,21 +1101,6 @@ fn build_metastore_rolegroup_statefulset(
1127
1101
} )
1128
1102
}
1129
1103
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
-
1145
1104
pub fn error_policy (
1146
1105
_obj : Arc < DeserializeGuard < v1alpha1:: HiveCluster > > ,
1147
1106
error : & Error ,
0 commit comments