1- use std:: collections:: { BTreeMap } ;
1+ use std:: collections:: BTreeMap ;
22
33use snafu:: { ResultExt , Snafu } ;
44use stackable_operator:: {
@@ -8,7 +8,10 @@ use stackable_operator::{
88 k8s_openapi:: api:: core:: v1:: { ConfigMapKeySelector , EnvVar , EnvVarSource , Volume , VolumeMount } ,
99 kube:: ResourceExt ,
1010} ;
11- use stackable_trino_crd:: { catalog:: TrinoCatalog , S3_SECRET_DIR_NAME } ;
11+ use stackable_trino_crd:: {
12+ CONFIG_DIR_NAME , RW_CONFIG_DIR_NAME ,
13+ { catalog:: TrinoCatalog , S3_SECRET_DIR_NAME } ,
14+ } ;
1215
1316use self :: from_trino_catalog_error:: ResolveS3ConnectionDefSnafu ;
1417
@@ -87,8 +90,9 @@ impl CatalogConfig {
8790 catalog : TrinoCatalog ,
8891 client : & Client ,
8992 ) -> Result < CatalogConfig , FromTrinoCatalogError > {
93+ let catalog_name = catalog. name ( ) ;
9094 let mut config = CatalogConfig {
91- name : catalog . name ( ) ,
95+ name : catalog_name . to_string ( ) ,
9296 properties : BTreeMap :: new ( ) ,
9397 env_bindings : Vec :: new ( ) ,
9498 load_env_from_files : BTreeMap :: new ( ) ,
@@ -144,6 +148,23 @@ impl CatalogConfig {
144148
145149 // TODO: Handle TLS settings (related to https://github.com/stackabletech/trino-operator/pull/244)
146150 }
151+
152+ if let Some ( hdfs) = & hive. hdfs {
153+ config. add_property (
154+ "hive.config.resources" ,
155+ format ! ( "{RW_CONFIG_DIR_NAME}/catalog/{catalog_name}/hdfs-config/hdfs-site.xml" ) ,
156+ ) ;
157+
158+ let volume_name = format ! ( "{catalog_name}-hdfs" ) ;
159+ config. volumes . push (
160+ VolumeBuilder :: new ( & volume_name)
161+ . with_config_map ( & hdfs. config_map )
162+ . build ( ) ,
163+ ) ;
164+ config
165+ . volume_mounts
166+ . push ( VolumeMountBuilder :: new ( & volume_name, format ! ( "{CONFIG_DIR_NAME}/catalog/{catalog_name}/hdfs-config" ) ) . build ( ) ) ;
167+ }
147168 }
148169 }
149170
0 commit comments