Skip to content

chore: Version CRD and HdfsClusterConfig #651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
316 changes: 272 additions & 44 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["rust/crd", "rust/operator-binary"]
members = ["rust/operator-binary"]
resolver = "2"

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

[workspace.dependencies]
stackable-versioned = { git = "https://github.com/stackabletech/operator-rs.git", features = ["k8s"], tag = "stackable-versioned-0.5.0" }
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.85.0" }
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }

anyhow = "1.0"
built = { version = "0.7", features = ["chrono", "git2"] }
clap = "4.5"
Expand All @@ -22,8 +26,6 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
snafu = "0.8"
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.85.0" }
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
strum = { version = "0.26", features = ["derive"] }
tokio = { version = "1.40", features = ["full"] }
tracing = "0.1"
Expand Down
24 changes: 0 additions & 24 deletions rust/crd/Cargo.toml

This file was deleted.

6 changes: 3 additions & 3 deletions rust/operator-binary/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ repository.workspace = true
publish = false

[dependencies]
stackable-hdfs-crd = { path = "../crd" }
stackable-versioned.workspace = true
stackable-operator.workspace = true
product-config.workspace = true

anyhow.workspace = true
clap.workspace = true
const_format.workspace = true
futures.workspace = true
indoc.workspace = true
product-config.workspace = true
serde_json.workspace = true
serde.workspace = true
snafu.workspace = true
stackable-operator.workspace = true
strum.workspace = true
tokio.workspace = true
tracing-futures.workspace = true
Expand Down
20 changes: 11 additions & 9 deletions rust/operator-binary/src/config/jvm.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use snafu::{ResultExt, Snafu};
use stackable_hdfs_crd::{constants::JVM_SECURITY_PROPERTIES_FILE, HdfsCluster, HdfsRole};
use stackable_operator::{
k8s_openapi::api::core::v1::ResourceRequirements,
memory::{BinaryMultiple, MemoryQuantity},
role_utils::JvmArgumentOverrides,
};

use crate::security::kerberos::KERBEROS_CONTAINER_PATH;
use crate::{
crd::{constants::JVM_SECURITY_PROPERTIES_FILE, v1alpha1, HdfsNodeRole},
security::kerberos::KERBEROS_CONTAINER_PATH,
};

const JVM_HEAP_FACTOR: f32 = 0.8;

Expand All @@ -19,7 +21,7 @@ pub enum Error {
},

#[snafu(display("failed to merge jvm argument overrides"))]
MergeJvmArgumentOverrides { source: stackable_hdfs_crd::Error },
MergeJvmArgumentOverrides { source: crate::crd::Error },
}

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

pub fn construct_role_specific_jvm_args(
hdfs: &HdfsCluster,
hdfs_role: &HdfsRole,
hdfs: &v1alpha1::HdfsCluster,
hdfs_role: &HdfsNodeRole,
role_group: &str,
kerberos_enabled: bool,
resources: Option<&ResourceRequirements>,
Expand Down Expand Up @@ -97,10 +99,9 @@ pub fn construct_role_specific_jvm_args(

#[cfg(test)]
mod tests {
use stackable_hdfs_crd::{constants::DEFAULT_NAME_NODE_METRICS_PORT, HdfsCluster};

use super::*;
use crate::container::ContainerConfig;
use crate::{container::ContainerConfig, crd::constants::DEFAULT_NAME_NODE_METRICS_PORT};

#[test]
fn test_global_jvm_args() {
Expand Down Expand Up @@ -190,9 +191,10 @@ mod tests {
}

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

let role = HdfsRole::NameNode;
let role = HdfsNodeRole::Name;
let merged_config = role.merged_config(&hdfs, "default").unwrap();
let container_config = ContainerConfig::from(role);
let resources = container_config.resources(&merged_config);
Expand Down
9 changes: 5 additions & 4 deletions rust/operator-binary/src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use std::collections::BTreeMap;

use product_config::writer::to_hadoop_xml;
use stackable_hdfs_crd::{
use stackable_operator::utils::cluster_info::KubernetesClusterInfo;

use crate::crd::{
constants::{
DEFAULT_JOURNAL_NODE_RPC_PORT, DEFAULT_NAME_NODE_HTTPS_PORT, DEFAULT_NAME_NODE_HTTP_PORT,
DEFAULT_NAME_NODE_RPC_PORT, DFS_DATANODE_DATA_DIR, DFS_HA_NAMENODES,
Expand All @@ -12,9 +14,8 @@ use stackable_hdfs_crd::{
SERVICE_PORT_NAME_HTTP, SERVICE_PORT_NAME_HTTPS, SERVICE_PORT_NAME_RPC,
},
storage::{DataNodeStorageConfig, DataNodeStorageConfigInnerType},
HdfsCluster, HdfsPodRef,
v1alpha1, HdfsPodRef,
};
use stackable_operator::utils::cluster_info::KubernetesClusterInfo;

pub mod jvm;

Expand Down Expand Up @@ -162,7 +163,7 @@ impl HdfsSiteConfigBuilder {

pub fn dfs_namenode_http_address_ha(
&mut self,
hdfs: &HdfsCluster,
hdfs: &v1alpha1::HdfsCluster,
cluster_info: &KubernetesClusterInfo,
namenode_podrefs: &[HdfsPodRef],
) -> &mut Self {
Expand Down
Loading