Skip to content

Commit b9b7ecf

Browse files
chore: Update templated files (9001281) (#823)
* 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 <git@techassi.dev>
1 parent c4127dc commit b9b7ecf

File tree

8 files changed

+38
-40
lines changed

8 files changed

+38
-40
lines changed

.github/workflows/pr_pre-commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
env:
88
CARGO_TERM_COLOR: always
9-
RUST_TOOLCHAIN_VERSION: "1.82.0"
9+
RUST_TOOLCHAIN_VERSION: "nightly-2025-01-15"
1010
HADOLINT_VERSION: "v2.12.0"
1111
PYTHON_VERSION: "3.12"
1212

.pre-commit-config.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ repos:
1717
- repo: https://github.com/doublify/pre-commit-rust
1818
rev: eeee35a89e69d5772bdee97db1a6a898467b686e # 1.0
1919
hooks:
20-
- id: fmt
21-
# Pinning to a specific rustc version, so that we get consistent formatting
22-
entry: RUSTUP_TOOLCHAIN=nightly-2025-01-15 cargo fmt
23-
args: ["--all", "--", "--check"]
2420
- id: clippy
2521
args: ["--all-targets", "--", "-D", "warnings"]
2622

@@ -78,3 +74,10 @@ repos:
7874
entry: cargo test
7975
stages: [pre-commit, pre-merge-commit, manual]
8076
pass_filenames: false
77+
78+
- id: cargo-rustfmt
79+
name: cargo-rustfmt
80+
language: system
81+
entry: cargo +nightly-2025-01-15 fmt --all -- --check
82+
stages: [pre-commit]
83+
pass_filenames: false

rust/crd/src/affinity.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ pub fn get_affinity(cluster_name: &str, role: &KafkaRole) -> StackableAffinityFr
2121

2222
#[cfg(test)]
2323
mod tests {
24-
use super::*;
25-
26-
use rstest::rstest;
2724
use std::collections::BTreeMap;
2825

29-
use crate::KafkaCluster;
26+
use rstest::rstest;
3027
use stackable_operator::{
3128
commons::affinity::StackableAffinity,
3229
k8s_openapi::{
@@ -35,6 +32,9 @@ mod tests {
3532
},
3633
};
3734

35+
use super::*;
36+
use crate::KafkaCluster;
37+
3838
#[rstest]
3939
#[case(KafkaRole::Broker)]
4040
fn test_affinity_defaults(#[case] role: KafkaRole) {

rust/crd/src/authentication.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
use crate::ObjectRef;
2-
31
use serde::{Deserialize, Serialize};
42
use snafu::{ResultExt, Snafu};
5-
use stackable_operator::commons::authentication::AuthenticationClassProvider;
63
use stackable_operator::{
74
client::Client,
8-
commons::authentication::AuthenticationClass,
5+
commons::authentication::{AuthenticationClass, AuthenticationClassProvider},
96
schemars::{self, JsonSchema},
107
};
118

9+
use crate::ObjectRef;
10+
1211
pub const SUPPORTED_AUTHENTICATION_CLASS_PROVIDERS: [&str; 2] = ["TLS", "Kerberos"];
1312

1413
#[derive(Snafu, Debug)]

rust/crd/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ pub mod listener;
55
pub mod security;
66
pub mod tls;
77

8-
use crate::authorization::KafkaAuthorization;
9-
use crate::tls::KafkaTls;
8+
use std::{collections::BTreeMap, str::FromStr};
109

1110
use affinity::get_affinity;
1211
use authentication::KafkaAuthentication;
@@ -38,9 +37,10 @@ use stackable_operator::{
3837
time::Duration,
3938
utils::cluster_info::KubernetesClusterInfo,
4039
};
41-
use std::{collections::BTreeMap, str::FromStr};
4240
use strum::{Display, EnumIter, EnumString, IntoEnumIterator};
4341

42+
use crate::{authorization::KafkaAuthorization, tls::KafkaTls};
43+
4444
pub const DOCKER_IMAGE_BASE_NAME: &str = "kafka";
4545
pub const APP_NAME: &str = "kafka";
4646
pub const OPERATOR_NAME: &str = "kafka.stackable.tech";

rust/crd/src/listener.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
use std::collections::BTreeMap;
2-
use std::fmt::{Display, Formatter};
1+
use std::{
2+
collections::BTreeMap,
3+
fmt::{Display, Formatter},
4+
};
35

46
use snafu::{OptionExt, Snafu};
5-
use stackable_operator::kube::ResourceExt;
6-
use stackable_operator::utils::cluster_info::KubernetesClusterInfo;
7+
use stackable_operator::{kube::ResourceExt, utils::cluster_info::KubernetesClusterInfo};
78
use strum::{EnumDiscriminants, EnumString};
89

9-
use crate::security::KafkaTlsSecurity;
10-
use crate::{KafkaCluster, STACKABLE_LISTENER_BROKER_DIR};
10+
use crate::{security::KafkaTlsSecurity, KafkaCluster, STACKABLE_LISTENER_BROKER_DIR};
1111

1212
const LISTENER_LOCAL_ADDRESS: &str = "0.0.0.0";
1313

@@ -260,9 +260,6 @@ pub fn pod_fqdn(
260260

261261
#[cfg(test)]
262262
mod tests {
263-
use super::*;
264-
use crate::authentication::ResolvedAuthenticationClasses;
265-
266263
use stackable_operator::{
267264
builder::meta::ObjectMetaBuilder,
268265
commons::{
@@ -275,6 +272,9 @@ mod tests {
275272
},
276273
};
277274

275+
use super::*;
276+
use crate::authentication::ResolvedAuthenticationClasses;
277+
278278
fn default_cluster_info() -> KubernetesClusterInfo {
279279
KubernetesClusterInfo {
280280
cluster_domain: DomainName::try_from("cluster.local").unwrap(),

rust/crd/src/security.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,8 @@
66
//! This is required due to overlaps between TLS encryption and e.g. mTLS authentication or Kerberos
77
use std::collections::BTreeMap;
88

9-
use crate::{
10-
authentication::{self, ResolvedAuthenticationClasses},
11-
listener::{self, KafkaListenerConfig},
12-
tls, KafkaCluster, LISTENER_BOOTSTRAP_VOLUME_NAME, SERVER_PROPERTIES_FILE,
13-
STACKABLE_CONFIG_DIR,
14-
};
15-
use crate::{
16-
listener::node_address_cmd, STACKABLE_KERBEROS_KRB5_PATH, STACKABLE_LISTENER_BOOTSTRAP_DIR,
17-
STACKABLE_LISTENER_BROKER_DIR,
18-
};
19-
use crate::{KafkaRole, LISTENER_BROKER_VOLUME_NAME, STACKABLE_LOG_DIR};
209
use indoc::formatdoc;
2110
use snafu::{ensure, ResultExt, Snafu};
22-
use stackable_operator::time::Duration;
2311
use stackable_operator::{
2412
builder::{
2513
self,
@@ -35,9 +23,18 @@ use stackable_operator::{
3523
product_logging::framework::{
3624
create_vector_shutdown_file_command, remove_vector_shutdown_file_command,
3725
},
26+
time::Duration,
3827
utils::COMMON_BASH_TRAP_FUNCTIONS,
3928
};
4029

30+
use crate::{
31+
authentication::{self, ResolvedAuthenticationClasses},
32+
listener::{self, node_address_cmd, KafkaListenerConfig},
33+
tls, KafkaCluster, KafkaRole, LISTENER_BOOTSTRAP_VOLUME_NAME, LISTENER_BROKER_VOLUME_NAME,
34+
SERVER_PROPERTIES_FILE, STACKABLE_CONFIG_DIR, STACKABLE_KERBEROS_KRB5_PATH,
35+
STACKABLE_LISTENER_BOOTSTRAP_DIR, STACKABLE_LISTENER_BROKER_DIR, STACKABLE_LOG_DIR,
36+
};
37+
4138
#[derive(Snafu, Debug)]
4239
pub enum Error {
4340
#[snafu(display("failed to process authentication class"))]

rust/operator-binary/src/kerberos.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use snafu::{ResultExt, Snafu};
2-
use stackable_kafka_crd::{security::KafkaTlsSecurity, KafkaRole};
32
use stackable_kafka_crd::{
4-
LISTENER_BOOTSTRAP_VOLUME_NAME, LISTENER_BROKER_VOLUME_NAME, STACKABLE_KERBEROS_DIR,
5-
STACKABLE_KERBEROS_KRB5_PATH,
3+
security::KafkaTlsSecurity, KafkaRole, LISTENER_BOOTSTRAP_VOLUME_NAME,
4+
LISTENER_BROKER_VOLUME_NAME, STACKABLE_KERBEROS_DIR, STACKABLE_KERBEROS_KRB5_PATH,
65
};
76
use stackable_operator::builder::{
87
self,

0 commit comments

Comments
 (0)