Skip to content

Commit 8342a54

Browse files
authored
chore: Version CRD and HdfsClusterConfig (#651)
* chore: Remove separate CRD crate * chore: Remove unused items * chore: Fix clippy errors * docs: Fix invalid rustdoc reference * chore: Version HdfsCluster * chore: Move HdfsCluster impl blocks * chore: Version HdfsClusterConfig
1 parent d95ecdd commit 8342a54

22 files changed

+1057
-831
lines changed

Cargo.lock

Lines changed: 272 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
members = ["rust/crd", "rust/operator-binary"]
2+
members = ["rust/operator-binary"]
33
resolver = "2"
44

55
[workspace.package]
@@ -10,6 +10,10 @@ edition = "2021"
1010
repository = "https://github.com/stackabletech/hdfs-operator"
1111

1212
[workspace.dependencies]
13+
stackable-versioned = { git = "https://github.com/stackabletech/operator-rs.git", features = ["k8s"], tag = "stackable-versioned-0.5.0" }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.85.0" }
15+
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
16+
1317
anyhow = "1.0"
1418
built = { version = "0.7", features = ["chrono", "git2"] }
1519
clap = "4.5"
@@ -22,8 +26,6 @@ serde = { version = "1.0", features = ["derive"] }
2226
serde_json = "1.0"
2327
serde_yaml = "0.9"
2428
snafu = "0.8"
25-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.85.0" }
26-
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
2729
strum = { version = "0.26", features = ["derive"] }
2830
tokio = { version = "1.40", features = ["full"] }
2931
tracing = "0.1"

rust/crd/Cargo.toml

Lines changed: 0 additions & 24 deletions
This file was deleted.

rust/operator-binary/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ repository.workspace = true
99
publish = false
1010

1111
[dependencies]
12-
stackable-hdfs-crd = { path = "../crd" }
12+
stackable-versioned.workspace = true
13+
stackable-operator.workspace = true
14+
product-config.workspace = true
1315

1416
anyhow.workspace = true
1517
clap.workspace = true
1618
const_format.workspace = true
1719
futures.workspace = true
1820
indoc.workspace = true
19-
product-config.workspace = true
2021
serde_json.workspace = true
2122
serde.workspace = true
2223
snafu.workspace = true
23-
stackable-operator.workspace = true
2424
strum.workspace = true
2525
tokio.workspace = true
2626
tracing-futures.workspace = true

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
use snafu::{ResultExt, Snafu};
2-
use stackable_hdfs_crd::{constants::JVM_SECURITY_PROPERTIES_FILE, HdfsCluster, HdfsRole};
32
use stackable_operator::{
43
k8s_openapi::api::core::v1::ResourceRequirements,
54
memory::{BinaryMultiple, MemoryQuantity},
65
role_utils::JvmArgumentOverrides,
76
};
87

9-
use crate::security::kerberos::KERBEROS_CONTAINER_PATH;
8+
use crate::{
9+
crd::{constants::JVM_SECURITY_PROPERTIES_FILE, v1alpha1, HdfsNodeRole},
10+
security::kerberos::KERBEROS_CONTAINER_PATH,
11+
};
1012

1113
const JVM_HEAP_FACTOR: f32 = 0.8;
1214

@@ -19,7 +21,7 @@ pub enum Error {
1921
},
2022

2123
#[snafu(display("failed to merge jvm argument overrides"))]
22-
MergeJvmArgumentOverrides { source: stackable_hdfs_crd::Error },
24+
MergeJvmArgumentOverrides { source: crate::crd::Error },
2325
}
2426

2527
// All init or sidecar containers must have access to the following settings.
@@ -48,8 +50,8 @@ pub fn construct_global_jvm_args(kerberos_enabled: bool) -> String {
4850
}
4951

5052
pub fn construct_role_specific_jvm_args(
51-
hdfs: &HdfsCluster,
52-
hdfs_role: &HdfsRole,
53+
hdfs: &v1alpha1::HdfsCluster,
54+
hdfs_role: &HdfsNodeRole,
5355
role_group: &str,
5456
kerberos_enabled: bool,
5557
resources: Option<&ResourceRequirements>,
@@ -97,10 +99,9 @@ pub fn construct_role_specific_jvm_args(
9799

98100
#[cfg(test)]
99101
mod tests {
100-
use stackable_hdfs_crd::{constants::DEFAULT_NAME_NODE_METRICS_PORT, HdfsCluster};
101102

102103
use super::*;
103-
use crate::container::ContainerConfig;
104+
use crate::{container::ContainerConfig, crd::constants::DEFAULT_NAME_NODE_METRICS_PORT};
104105

105106
#[test]
106107
fn test_global_jvm_args() {
@@ -190,9 +191,10 @@ mod tests {
190191
}
191192

192193
fn construct_test_role_specific_jvm_args(hdfs_cluster: &str, kerberos_enabled: bool) -> String {
193-
let hdfs: HdfsCluster = serde_yaml::from_str(hdfs_cluster).expect("illegal test input");
194+
let hdfs: v1alpha1::HdfsCluster =
195+
serde_yaml::from_str(hdfs_cluster).expect("illegal test input");
194196

195-
let role = HdfsRole::NameNode;
197+
let role = HdfsNodeRole::Name;
196198
let merged_config = role.merged_config(&hdfs, "default").unwrap();
197199
let container_config = ContainerConfig::from(role);
198200
let resources = container_config.resources(&merged_config);

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use std::collections::BTreeMap;
22

33
use product_config::writer::to_hadoop_xml;
4-
use stackable_hdfs_crd::{
4+
use stackable_operator::utils::cluster_info::KubernetesClusterInfo;
5+
6+
use crate::crd::{
57
constants::{
68
DEFAULT_JOURNAL_NODE_RPC_PORT, DEFAULT_NAME_NODE_HTTPS_PORT, DEFAULT_NAME_NODE_HTTP_PORT,
79
DEFAULT_NAME_NODE_RPC_PORT, DFS_DATANODE_DATA_DIR, DFS_HA_NAMENODES,
@@ -12,9 +14,8 @@ use stackable_hdfs_crd::{
1214
SERVICE_PORT_NAME_HTTP, SERVICE_PORT_NAME_HTTPS, SERVICE_PORT_NAME_RPC,
1315
},
1416
storage::{DataNodeStorageConfig, DataNodeStorageConfigInnerType},
15-
HdfsCluster, HdfsPodRef,
17+
v1alpha1, HdfsPodRef,
1618
};
17-
use stackable_operator::utils::cluster_info::KubernetesClusterInfo;
1819

1920
pub mod jvm;
2021

@@ -162,7 +163,7 @@ impl HdfsSiteConfigBuilder {
162163

163164
pub fn dfs_namenode_http_address_ha(
164165
&mut self,
165-
hdfs: &HdfsCluster,
166+
hdfs: &v1alpha1::HdfsCluster,
166167
cluster_info: &KubernetesClusterInfo,
167168
namenode_podrefs: &[HdfsPodRef],
168169
) -> &mut Self {

0 commit comments

Comments
 (0)