@@ -21,6 +21,22 @@ const DEFAULT_WAREHOUSE_DIR: &str = "/stackable/warehouse";
2121const HIVE_METASTORE_PORT : & str = "hive.metastore.port" ;
2222const DEFAULT_HIVE_METASTORE_PORT : & str = "9083" ;
2323
24+ // Metastore property keys.
25+ const CONNECTION_DRIVER_NAME : & str = "javax.jdo.option.ConnectionDriverName" ;
26+ const CONNECTION_PASSWORD : & str = "javax.jdo.option.ConnectionPassword" ;
27+ const CONNECTION_URL : & str = "javax.jdo.option.ConnectionURL" ;
28+ const CONNECTION_USER_NAME : & str = "javax.jdo.option.ConnectionUserName" ;
29+ const METASTORE_METRICS_ENABLED : & str = "hive.metastore.metrics.enabled" ;
30+ const METASTORE_WAREHOUSE_DIR : & str = "hive.metastore.warehouse.dir" ;
31+
32+ // S3 property keys.
33+ const S3_ACCESS_KEY : & str = "fs.s3a.access.key" ;
34+ const S3_ENDPOINT : & str = "fs.s3a.endpoint" ;
35+ const S3_PATH_STYLE_ACCESS : & str = "fs.s3a.path.style.access" ;
36+ const S3_REGION_NAME : & str = "fs.s3a.endpoint.region" ;
37+ const S3_SECRET_KEY : & str = "fs.s3a.secret.key" ;
38+ const S3_SSL_ENABLED : & str = "fs.s3a.connection.ssl.enabled" ;
39+
2440#[ derive( Debug , Snafu ) ]
2541pub enum Error {
2642 #[ snafu( display( "failed to configure S3 connection" ) ) ]
@@ -49,62 +65,47 @@ pub fn build(
4965
5066 // 2. Automatic / operator-injected.
5167 data. insert (
52- MetaStoreConfig :: METASTORE_WAREHOUSE_DIR . to_string ( ) ,
68+ METASTORE_WAREHOUSE_DIR . to_string ( ) ,
5369 DEFAULT_WAREHOUSE_DIR . to_string ( ) ,
5470 ) ;
55- data. insert (
56- MetaStoreConfig :: METASTORE_METRICS_ENABLED . to_string ( ) ,
57- "true" . to_string ( ) ,
58- ) ;
71+ data. insert ( METASTORE_METRICS_ENABLED . to_string ( ) , "true" . to_string ( ) ) ;
5972
6073 data. insert (
61- MetaStoreConfig :: CONNECTION_DRIVER_NAME . to_string ( ) ,
74+ CONNECTION_DRIVER_NAME . to_string ( ) ,
6275 cluster_config. connection_driver . clone ( ) ,
6376 ) ;
6477 data. insert (
65- MetaStoreConfig :: CONNECTION_URL . to_string ( ) ,
78+ CONNECTION_URL . to_string ( ) ,
6679 database_connection_details. connection_url . to_string ( ) ,
6780 ) ;
6881 if let Some ( EnvVar { name, .. } ) = & database_connection_details. username_env {
69- data. insert (
70- MetaStoreConfig :: CONNECTION_USER_NAME . to_string ( ) ,
71- format ! ( "${{env:{name}}}" ) ,
72- ) ;
82+ data. insert ( CONNECTION_USER_NAME . to_string ( ) , format ! ( "${{env:{name}}}" ) ) ;
7383 }
7484 if let Some ( EnvVar { name, .. } ) = & database_connection_details. password_env {
75- data. insert (
76- MetaStoreConfig :: CONNECTION_PASSWORD . to_string ( ) ,
77- format ! ( "${{env:{name}}}" ) ,
78- ) ;
85+ data. insert ( CONNECTION_PASSWORD . to_string ( ) , format ! ( "${{env:{name}}}" ) ) ;
7986 }
8087
8188 if let Some ( s3) = cluster_config. s3_connection_spec . as_ref ( ) {
8289 data. insert (
83- MetaStoreConfig :: S3_ENDPOINT . to_string ( ) ,
90+ S3_ENDPOINT . to_string ( ) ,
8491 s3. endpoint ( )
8592 . context ( ConfigureS3ConnectionSnafu ) ?
8693 . to_string ( ) ,
8794 ) ;
88- data. insert (
89- MetaStoreConfig :: S3_REGION_NAME . to_string ( ) ,
90- s3. region . name . clone ( ) ,
91- ) ;
95+ data. insert ( S3_REGION_NAME . to_string ( ) , s3. region . name . clone ( ) ) ;
9296 if let Some ( ( access_key_file, secret_key_file) ) = s3. credentials_mount_paths ( ) {
9397 data. insert (
94- MetaStoreConfig :: S3_ACCESS_KEY . to_string ( ) ,
98+ S3_ACCESS_KEY . to_string ( ) ,
9599 format ! ( "${{file:UTF-8:{access_key_file}}}" ) ,
96100 ) ;
97101 data. insert (
98- MetaStoreConfig :: S3_SECRET_KEY . to_string ( ) ,
102+ S3_SECRET_KEY . to_string ( ) ,
99103 format ! ( "${{file:UTF-8:{secret_key_file}}}" ) ,
100104 ) ;
101105 }
106+ data. insert ( S3_SSL_ENABLED . to_string ( ) , s3. tls . uses_tls ( ) . to_string ( ) ) ;
102107 data. insert (
103- MetaStoreConfig :: S3_SSL_ENABLED . to_string ( ) ,
104- s3. tls . uses_tls ( ) . to_string ( ) ,
105- ) ;
106- data. insert (
107- MetaStoreConfig :: S3_PATH_STYLE_ACCESS . to_string ( ) ,
108+ S3_PATH_STYLE_ACCESS . to_string ( ) ,
108109 ( s3. access_style == s3:: v1alpha1:: S3AccessStyle :: Path ) . to_string ( ) ,
109110 ) ;
110111 }
@@ -120,10 +121,7 @@ pub fn build(
120121
121122 // 3. Spec: warehouse dir from the merged CRD config (overrides the default).
122123 if let Some ( warehouse_dir) = & merged_config. warehouse_dir {
123- data. insert (
124- MetaStoreConfig :: METASTORE_WAREHOUSE_DIR . to_string ( ) ,
125- warehouse_dir. clone ( ) ,
126- ) ;
124+ data. insert ( METASTORE_WAREHOUSE_DIR . to_string ( ) , warehouse_dir. clone ( ) ) ;
127125 }
128126
129127 // 4. User overrides (highest precedence).
0 commit comments