Skip to content

chore: Update templated files (f1f1a9e) #663

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 6 commits into from
Apr 3, 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
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE/pre-release-rust-deps.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bump Rust Dependencies for Stackable Release XX.(X)X
# Bump Rust Dependencies for Stackable Release YY.M.X

<!--
Make sure to update the link in 'issues/.github/ISSUE_TEMPLATE/pre-release-operator-rust-deps.md'
Expand Down Expand Up @@ -32,7 +32,7 @@ Part of <https://github.com/stackabletech/issues/issues/TRACKING_ISSUE>

```[tasklist]
### Bump Rust Dependencies
- [ ] Bump `stackable-operator` and friends.
- [ ] Bump `product-version`.
- [ ] Bump all other dependencies.
- [ ] Bump `stackable-operator` and friends
- [ ] Bump `product-config`
- [ ] Bump all other dependencies
```
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
RUST_TOOLCHAIN_VERSION: "1.84.1"
RUST_TOOLCHAIN_VERSION: "1.85.0"
RUST_NIGHTLY_TOOLCHAIN_VERSION: "nightly-2025-01-15"
PYTHON_VERSION: "3.12"
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: "-D warnings"
Expand Down Expand Up @@ -136,9 +137,11 @@ jobs:
submodules: recursive
- uses: dtolnay/rust-toolchain@c5a29ddb4d9d194e7c84ec8c3fba61b1c31fee8c
with:
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
components: rustfmt
- run: cargo fmt --all -- --check
- env:
RUST_TOOLCHAIN_VERSION: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
run: cargo "+$RUST_TOOLCHAIN_VERSION" fmt --all -- --check

run_clippy:
name: Run Clippy
Expand Down
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rust-analyzer.rustfmt.overrideCommand": [
"rustfmt",
"+nightly-2025-01-15",
"--"
],
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# DO NOT EDIT, this file is generated by operator-templating
[toolchain]
channel = "1.84.1"
channel = "1.85.0"
5 changes: 3 additions & 2 deletions rust/operator-binary/src/config/jvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use stackable_operator::{
};

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

Expand Down Expand Up @@ -186,7 +186,8 @@ mod tests {
-Dhttps.proxyHost=proxy.my.corp \
-Djava.net.preferIPv4Stack=true \
-Xmx40000m \
-Dhttps.proxyPort=1234")
-Dhttps.proxyPort=1234"
)
);
}

Expand Down
11 changes: 6 additions & 5 deletions rust/operator-binary/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ use product_config::writer::to_hadoop_xml;
use stackable_operator::utils::cluster_info::KubernetesClusterInfo;

use crate::crd::{
HdfsPodRef,
constants::{
DEFAULT_JOURNAL_NODE_RPC_PORT, DEFAULT_NAME_NODE_HTTPS_PORT, DEFAULT_NAME_NODE_HTTP_PORT,
DEFAULT_JOURNAL_NODE_RPC_PORT, DEFAULT_NAME_NODE_HTTP_PORT, DEFAULT_NAME_NODE_HTTPS_PORT,
DEFAULT_NAME_NODE_RPC_PORT, DFS_DATANODE_DATA_DIR, DFS_HA_NAMENODES,
DFS_JOURNALNODE_EDITS_DIR, DFS_JOURNALNODE_RPC_ADDRESS, DFS_NAMENODE_HTTPS_ADDRESS,
DFS_NAMENODE_HTTP_ADDRESS, DFS_NAMENODE_NAME_DIR, DFS_NAMENODE_RPC_ADDRESS,
DFS_NAMENODE_SHARED_EDITS_DIR, DFS_NAME_SERVICES, DFS_REPLICATION, FS_DEFAULT_FS,
DFS_JOURNALNODE_EDITS_DIR, DFS_JOURNALNODE_RPC_ADDRESS, DFS_NAME_SERVICES,
DFS_NAMENODE_HTTP_ADDRESS, DFS_NAMENODE_HTTPS_ADDRESS, DFS_NAMENODE_NAME_DIR,
DFS_NAMENODE_RPC_ADDRESS, DFS_NAMENODE_SHARED_EDITS_DIR, DFS_REPLICATION, FS_DEFAULT_FS,
HA_ZOOKEEPER_QUORUM, JOURNALNODE_ROOT_DATA_DIR, NAMENODE_ROOT_DATA_DIR,
SERVICE_PORT_NAME_HTTP, SERVICE_PORT_NAME_HTTPS, SERVICE_PORT_NAME_RPC,
},
storage::{DataNodeStorageConfig, DataNodeStorageConfigInnerType},
v1alpha1, HdfsPodRef,
v1alpha1,
};

pub mod jvm;
Expand Down
107 changes: 47 additions & 60 deletions rust/operator-binary/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ use stackable_operator::{
builder::{
self,
pod::{
PodBuilder,
container::ContainerBuilder,
resources::ResourceRequirementsBuilder,
volume::{
ListenerOperatorVolumeSourceBuilder, ListenerOperatorVolumeSourceBuilderError,
ListenerReference, SecretFormat, SecretOperatorVolumeSourceBuilder,
SecretOperatorVolumeSourceBuilderError, VolumeBuilder, VolumeMountBuilder,
},
PodBuilder,
},
},
commons::product_image_selection::ResolvedProductImage,
Expand All @@ -36,19 +36,19 @@ use stackable_operator::{
},
apimachinery::pkg::util::intstr::IntOrString,
},
kube::{core::ObjectMeta, ResourceExt},
kube::{ResourceExt, core::ObjectMeta},
kvp::Labels,
product_logging::{
self,
framework::{
create_vector_shutdown_file_command, remove_vector_shutdown_file_command, LoggingError,
LoggingError, create_vector_shutdown_file_command, remove_vector_shutdown_file_command,
},
spec::{
ConfigMapLogConfig, ContainerLogConfig, ContainerLogConfigChoice,
CustomContainerLogConfig,
},
},
utils::{cluster_info::KubernetesClusterInfo, COMMON_BASH_TRAP_FUNCTIONS},
utils::{COMMON_BASH_TRAP_FUNCTIONS, cluster_info::KubernetesClusterInfo},
};
use strum::{Display, EnumDiscriminants, IntoStaticStr};

Expand All @@ -58,6 +58,8 @@ use crate::{
jvm::{construct_global_jvm_args, construct_role_specific_jvm_args},
},
crd::{
AnyNodeConfig, DataNodeContainer, HdfsNodeRole, HdfsPodRef, NameNodeContainer,
UpgradeState,
constants::{
DATANODE_ROOT_DATA_DIR_PREFIX, DEFAULT_DATA_NODE_METRICS_PORT,
DEFAULT_JOURNAL_NODE_METRICS_PORT, DEFAULT_NAME_NODE_METRICS_PORT, LISTENER_VOLUME_DIR,
Expand All @@ -69,8 +71,7 @@ use crate::{
SERVICE_PORT_NAME_RPC, STACKABLE_ROOT_DATA_DIR,
},
storage::DataNodeStorageConfig,
v1alpha1, AnyNodeConfig, DataNodeContainer, HdfsNodeRole, HdfsPodRef, NameNodeContainer,
UpgradeState,
v1alpha1,
},
product_logging::{
FORMAT_NAMENODES_LOG4J_CONFIG_FILE, FORMAT_ZOOKEEPER_LOG4J_CONFIG_FILE,
Expand Down Expand Up @@ -104,10 +105,9 @@ pub enum Error {
role: String,
},

#[snafu(
display("could not determine any ContainerConfig actions for {container_name:?}. Container not recognized."
)
)]
#[snafu(display(
"could not determine any ContainerConfig actions for {container_name:?}. Container not recognized."
))]
UnrecognizedContainerName { container_name: String },

#[snafu(display("invalid container name {name:?}"))]
Expand Down Expand Up @@ -191,22 +191,20 @@ pub enum ContainerConfig {
}

impl ContainerConfig {
// volumes
pub const STACKABLE_LOG_VOLUME_MOUNT_NAME: &'static str = "log";
pub const DATA_VOLUME_MOUNT_NAME: &'static str = "data";
pub const HDFS_CONFIG_VOLUME_MOUNT_NAME: &'static str = "hdfs-config";

const HDFS_LOG_VOLUME_MOUNT_NAME: &'static str = "hdfs-log-config";
const ZKFC_CONFIG_VOLUME_MOUNT_NAME: &'static str = "zkfc-config";
const ZKFC_LOG_VOLUME_MOUNT_NAME: &'static str = "zkfc-log-config";
const FORMAT_NAMENODES_CONFIG_VOLUME_MOUNT_NAME: &'static str = "format-namenodes-config";
const FORMAT_NAMENODES_LOG_VOLUME_MOUNT_NAME: &'static str = "format-namenodes-log-config";
const FORMAT_ZOOKEEPER_CONFIG_VOLUME_MOUNT_NAME: &'static str = "format-zookeeper-config";
const FORMAT_ZOOKEEPER_LOG_VOLUME_MOUNT_NAME: &'static str = "format-zookeeper-log-config";
const HADOOP_HOME: &'static str = "/stackable/hadoop";
pub const HDFS_CONFIG_VOLUME_MOUNT_NAME: &'static str = "hdfs-config";
const HDFS_LOG_VOLUME_MOUNT_NAME: &'static str = "hdfs-log-config";
// volumes
pub const STACKABLE_LOG_VOLUME_MOUNT_NAME: &'static str = "log";
const WAIT_FOR_NAMENODES_CONFIG_VOLUME_MOUNT_NAME: &'static str = "wait-for-namenodes-config";
const WAIT_FOR_NAMENODES_LOG_VOLUME_MOUNT_NAME: &'static str = "wait-for-namenodes-log-config";

const HADOOP_HOME: &'static str = "/stackable/hadoop";
const ZKFC_CONFIG_VOLUME_MOUNT_NAME: &'static str = "zkfc-config";
const ZKFC_LOG_VOLUME_MOUNT_NAME: &'static str = "zkfc-log-config";

/// Add all main, side and init containers as well as required volumes to the pod builder.
#[allow(clippy::too_many_arguments)]
Expand Down Expand Up @@ -802,7 +800,9 @@ wait_for_termination $!

// Command to export `KERBEROS_REALM` env var to default real from krb5.conf, e.g. `CLUSTER.LOCAL`
fn export_kerberos_real_env_var_command() -> String {
format!("export KERBEROS_REALM=$(grep -oP 'default_realm = \\K.*' {KERBEROS_CONTAINER_PATH}/krb5.conf)\n")
format!(
"export KERBEROS_REALM=$(grep -oP 'default_realm = \\K.*' {KERBEROS_CONTAINER_PATH}/krb5.conf)\n"
)
}

/// Command to `kinit` a ticket using the principal created for the specified hdfs role
Expand Down Expand Up @@ -869,52 +869,37 @@ wait_for_termination $!
// See https://github.com/stackabletech/hdfs-operator/issues/138 for details
if let ContainerConfig::Hdfs { role, .. } = self {
let role_opts_name = role.hadoop_opts_env_var_for_role().to_string();
env.insert(
role_opts_name.clone(),
EnvVar {
name: role_opts_name,
value: Some(self.build_hadoop_opts(hdfs, role_group, resources)?),
..EnvVar::default()
},
);
env.insert(role_opts_name.clone(), EnvVar {
name: role_opts_name,
value: Some(self.build_hadoop_opts(hdfs, role_group, resources)?),
..EnvVar::default()
});
}

env.insert(
"HADOOP_OPTS".to_string(),
EnvVar {
name: "HADOOP_OPTS".to_string(),
value: Some(construct_global_jvm_args(hdfs.has_kerberos_enabled())),
..EnvVar::default()
},
);
env.insert("HADOOP_OPTS".to_string(), EnvVar {
name: "HADOOP_OPTS".to_string(),
value: Some(construct_global_jvm_args(hdfs.has_kerberos_enabled())),
..EnvVar::default()
});
if hdfs.has_kerberos_enabled() {
env.insert(
"KRB5_CONFIG".to_string(),
EnvVar {
name: "KRB5_CONFIG".to_string(),
value: Some(format!("{KERBEROS_CONTAINER_PATH}/krb5.conf")),
..EnvVar::default()
},
);
env.insert(
"KRB5_CLIENT_KTNAME".to_string(),
EnvVar {
name: "KRB5_CLIENT_KTNAME".to_string(),
value: Some(format!("{KERBEROS_CONTAINER_PATH}/keytab")),
..EnvVar::default()
},
);
env.insert("KRB5_CONFIG".to_string(), EnvVar {
name: "KRB5_CONFIG".to_string(),
value: Some(format!("{KERBEROS_CONTAINER_PATH}/krb5.conf")),
..EnvVar::default()
});
env.insert("KRB5_CLIENT_KTNAME".to_string(), EnvVar {
name: "KRB5_CLIENT_KTNAME".to_string(),
value: Some(format!("{KERBEROS_CONTAINER_PATH}/keytab")),
..EnvVar::default()
});
}

// Needed for the `containerdebug` process to log it's tracing information to.
env.insert(
"CONTAINERDEBUG_LOG_DIRECTORY".to_string(),
EnvVar {
name: "CONTAINERDEBUG_LOG_DIRECTORY".to_string(),
value: Some(format!("{STACKABLE_LOG_DIR}/containerdebug")),
value_from: None,
},
);
env.insert("CONTAINERDEBUG_LOG_DIRECTORY".to_string(), EnvVar {
name: "CONTAINERDEBUG_LOG_DIRECTORY".to_string(),
value: Some(format!("{STACKABLE_LOG_DIR}/containerdebug")),
value_from: None,
});

// Overrides need to come last
let mut env_override_vars: BTreeMap<String, EnvVar> =
Expand Down Expand Up @@ -1457,13 +1442,15 @@ impl ContainerVolumeDirs {
pub fn config_mount(&self) -> &str {
self.config_mount.as_str()
}

pub fn config_mount_name(&self) -> &str {
self.config_mount_name.as_str()
}

pub fn log_mount(&self) -> &str {
self.log_mount.as_str()
}

pub fn log_mount_name(&self) -> &str {
self.log_mount_name.as_str()
}
Expand Down
Loading
Loading