Skip to content

Commit 1758748

Browse files
committed
move validated cluster to the controller which will be the central dependency for subsequent steps
1 parent bd9b277 commit 1758748

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

rust/operator-binary/src/controller.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ use crate::{
9292
jvm::{construct_hadoop_heapsize_env, construct_non_heap_jvm_args},
9393
opa::{HiveOpaConfig, OPA_TLS_VOLUME_NAME},
9494
},
95+
controller::validate::{ValidatedRoleConfig, ValidatedRoleGroupConfig},
9596
crd::{
9697
APP_NAME, CORE_SITE_XML, Container, HIVE_PORT, HIVE_PORT_NAME, HIVE_SITE_XML,
9798
HiveClusterStatus, HiveRole, JVM_SECURITY_PROPERTIES_FILE, METRICS_PORT, METRICS_PORT_NAME,
@@ -325,6 +326,17 @@ impl ReconcilerError for Error {
325326
}
326327
}
327328

329+
/// The validated cluster: proves that product-config validation and config merging
330+
/// succeeded for every role and role group before any resources are created.
331+
/// Placed in the controller so that subsequent steps that reference this struct
332+
/// only depend on the controller.
333+
pub struct ValidatedHiveCluster {
334+
pub image: ResolvedProductImage,
335+
pub role_groups: BTreeMap<String, ValidatedRoleGroupConfig>,
336+
pub role_config: Option<ValidatedRoleConfig>,
337+
pub metadata_database_connection_details: JdbcDatabaseConnectionDetails,
338+
}
339+
328340
pub async fn reconcile_hive(
329341
hive: Arc<DeserializeGuard<v1alpha1::HiveCluster>>,
330342
ctx: Arc<Ctx>,

rust/operator-binary/src/controller/validate.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ use std::{
66
use product_config::{ProductConfigManager, types::PropertyNameKind};
77
use snafu::{OptionExt, ResultExt, Snafu};
88
use stackable_operator::{
9-
commons::product_image_selection::{self, ResolvedProductImage},
10-
database_connections::drivers::jdbc::JdbcDatabaseConnectionDetails,
9+
commons::product_image_selection,
1110
product_config_utils::{transform_all_roles_to_config, validate_all_roles_and_groups_config},
1211
role_utils::GenericRoleConfig,
1312
};
1413

15-
use crate::crd::{
16-
HIVE_SITE_XML, HiveRole, JVM_SECURITY_PROPERTIES_FILE, MetaStoreConfig,
17-
v1alpha1::{self, HiveMetastoreRoleConfig},
14+
use crate::{
15+
controller::ValidatedHiveCluster,
16+
crd::{
17+
HIVE_SITE_XML, HiveRole, JVM_SECURITY_PROPERTIES_FILE, MetaStoreConfig,
18+
v1alpha1::{self, HiveMetastoreRoleConfig},
19+
},
1820
};
1921

2022
#[derive(Snafu, Debug)]
@@ -60,15 +62,6 @@ pub struct ValidatedRoleGroupConfig {
6062
pub product_config_properties: HashMap<PropertyNameKind, BTreeMap<String, String>>,
6163
}
6264

63-
/// The validated cluster: proves that product-config validation and config merging
64-
/// succeeded for every role and role group before any resources are created.
65-
pub struct ValidatedHiveCluster {
66-
pub image: ResolvedProductImage,
67-
pub role_groups: BTreeMap<String, ValidatedRoleGroupConfig>,
68-
pub role_config: Option<ValidatedRoleConfig>,
69-
pub metadata_database_connection_details: JdbcDatabaseConnectionDetails,
70-
}
71-
7265
pub fn validate_cluster(
7366
hive: &v1alpha1::HiveCluster,
7467
image_base_name: &str,

0 commit comments

Comments
 (0)