Skip to content
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

chore: Update templated files (9001281) #751

Merged
merged 2 commits into from
Feb 4, 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
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
6 changes: 3 additions & 3 deletions rust/crd/src/affinity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ pub fn get_affinity(cluster_name: &str, role: &NifiRole) -> StackableAffinityFra

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

use std::collections::BTreeMap;

use crate::NifiCluster;
use stackable_operator::{
commons::affinity::StackableAffinity,
k8s_openapi::{
Expand All @@ -34,6 +31,9 @@ mod tests {
},
};

use super::*;
use crate::NifiCluster;

#[test]
fn test_affinity_defaults() {
let input = r#"
Expand Down
12 changes: 6 additions & 6 deletions rust/crd/src/authentication.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::future::Future;

use snafu::{ResultExt, Snafu};
use stackable_operator::commons::authentication::{
ldap, oidc, static_, AuthenticationClassProvider, ClientAuthenticationDetails,
};
use stackable_operator::kube::ResourceExt;
use stackable_operator::{
client::Client, commons::authentication::AuthenticationClass,
kube::runtime::reflector::ObjectRef,
client::Client,
commons::authentication::{
ldap, oidc, static_, AuthenticationClass, AuthenticationClassProvider,
ClientAuthenticationDetails,
},
kube::{runtime::reflector::ObjectRef, ResourceExt},
};

use crate::NifiCluster;
Expand Down
7 changes: 3 additions & 4 deletions rust/operator-binary/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,13 +666,12 @@ fn storage_quantity_to_nifi(quantity: MemoryQuantity) -> String {

#[cfg(test)]
mod tests {
use crate::config::build_bootstrap_conf;

use super::*;

use indoc::indoc;
use stackable_nifi_crd::NifiCluster;

use super::*;
use crate::config::build_bootstrap_conf;

#[test]
fn test_build_bootstrap_conf_defaults() {
let input = r#"
Expand Down
6 changes: 3 additions & 3 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ mod product_logging;
mod reporting_task;
mod security;

use std::sync::Arc;

use clap::{crate_description, crate_version, Parser};
use futures::stream::StreamExt;
use stackable_nifi_crd::NifiCluster;
use stackable_operator::{
cli::{Command, ProductOperatorRun},
commons::authentication::AuthenticationClass,
Expand All @@ -25,9 +28,6 @@ use stackable_operator::{
logging::controller::report_controller_reconciled,
CustomResourceExt,
};
use std::sync::Arc;

use stackable_nifi_crd::NifiCluster;

use crate::controller::NIFI_FULL_CONTROLLER_NAME;

Expand Down
10 changes: 5 additions & 5 deletions rust/operator-binary/src/reporting_task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,10 @@
//!
use std::collections::BTreeMap;

use crate::security::{
authentication::{NifiAuthenticationConfig, STACKABLE_ADMIN_USERNAME},
build_tls_volume,
};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_nifi_crd::{
NifiCluster, NifiRole, APP_NAME, HTTPS_PORT, HTTPS_PORT_NAME, METRICS_PORT,
};
use stackable_operator::time::Duration;
use stackable_operator::{
builder::{
self,
Expand All @@ -52,10 +47,15 @@ use stackable_operator::{
},
kube::ResourceExt,
kvp::Labels,
time::Duration,
utils::cluster_info::KubernetesClusterInfo,
};

use super::controller::{build_recommended_labels, NIFI_UID};
use crate::security::{
authentication::{NifiAuthenticationConfig, STACKABLE_ADMIN_USERNAME},
build_tls_volume,
};

const REPORTING_TASK_CERT_VOLUME_NAME: &str = "tls";
const REPORTING_TASK_CERT_VOLUME_MOUNT: &str = "/stackable/cert";
Expand Down
3 changes: 1 addition & 2 deletions rust/operator-binary/src/security/authentication.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use indoc::{formatdoc, indoc};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_nifi_crd::authentication::AuthenticationClassResolved;
use stackable_nifi_crd::NifiCluster;
use stackable_nifi_crd::{authentication::AuthenticationClassResolved, NifiCluster};
use stackable_operator::{
builder::{
self,
Expand Down
7 changes: 4 additions & 3 deletions rust/operator-binary/src/security/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use snafu::{ResultExt, Snafu};
use stackable_nifi_crd::NifiCluster;
use stackable_operator::client::Client;
use stackable_operator::time::Duration;
use stackable_operator::{builder::pod::volume::SecretFormat, k8s_openapi::api::core::v1::Volume};
use stackable_operator::{
builder::pod::volume::SecretFormat, client::Client, k8s_openapi::api::core::v1::Volume,
time::Duration,
};

pub mod authentication;
pub mod oidc;
Expand Down
5 changes: 3 additions & 2 deletions rust/operator-binary/src/security/tls.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use crate::security::authentication::STACKABLE_TLS_STORE_PASSWORD;
use snafu::{ResultExt, Snafu};
use stackable_nifi_crd::NifiCluster;
use stackable_operator::time::Duration;
use stackable_operator::{
builder::pod::volume::{SecretFormat, SecretOperatorVolumeSourceBuilder, VolumeBuilder},
k8s_openapi::api::core::v1::Volume,
time::Duration,
};

use crate::security::authentication::STACKABLE_TLS_STORE_PASSWORD;

pub const KEYSTORE_VOLUME_NAME: &str = "keystore";
pub const KEYSTORE_NIFI_CONTAINER_MOUNT: &str = "/stackable/keystore";
pub const TRUSTSTORE_VOLUME_NAME: &str = "truststore";
Expand Down