Skip to content

Commit 3389aca

Browse files
committed
fix: consolidate listener class default, keystore / truststore constants
1 parent e2981ad commit 3389aca

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

rust/operator-binary/src/config/fault_tolerant_execution.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ use crate::{
2121
},
2222
};
2323

24+
/// Sub-directory of [`CONFIG_DIR_NAME`] holding the HDFS exchange config.
25+
const EXCHANGE_HDFS_CONFIG: &str = "exchange-hdfs-config";
26+
2427
#[derive(Snafu, Debug)]
2528
pub enum Error {
2629
#[snafu(display("failed to resolve S3 connection"))]
@@ -240,7 +243,7 @@ impl ResolvedFaultTolerantExecutionConfig {
240243
hdfs_config.skip_directory_scheme_validation,
241244
);
242245

243-
let hdfs_config_dir = format!("{CONFIG_DIR_NAME}/exchange-hdfs-config");
246+
let hdfs_config_dir = format!("{CONFIG_DIR_NAME}/{EXCHANGE_HDFS_CONFIG}");
244247
exchange_manager_properties.insert(
245248
"hdfs.config.resources".to_string(),
246249
format!("{hdfs_config_dir}/core-site.xml,{hdfs_config_dir}/hdfs-site.xml"),
@@ -308,8 +311,8 @@ impl ResolvedFaultTolerantExecutionConfig {
308311
}
309312

310313
fn resolve_hdfs_backend(&mut self, hdfs_config: &HdfsExchangeConfig) {
311-
let hdfs_config_dir = format!("{CONFIG_DIR_NAME}/exchange-hdfs-config");
312-
let volume_name = "exchange-hdfs-config".to_string();
314+
let hdfs_config_dir = format!("{CONFIG_DIR_NAME}/{EXCHANGE_HDFS_CONFIG}");
315+
let volume_name = EXCHANGE_HDFS_CONFIG.to_string();
313316

314317
self.volumes.push(
315318
VolumeBuilder::new(&volume_name)

rust/operator-binary/src/controller/build/properties/config_properties.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ const DEFAULT_NODE_SCHEDULER_INCLUDE_COORDINATOR: &str = "false";
5757

5858
const LOG_FILE_COUNT: u32 = 2;
5959

60+
// TLS keystore/truststore file names (PKCS#12).
61+
const KEYSTORE_P12: &str = "keystore.p12";
62+
const TRUSTSTORE_P12: &str = "truststore.p12";
63+
6064
#[derive(Debug, Snafu)]
6165
pub enum Error {
6266
#[snafu(display(
@@ -153,15 +157,15 @@ pub fn build(
153157
};
154158
props.insert(
155159
HTTP_SERVER_KEYSTORE_PATH.to_string(),
156-
format!("{tls_store_dir}/keystore.p12"),
160+
format!("{tls_store_dir}/{KEYSTORE_P12}"),
157161
);
158162
props.insert(
159163
HTTP_SERVER_HTTPS_KEYSTORE_KEY.to_string(),
160164
STACKABLE_TLS_STORE_PASSWORD.to_string(),
161165
);
162166
props.insert(
163167
HTTP_SERVER_TRUSTSTORE_PATH.to_string(),
164-
format!("{tls_store_dir}/truststore.p12"),
168+
format!("{tls_store_dir}/{TRUSTSTORE_P12}"),
165169
);
166170
props.insert(
167171
HTTP_SERVER_HTTPS_TRUSTSTORE_KEY.to_string(),
@@ -171,15 +175,15 @@ pub fn build(
171175
if internal_tls_enabled {
172176
props.insert(
173177
INTERNAL_COMMUNICATION_HTTPS_KEYSTORE_PATH.to_string(),
174-
format!("{STACKABLE_INTERNAL_TLS_DIR}/keystore.p12"),
178+
format!("{STACKABLE_INTERNAL_TLS_DIR}/{KEYSTORE_P12}"),
175179
);
176180
props.insert(
177181
INTERNAL_COMMUNICATION_HTTPS_KEYSTORE_KEY.to_string(),
178182
STACKABLE_TLS_STORE_PASSWORD.to_string(),
179183
);
180184
props.insert(
181185
INTERNAL_COMMUNICATION_HTTPS_TRUSTSTORE_PATH.to_string(),
182-
format!("{STACKABLE_INTERNAL_TLS_DIR}/truststore.p12"),
186+
format!("{STACKABLE_INTERNAL_TLS_DIR}/{TRUSTSTORE_P12}"),
183187
);
184188
props.insert(
185189
INTERNAL_COMMUNICATION_HTTPS_TRUSTSTORE_KEY.to_string(),

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ pub const ENV_INTERNAL_SECRET: &str = "INTERNAL_SECRET";
8686
pub const ENV_SPOOLING_SECRET: &str = "SPOOLING_SECRET";
8787
// TLS
8888
const TLS_DEFAULT_SECRET_CLASS: &str = "tls";
89+
// Listener
90+
pub const DEFAULT_LISTENER_CLASS: &str = "cluster-internal";
8991
// Logging
9092
pub const MAX_TRINO_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity {
9193
value: 10.0,
@@ -374,7 +376,7 @@ impl Default for v1alpha1::TrinoCoordinatorRoleConfig {
374376
}
375377

376378
fn coordinator_default_listener_class() -> ListenerClassName {
377-
ListenerClassName::from_str("cluster-internal")
379+
ListenerClassName::from_str(DEFAULT_LISTENER_CLASS)
378380
.expect("the default listener class name must be valid")
379381
}
380382

0 commit comments

Comments
 (0)