@@ -7,6 +7,7 @@ use product_config::{ProductConfigManager, types::PropertyNameKind};
77use snafu:: { OptionExt , ResultExt , Snafu } ;
88use stackable_operator:: {
99 commons:: product_image_selection:: { self , ResolvedProductImage } ,
10+ database_connections:: drivers:: jdbc:: JdbcDatabaseConnectionDetails ,
1011 product_config_utils:: { transform_all_roles_to_config, validate_all_roles_and_groups_config} ,
1112 role_utils:: GenericRoleConfig ,
1213} ;
@@ -38,6 +39,11 @@ pub enum Error {
3839
3940 #[ snafu( display( "failed to resolve and merge config for role and role group" ) ) ]
4041 FailedToResolveConfig { source : crate :: crd:: Error } ,
42+
43+ #[ snafu( display( "invalid metadata database connection" ) ) ]
44+ InvalidMetadataDatabaseConnection {
45+ source : stackable_operator:: database_connections:: Error ,
46+ } ,
4147}
4248
4349/// Per-role configuration extracted during validation.
@@ -56,11 +62,11 @@ pub struct ValidatedRoleGroupConfig {
5662
5763/// The validated cluster: proves that product-config validation and config merging
5864/// succeeded for every role and role group before any resources are created.
59- #[ derive( Clone , Debug ) ]
6065pub struct ValidatedHiveCluster {
6166 pub image : ResolvedProductImage ,
6267 pub role_groups : BTreeMap < String , ValidatedRoleGroupConfig > ,
6368 pub role_config : Option < ValidatedRoleConfig > ,
69+ pub metadata_database_connection_details : JdbcDatabaseConnectionDetails ,
6470}
6571
6672pub fn validate_cluster (
@@ -142,9 +148,17 @@ pub fn validate_cluster(
142148 ) ;
143149 }
144150
151+ let metadata_database_connection_details = hive
152+ . spec
153+ . cluster_config
154+ . metadata_database
155+ . jdbc_connection_details ( "METADATA" )
156+ . context ( InvalidMetadataDatabaseConnectionSnafu ) ?;
157+
145158 Ok ( ValidatedHiveCluster {
146159 image : resolved_product_image,
147160 role_groups : group_configs,
148161 role_config,
162+ metadata_database_connection_details,
149163 } )
150164}
0 commit comments