Skip to content

Commit fca4a81

Browse files
committed
fix: remove unused errors & cleanup
1 parent dc2e15c commit fca4a81

5 files changed

Lines changed: 40 additions & 61 deletions

File tree

extra/crds.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ spec:
881881
properties:
882882
listenerClass:
883883
default: cluster-internal
884-
description: This field controls which [ListenerClass](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass.html) is used to expose the coordinator.
884+
description: This field controls which [ListenerClass](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass.html) is used to expose the metastore.
885885
type: string
886886
podDisruptionBudget:
887887
default:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ pub async fn build_discovery_configmaps(
4848
chroot: Option<&str>,
4949
listener: Listener,
5050
) -> Result<Vec<ConfigMap>, Error> {
51-
let discovery_configmaps =
52-
vec![build_discovery_configmap(cluster, hive_role, chroot, listener)?];
51+
let discovery_configmaps = vec![build_discovery_configmap(
52+
cluster, hive_role, chroot, listener,
53+
)?];
5354

5455
Ok(discovery_configmaps)
5556
}

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

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ const DEFAULT_WAREHOUSE_DIR: &str = "/stackable/warehouse";
2121
const HIVE_METASTORE_PORT: &str = "hive.metastore.port";
2222
const DEFAULT_HIVE_METASTORE_PORT: &str = "9083";
2323

24+
// Metastore property keys.
25+
const CONNECTION_DRIVER_NAME: &str = "javax.jdo.option.ConnectionDriverName";
26+
const CONNECTION_PASSWORD: &str = "javax.jdo.option.ConnectionPassword";
27+
const CONNECTION_URL: &str = "javax.jdo.option.ConnectionURL";
28+
const CONNECTION_USER_NAME: &str = "javax.jdo.option.ConnectionUserName";
29+
const METASTORE_METRICS_ENABLED: &str = "hive.metastore.metrics.enabled";
30+
const METASTORE_WAREHOUSE_DIR: &str = "hive.metastore.warehouse.dir";
31+
32+
// S3 property keys.
33+
const S3_ACCESS_KEY: &str = "fs.s3a.access.key";
34+
const S3_ENDPOINT: &str = "fs.s3a.endpoint";
35+
const S3_PATH_STYLE_ACCESS: &str = "fs.s3a.path.style.access";
36+
const S3_REGION_NAME: &str = "fs.s3a.endpoint.region";
37+
const S3_SECRET_KEY: &str = "fs.s3a.secret.key";
38+
const S3_SSL_ENABLED: &str = "fs.s3a.connection.ssl.enabled";
39+
2440
#[derive(Debug, Snafu)]
2541
pub enum Error {
2642
#[snafu(display("failed to configure S3 connection"))]
@@ -49,62 +65,47 @@ pub fn build(
4965

5066
// 2. Automatic / operator-injected.
5167
data.insert(
52-
MetaStoreConfig::METASTORE_WAREHOUSE_DIR.to_string(),
68+
METASTORE_WAREHOUSE_DIR.to_string(),
5369
DEFAULT_WAREHOUSE_DIR.to_string(),
5470
);
55-
data.insert(
56-
MetaStoreConfig::METASTORE_METRICS_ENABLED.to_string(),
57-
"true".to_string(),
58-
);
71+
data.insert(METASTORE_METRICS_ENABLED.to_string(), "true".to_string());
5972

6073
data.insert(
61-
MetaStoreConfig::CONNECTION_DRIVER_NAME.to_string(),
74+
CONNECTION_DRIVER_NAME.to_string(),
6275
cluster_config.connection_driver.clone(),
6376
);
6477
data.insert(
65-
MetaStoreConfig::CONNECTION_URL.to_string(),
78+
CONNECTION_URL.to_string(),
6679
database_connection_details.connection_url.to_string(),
6780
);
6881
if let Some(EnvVar { name, .. }) = &database_connection_details.username_env {
69-
data.insert(
70-
MetaStoreConfig::CONNECTION_USER_NAME.to_string(),
71-
format!("${{env:{name}}}"),
72-
);
82+
data.insert(CONNECTION_USER_NAME.to_string(), format!("${{env:{name}}}"));
7383
}
7484
if let Some(EnvVar { name, .. }) = &database_connection_details.password_env {
75-
data.insert(
76-
MetaStoreConfig::CONNECTION_PASSWORD.to_string(),
77-
format!("${{env:{name}}}"),
78-
);
85+
data.insert(CONNECTION_PASSWORD.to_string(), format!("${{env:{name}}}"));
7986
}
8087

8188
if let Some(s3) = cluster_config.s3_connection_spec.as_ref() {
8289
data.insert(
83-
MetaStoreConfig::S3_ENDPOINT.to_string(),
90+
S3_ENDPOINT.to_string(),
8491
s3.endpoint()
8592
.context(ConfigureS3ConnectionSnafu)?
8693
.to_string(),
8794
);
88-
data.insert(
89-
MetaStoreConfig::S3_REGION_NAME.to_string(),
90-
s3.region.name.clone(),
91-
);
95+
data.insert(S3_REGION_NAME.to_string(), s3.region.name.clone());
9296
if let Some((access_key_file, secret_key_file)) = s3.credentials_mount_paths() {
9397
data.insert(
94-
MetaStoreConfig::S3_ACCESS_KEY.to_string(),
98+
S3_ACCESS_KEY.to_string(),
9599
format!("${{file:UTF-8:{access_key_file}}}"),
96100
);
97101
data.insert(
98-
MetaStoreConfig::S3_SECRET_KEY.to_string(),
102+
S3_SECRET_KEY.to_string(),
99103
format!("${{file:UTF-8:{secret_key_file}}}"),
100104
);
101105
}
106+
data.insert(S3_SSL_ENABLED.to_string(), s3.tls.uses_tls().to_string());
102107
data.insert(
103-
MetaStoreConfig::S3_SSL_ENABLED.to_string(),
104-
s3.tls.uses_tls().to_string(),
105-
);
106-
data.insert(
107-
MetaStoreConfig::S3_PATH_STYLE_ACCESS.to_string(),
108+
S3_PATH_STYLE_ACCESS.to_string(),
108109
(s3.access_style == s3::v1alpha1::S3AccessStyle::Path).to_string(),
109110
);
110111
}
@@ -120,10 +121,7 @@ pub fn build(
120121

121122
// 3. Spec: warehouse dir from the merged CRD config (overrides the default).
122123
if let Some(warehouse_dir) = &merged_config.warehouse_dir {
123-
data.insert(
124-
MetaStoreConfig::METASTORE_WAREHOUSE_DIR.to_string(),
125-
warehouse_dir.clone(),
126-
);
124+
data.insert(METASTORE_WAREHOUSE_DIR.to_string(), warehouse_dir.clone());
127125
}
128126

129127
// 4. User overrides (highest precedence).

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

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ pub type HiveRoleGroupType =
8484

8585
#[derive(Snafu, Debug)]
8686
pub enum Error {
87-
#[snafu(display("no metastore role configuration provided"))]
88-
MissingMetaStoreRole,
89-
9087
#[snafu(display("fragment validation failure"))]
9188
FragmentValidationFailure { source: ValidationError },
9289

@@ -155,7 +152,7 @@ pub mod versioned {
155152
#[serde(flatten)]
156153
pub common: GenericRoleConfig,
157154

158-
/// This field controls which [ListenerClass](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass.html) is used to expose the coordinator.
155+
/// This field controls which [ListenerClass](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass.html) is used to expose the metastore.
159156
#[serde(default = "metastore_default_listener_class")]
160157
pub listener_class: String,
161158
}
@@ -467,21 +464,6 @@ pub struct MetaStoreConfig {
467464
}
468465

469466
impl MetaStoreConfig {
470-
pub const CONNECTION_DRIVER_NAME: &'static str = "javax.jdo.option.ConnectionDriverName";
471-
pub const CONNECTION_PASSWORD: &'static str = "javax.jdo.option.ConnectionPassword";
472-
// metastore
473-
pub const CONNECTION_URL: &'static str = "javax.jdo.option.ConnectionURL";
474-
pub const CONNECTION_USER_NAME: &'static str = "javax.jdo.option.ConnectionUserName";
475-
pub const METASTORE_METRICS_ENABLED: &'static str = "hive.metastore.metrics.enabled";
476-
pub const METASTORE_WAREHOUSE_DIR: &'static str = "hive.metastore.warehouse.dir";
477-
pub const S3_ACCESS_KEY: &'static str = "fs.s3a.access.key";
478-
// S3
479-
pub const S3_ENDPOINT: &'static str = "fs.s3a.endpoint";
480-
pub const S3_PATH_STYLE_ACCESS: &'static str = "fs.s3a.path.style.access";
481-
pub const S3_REGION_NAME: &'static str = "fs.s3a.endpoint.region";
482-
pub const S3_SECRET_KEY: &'static str = "fs.s3a.secret.key";
483-
pub const S3_SSL_ENABLED: &'static str = "fs.s3a.connection.ssl.enabled";
484-
485467
pub(crate) fn default_config(cluster_name: &str, role: &HiveRole) -> MetaStoreConfigFragment {
486468
MetaStoreConfigFragment {
487469
warehouse_dir: None,

rust/operator-binary/src/kerberos.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,20 @@ pub fn kerberos_config_properties(
7979
let cluster_domain = &cluster_info.cluster_domain;
8080
let principal_host_part =
8181
format!("{hive_name}.{hive_namespace}.svc.{cluster_domain}@${{env.KERBEROS_REALM}}");
82+
let metastore_principal = format!(
83+
"{service_name}/{principal_host_part}",
84+
service_name = HiveRole::MetaStore.kerberos_service_name()
85+
);
8286

8387
BTreeMap::from([
8488
// Kerberos settings
8589
(
8690
"hive.metastore.kerberos.principal".to_string(),
87-
format!(
88-
"{service_name}/{principal_host_part}",
89-
service_name = HiveRole::MetaStore.kerberos_service_name()
90-
),
91+
metastore_principal.clone(),
9192
),
9293
(
9394
"hive.metastore.client.kerberos.principal".to_string(),
94-
format!(
95-
"{service_name}/{principal_host_part}",
96-
service_name = HiveRole::MetaStore.kerberos_service_name()
97-
),
95+
metastore_principal,
9896
),
9997
(
10098
"hive.metastore.kerberos.keytab.file".to_string(),

0 commit comments

Comments
 (0)