Skip to content

Commit

Permalink
chore: Update templated files (9001281) (#650)
Browse files Browse the repository at this point in the history
* chore: Generated commit to update templated files since the last template run up to stackabletech/operator-templating@9001281

Reference-to: stackabletech/operator-templating@9001281 (Fix pre-commit hook)

* chore: Apply formatting

---------

Co-authored-by: Techassi <[email protected]>
  • Loading branch information
stackable-bot and Techassi authored Feb 4, 2025
1 parent 7990ead commit d95ecdd
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr_pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN_VERSION: "1.82.0"
RUST_TOOLCHAIN_VERSION: "nightly-2025-01-15"
HADOLINT_VERSION: "v2.12.0"
PYTHON_VERSION: "3.12"

Expand Down
11 changes: 7 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ repos:
- repo: https://github.com/doublify/pre-commit-rust
rev: eeee35a89e69d5772bdee97db1a6a898467b686e # 1.0
hooks:
- id: fmt
# Pinning to a specific rustc version, so that we get consistent formatting
entry: RUSTUP_TOOLCHAIN=nightly-2025-01-15 cargo fmt
args: ["--all", "--", "--check"]
- id: clippy
args: ["--all-targets", "--", "-D", "warnings"]

Expand Down Expand Up @@ -78,3 +74,10 @@ repos:
entry: cargo test
stages: [pre-commit, pre-merge-commit, manual]
pass_filenames: false

- id: cargo-rustfmt
name: cargo-rustfmt
language: system
entry: cargo +nightly-2025-01-15 fmt --all -- --check
stages: [pre-commit]
pass_filenames: false
5 changes: 3 additions & 2 deletions rust/crd/src/affinity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ pub fn get_affinity(cluster_name: &str, role: &HdfsRole) -> StackableAffinityFra

#[cfg(test)]
mod test {
use rstest::rstest;
use std::collections::BTreeMap;

use crate::{HdfsCluster, HdfsRole};
use rstest::rstest;
use stackable_operator::{
commons::affinity::StackableAffinity,
k8s_openapi::{
Expand All @@ -42,6 +41,8 @@ mod test {
},
};

use crate::{HdfsCluster, HdfsRole};

#[rstest]
#[case(HdfsRole::JournalNode)]
#[case(HdfsRole::NameNode)]
Expand Down
11 changes: 5 additions & 6 deletions rust/crd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use product_config::types::PropertyNameKind;
use security::AuthorizationConfig;
use serde::{Deserialize, Serialize};
use snafu::{OptionExt, ResultExt, Snafu};
#[cfg(doc)]
use stackable_operator::commons::listener::ListenerClass;
use stackable_operator::{
commons::{
affinity::StackableAffinity,
Expand Down Expand Up @@ -58,9 +60,6 @@ use crate::{
},
};

#[cfg(doc)]
use stackable_operator::commons::listener::ListenerClass;

pub mod affinity;
pub mod constants;
pub mod security;
Expand Down Expand Up @@ -1492,13 +1491,13 @@ where

#[cfg(test)]
mod test {
use crate::storage::HdfsStorageType;

use super::{HdfsCluster, HdfsRole};
use stackable_operator::k8s_openapi::{
api::core::v1::ResourceRequirements, apimachinery::pkg::api::resource::Quantity,
};

use super::{HdfsCluster, HdfsRole};
use crate::storage::HdfsStorageType;

#[test]
pub fn test_pvc_rolegroup_from_yaml() {
let cr = "
Expand Down
12 changes: 7 additions & 5 deletions rust/crd/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
use std::collections::BTreeMap;

use crate::constants::*;
use serde::{Deserialize, Serialize};
use stackable_operator::config::merge::{Atomic, Merge};
use stackable_operator::{
commons::resources::PvcConfig,
config::fragment::Fragment,
config::{
fragment::Fragment,
merge::{Atomic, Merge},
},
k8s_openapi::api::core::v1::PersistentVolumeClaim,
schemars::{self, JsonSchema},
};

use crate::constants::*;

#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Debug, Default, JsonSchema, PartialEq, Fragment)]
#[fragment_attrs(
Expand Down Expand Up @@ -182,11 +185,10 @@ impl HdfsStorageType {
mod test {
use std::collections::BTreeMap;

use stackable_operator::k8s_openapi::api::core::v1::VolumeResourceRequirements;
use stackable_operator::{
commons::resources::PvcConfig,
k8s_openapi::{
api::core::v1::PersistentVolumeClaimSpec,
api::core::v1::{PersistentVolumeClaimSpec, VolumeResourceRequirements},
apimachinery::pkg::{api::resource::Quantity, apis::meta::v1::LabelSelector},
},
};
Expand Down
3 changes: 1 addition & 2 deletions rust/operator-binary/src/config/jvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ pub fn construct_role_specific_jvm_args(
mod tests {
use stackable_hdfs_crd::{constants::DEFAULT_NAME_NODE_METRICS_PORT, HdfsCluster};

use crate::container::ContainerConfig;

use super::*;
use crate::container::ContainerConfig;

#[test]
fn test_global_jvm_args() {
Expand Down
25 changes: 14 additions & 11 deletions rust/operator-binary/src/config/mod.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
use std::collections::BTreeMap;

use product_config::writer::to_hadoop_xml;
use stackable_hdfs_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, 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, HA_ZOOKEEPER_QUORUM,
JOURNALNODE_ROOT_DATA_DIR, NAMENODE_ROOT_DATA_DIR, SERVICE_PORT_NAME_HTTP,
SERVICE_PORT_NAME_HTTPS, SERVICE_PORT_NAME_RPC,
use stackable_hdfs_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,
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,
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},
HdfsCluster, HdfsPodRef,
};
use stackable_hdfs_crd::storage::{DataNodeStorageConfig, DataNodeStorageConfigInnerType};
use stackable_hdfs_crd::{HdfsCluster, HdfsPodRef};
use stackable_operator::utils::cluster_info::KubernetesClusterInfo;
use std::collections::BTreeMap;

pub mod jvm;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use stackable_hdfs_crd::{
constants::{APP_NAME, FIELD_MANAGER_SCOPE},
HdfsCluster,
};
use stackable_operator::kube::ResourceExt;
use stackable_operator::{
commons::rbac::build_rbac_resources,
k8s_openapi::api::rbac::v1::{ClusterRoleBinding, Subject},
Expand All @@ -14,7 +13,7 @@ use stackable_operator::{
reflector::{ObjectRef, Store},
watcher,
},
Api, Client,
Api, Client, ResourceExt,
},
kvp::Labels,
};
Expand Down
9 changes: 4 additions & 5 deletions rust/operator-binary/src/hdfs_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ use product_config::{
ProductConfigManager,
};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_hdfs_crd::{
constants::*, AnyNodeConfig, HdfsCluster, HdfsClusterStatus, HdfsPodRef, HdfsRole,
UpgradeState, UpgradeStateError,
};
use stackable_operator::{
builder::{
configmap::ConfigMapBuilder,
Expand Down Expand Up @@ -50,11 +54,6 @@ use stackable_operator::{
};
use strum::{EnumDiscriminants, IntoEnumIterator, IntoStaticStr};

use stackable_hdfs_crd::{
constants::*, AnyNodeConfig, HdfsCluster, HdfsClusterStatus, HdfsPodRef, HdfsRole,
UpgradeState, UpgradeStateError,
};

use crate::{
build_recommended_labels,
config::{CoreSiteConfigBuilder, HdfsSiteConfigBuilder},
Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/operations/pdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ fn max_unavailable_data_nodes(num_datanodes: u16, dfs_replication: u16) -> u16 {

#[cfg(test)]
mod test {
use super::*;
use rstest::rstest;

use super::*;

#[rstest]
#[case(0, 0, 1)]
#[case(0, 1, 1)]
Expand Down

0 comments on commit d95ecdd

Please sign in to comment.