Skip to content

Commit

Permalink
chore: Update templated files (9001281) (#689)
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

* chore: Bump openssl to 0.10.70 to fix RUSTSEC-2025-0004

---------

Co-authored-by: Techassi <[email protected]>
  • Loading branch information
stackable-bot and Techassi authored Feb 4, 2025
1 parent baeb6d3 commit 1a0a860
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 71 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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions rust/crd/src/affinity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,9 @@ pub fn get_affinity(

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

use rstest::rstest;
use std::collections::BTreeMap;

use crate::DruidCluster;
use rstest::rstest;
use stackable_operator::{
commons::affinity::StackableAffinity,
k8s_openapi::{
Expand All @@ -92,6 +89,9 @@ mod tests {
},
};

use super::*;
use crate::DruidCluster;

#[rstest]
#[case(DruidRole::Coordinator)]
#[case(DruidRole::Broker)]
Expand Down
11 changes: 3 additions & 8 deletions rust/crd/src/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,14 @@ impl AuthenticationClassesResolved {

#[cfg(test)]
mod tests {
use indoc::formatdoc;
use oidc::ClientAuthenticationOptions;

use crate::DruidClusterConfig;

use std::pin::Pin;

use indoc::indoc;
use indoc::{formatdoc, indoc};
use oidc::ClientAuthenticationOptions;
use stackable_operator::kube;

use super::*;

use crate::authentication::AuthenticationClassesResolved;
use crate::{authentication::AuthenticationClassesResolved, DruidClusterConfig};

const BASE_CLUSTER_CONFIG: &str = r#"
deepStorage:
Expand Down
15 changes: 8 additions & 7 deletions rust/crd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ pub mod security;
pub mod storage;
pub mod tls;

use crate::{
affinity::get_affinity,
authorization::DruidAuthorization,
resource::RoleResource,
tls::{default_druid_tls, DruidTls},
};
use std::collections::{BTreeMap, HashMap, HashSet};

use indoc::formatdoc;
use product_config::types::PropertyNameKind;
Expand Down Expand Up @@ -55,9 +50,15 @@ use stackable_operator::{
COMMON_BASH_TRAP_FUNCTIONS,
},
};
use std::collections::{BTreeMap, HashMap, HashSet};
use strum::{Display, EnumDiscriminants, EnumIter, EnumString, IntoStaticStr};

use crate::{
affinity::get_affinity,
authorization::DruidAuthorization,
resource::RoleResource,
tls::{default_druid_tls, DruidTls},
};

pub const APP_NAME: &str = "druid";
pub const OPERATOR_NAME: &str = "druid.stackable.tech";

Expand Down
3 changes: 2 additions & 1 deletion rust/crd/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ fn format_for_druid(memory_quantity: &MemoryQuantity) -> String {

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

use super::*;

#[rstest]
#[case(1000, 1)]
#[case(1400, 1)]
Expand Down
30 changes: 16 additions & 14 deletions rust/crd/src/resource.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
use std::collections::BTreeMap;
use std::sync::LazyLock;
use std::{collections::BTreeMap, sync::LazyLock};

use crate::memory::{HistoricalDerivedSettings, RESERVED_OS_MEMORY};
use crate::storage::{self, default_free_percentage_empty_dir_fragment};
use crate::{DruidRole, PATH_SEGMENT_CACHE, PROP_SEGMENT_CACHE_LOCATIONS};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::builder;
use stackable_operator::memory::MemoryQuantity;
use stackable_operator::{
builder,
builder::pod::{container::ContainerBuilder, volume::VolumeBuilder, PodBuilder},
commons::resources::{
CpuLimitsFragment, MemoryLimits, MemoryLimitsFragment, NoRuntimeLimits,
Expand All @@ -17,9 +12,16 @@ use stackable_operator::{
api::core::v1::{EmptyDirVolumeSource, ResourceRequirements},
apimachinery::pkg::api::resource::Quantity,
},
memory::MemoryQuantity,
};
use strum::{EnumDiscriminants, IntoStaticStr};

use crate::{
memory::{HistoricalDerivedSettings, RESERVED_OS_MEMORY},
storage::{self, default_free_percentage_empty_dir_fragment},
DruidRole, PATH_SEGMENT_CACHE, PROP_SEGMENT_CACHE_LOCATIONS,
};

// volume names
const SEGMENT_CACHE_VOLUME_NAME: &str = "segment-cache";

Expand Down Expand Up @@ -242,13 +244,6 @@ pub static ROUTER_RESOURCES: LazyLock<ResourcesFragment<storage::DruidStorage, N

#[cfg(test)]
mod test {
use super::*;
use crate::{
storage::{default_free_percentage_empty_dir, HistoricalStorage},
tests::deserialize_yaml_file,
DruidCluster, MiddleManagerConfig,
};

use rstest::*;
use stackable_operator::{
commons::resources::{
Expand All @@ -259,6 +254,13 @@ mod test {
role_utils::{CommonConfiguration, RoleGroup},
};

use super::*;
use crate::{
storage::{default_free_percentage_empty_dir, HistoricalStorage},
tests::deserialize_yaml_file,
DruidCluster, MiddleManagerConfig,
};

#[rstest]
#[case(
Some(ResourcesFragment{
Expand Down
12 changes: 6 additions & 6 deletions rust/crd/src/security.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use crate::{
authentication::{self, AuthenticationClassesResolved},
DruidCluster, DruidRole, METRICS_PORT,
};
use crate::{STACKABLE_TRUST_STORE, STACKABLE_TRUST_STORE_PASSWORD};
use std::collections::BTreeMap;

use snafu::{ResultExt, Snafu};
use stackable_operator::{
builder::{
Expand All @@ -23,7 +20,10 @@ use stackable_operator::{
time::Duration,
};

use std::collections::BTreeMap;
use crate::{
authentication::{self, AuthenticationClassesResolved},
DruidCluster, DruidRole, METRICS_PORT, STACKABLE_TRUST_STORE, STACKABLE_TRUST_STORE_PASSWORD,
};

#[derive(Snafu, Debug)]
pub enum Error {
Expand Down
2 changes: 1 addition & 1 deletion rust/crd/src/storage.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use stackable_operator::k8s_openapi::apimachinery::pkg::api::resource::Quantity;
use stackable_operator::{
config::{fragment::Fragment, merge::Merge},
k8s_openapi::apimachinery::pkg::api::resource::Quantity,
schemars::{self, JsonSchema},
};

Expand Down
3 changes: 2 additions & 1 deletion rust/crd/src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ pub fn tls_default() -> Option<String> {

#[cfg(test)]
mod tests {
use crate::{tests::deserialize_yaml_str, tls::DruidTls, DruidClusterConfig};
use indoc::formatdoc;

use crate::{tests::deserialize_yaml_str, tls::DruidTls, DruidClusterConfig};

const BASE_DRUID_CONFIGURATION: &str = r#"
deepStorage:
hdfs:
Expand Down
7 changes: 3 additions & 4 deletions rust/operator-binary/src/authentication/ldap.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use std::collections::BTreeMap;

use snafu::ResultExt;
use stackable_druid_crd::security::{
add_cert_to_trust_store_cmd, STACKABLE_TLS_DIR, TLS_STORE_PASSWORD,
};
use stackable_operator::{
builder::pod::{container::ContainerBuilder, PodBuilder},
commons::authentication::ldap::AuthenticationProvider,
};

use stackable_druid_crd::security::{
add_cert_to_trust_store_cmd, STACKABLE_TLS_DIR, TLS_STORE_PASSWORD,
};

use crate::authentication::{
AddLdapVolumesSnafu, ConstructLdapEndpointUrlSnafu, Error, MissingLdapBindCredentialsSnafu,
};
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/discovery.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! Discovery for Druid. We make Druid discoverable by putting a connection string to the router service
//! inside a config map. We only provide a connection string to the router service, since it serves as
//! a gateway to the cluster for client queries.
use crate::DRUID_CONTROLLER_NAME;

use snafu::{OptionExt, ResultExt, Snafu};
use stackable_druid_crd::{
build_recommended_labels, security::DruidTlsSecurity, DruidCluster, DruidRole,
Expand All @@ -15,6 +13,8 @@ use stackable_operator::{
utils::cluster_info::KubernetesClusterInfo,
};

use crate::DRUID_CONTROLLER_NAME;

#[derive(Snafu, Debug)]
pub enum Error {
#[snafu(display("object {} is missing metadata to build owner reference", druid))]
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/druid_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1334,12 +1334,12 @@ pub fn error_policy(

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

use product_config::{writer, ProductConfigManager};
use rstest::*;
use stackable_druid_crd::PROP_SEGMENT_CACHE_LOCATIONS;

use super::*;

#[derive(Snafu, Debug, EnumDiscriminants)]
#[strum_discriminants(derive(IntoStaticStr))]
#[allow(clippy::enum_variant_names)]
Expand Down
15 changes: 9 additions & 6 deletions rust/operator-binary/src/internal_secret.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use std::collections::{BTreeMap, HashSet};

use snafu::{OptionExt, ResultExt, Snafu};
use stackable_druid_crd::security::INTERNAL_INITIAL_CLIENT_PASSWORD_ENV;
use stackable_druid_crd::{DruidCluster, COOKIE_PASSPHRASE_ENV};
use stackable_operator::k8s_openapi::api::core::v1::{EnvVar, EnvVarSource, SecretKeySelector};
use stackable_operator::kube::ResourceExt;
use stackable_druid_crd::{
security::INTERNAL_INITIAL_CLIENT_PASSWORD_ENV, DruidCluster, COOKIE_PASSPHRASE_ENV,
};
use stackable_operator::{
builder::meta::ObjectMetaBuilder, client::Client, k8s_openapi::api::core::v1::Secret,
builder::meta::ObjectMetaBuilder,
client::Client,
k8s_openapi::api::core::v1::{EnvVar, EnvVarSource, Secret, SecretKeySelector},
kube::ResourceExt,
};
use std::collections::{BTreeMap, HashSet};
use strum::{EnumDiscriminants, IntoStaticStr};

#[derive(Snafu, Debug, EnumDiscriminants)]
Expand Down
5 changes: 2 additions & 3 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ use clap::{crate_description, crate_version, Parser};
use druid_controller::{DRUID_CONTROLLER_NAME, FULL_CONTROLLER_NAME};
use futures::StreamExt;
use stackable_druid_crd::{DruidCluster, APP_NAME, OPERATOR_NAME};
use stackable_operator::CustomResourceExt;
use stackable_operator::{
cli::Command,
cli::ProductOperatorRun,
cli::{Command, ProductOperatorRun},
k8s_openapi::api::{
apps::v1::StatefulSet,
core::v1::{ConfigMap, Service},
Expand All @@ -29,6 +27,7 @@ use stackable_operator::{
},
},
logging::controller::report_controller_reconciled,
CustomResourceExt,
};

mod built_info {
Expand Down
5 changes: 2 additions & 3 deletions rust/operator-binary/src/operations/graceful_shutdown.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use indoc::formatdoc;
use snafu::{ResultExt, Snafu};
use stackable_druid_crd::security::DruidTlsSecurity;
use stackable_druid_crd::DruidRole;
use stackable_operator::k8s_openapi::api::core::v1::{ExecAction, LifecycleHandler};
use stackable_druid_crd::{security::DruidTlsSecurity, DruidRole};
use stackable_operator::{
builder::pod::{container::ContainerBuilder, PodBuilder},
k8s_openapi::api::core::v1::{ExecAction, LifecycleHandler},
time::Duration,
};

Expand Down

0 comments on commit 1a0a860

Please sign in to comment.