Skip to content

Commit 016c2c3

Browse files
committed
refactor: add framework module
1 parent b32e097 commit 016c2c3

8 files changed

Lines changed: 435 additions & 449 deletions

File tree

rust/operator-binary/src/controller/build/config_map.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn build_rolegroup_config_map(
7171

7272
let hbase_site_xml = hbase_site::build(
7373
role,
74-
&rg.merged_config,
74+
&rg.config,
7575
cluster_config
7676
.zookeeper_connection_information
7777
.as_hbase_settings(),
@@ -81,7 +81,7 @@ pub fn build_rolegroup_config_map(
8181
);
8282

8383
let hbase_env_sh = hbase_env::build(
84-
&rg.merged_config,
84+
&rg.config,
8585
role,
8686
cluster_config.kerberos_enabled,
8787
rg.non_heap_jvm_args.clone(),
@@ -134,12 +134,10 @@ pub fn build_rolegroup_config_map(
134134
builder.add_data(ConfigFileName::SslClient.to_string(), ssl_client_xml);
135135
}
136136

137-
if let Some(log4j2_properties) = logging::build_log4j2(rg.merged_config.logging()) {
137+
if let Some(log4j2_properties) = logging::build_log4j2(rg.config.logging()) {
138138
builder.add_data(ConfigFileName::Log4j2.to_string(), log4j2_properties);
139139
}
140-
if let Some(vector_config) =
141-
logging::build_vector_config(rolegroup_ref, rg.merged_config.logging())
142-
{
140+
if let Some(vector_config) = logging::build_vector_config(rolegroup_ref, rg.config.logging()) {
143141
builder.add_data(VECTOR_CONFIG_FILE, vector_config);
144142
}
145143

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,17 @@ pub struct ValidatedRoleConfig {
150150
/// Per-rolegroup configuration: the merged CRD config plus the merged
151151
/// (role <- role group) `configOverrides`, `envOverrides` and `podOverrides`.
152152
///
153-
/// This carries every override channel so that the build step is a pure function of
154-
/// [`ValidatedCluster`] and never has to reach back into the raw `HbaseCluster`.
153+
/// The merge and validation is performed by
154+
/// [`with_validated_config`](crate::framework::role_utils::with_validated_config); the
155+
/// result is flattened into this struct and augmented with the pre-resolved
156+
/// `non_heap_jvm_args`. Carrying every override channel (and the JVM args) keeps the
157+
/// build step a pure function of [`ValidatedCluster`] that never has to reach back into
158+
/// the raw `HbaseCluster`.
155159
#[derive(Clone, Debug)]
156160
pub struct ValidatedRoleGroupConfig {
157-
/// The desired number of replicas (`None` lets Kubernetes default to 1).
158-
pub replicas: Option<u16>,
159-
pub merged_config: AnyServiceConfig,
161+
/// The desired number of replicas (defaulted to 1 during validation).
162+
pub replicas: u16,
163+
pub config: AnyServiceConfig,
160164
pub config_overrides: v1alpha1::HbaseConfigOverrides,
161165
pub env_overrides: EnvVarSet,
162166
/// Merged (role <- role group) pod template overrides.

0 commit comments

Comments
 (0)