Skip to content
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",
"--"
],
}
9 changes: 0 additions & 9 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ ignore = [
#
# TODO: Remove after https://github.com/kube-rs/kube/pull/1652 is merged
"RUSTSEC-2024-0384",

# https://rustsec.org/advisories/RUSTSEC-2025-0012
# "backoff" is unmainted.
#
# Upstream (kube) has switched to backon in 0.99.0, and an upgrade is scheduled on our end. In the meantime,
# this is a very low-severity problem.
#
# TODO: Remove after upgrading to kube 0.99.
"RUSTSEC-2025-0012",
]

[bans]
Expand Down
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/bundle-builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ use std::{
sync::{Arc, Mutex},
};

use axum::{extract::State, http, response::IntoResponse, routing::get, Router};
use axum::{Router, extract::State, http, response::IntoResponse, routing::get};
use clap::Parser;
use flate2::write::GzEncoder;
use futures::{
FutureExt, StreamExt, TryFutureExt,
future::{self, BoxFuture},
pin_mut, FutureExt, StreamExt, TryFutureExt,
pin_mut,
};
use snafu::{ResultExt, Snafu};
use stackable_operator::{
Expand Down
24 changes: 11 additions & 13 deletions rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ use std::{

use const_format::concatcp;
use indoc::formatdoc;
use product_config::{types::PropertyNameKind, ProductConfigManager};
use product_config::{ProductConfigManager, types::PropertyNameKind};
use serde::{Deserialize, Serialize};
use serde_json::json;
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_opa_operator::crd::{
user_info_fetcher, v1alpha1, APP_NAME, DEFAULT_SERVER_GRACEFUL_SHUTDOWN_TIMEOUT, OPERATOR_NAME,
APP_NAME, DEFAULT_SERVER_GRACEFUL_SHUTDOWN_TIMEOUT, OPERATOR_NAME, user_info_fetcher, v1alpha1,
};
use stackable_operator::{
builder::{
self,
configmap::ConfigMapBuilder,
meta::ObjectMetaBuilder,
pod::{
PodBuilder,
container::{ContainerBuilder, FieldPathEnvVar},
resources::ResourceRequirementsBuilder,
security::PodSecurityContextBuilder,
volume::VolumeBuilder,
PodBuilder,
},
},
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
Expand All @@ -34,6 +34,7 @@ use stackable_operator::{
tls_verification::TlsClientDetailsError,
},
k8s_openapi::{
DeepMerge,
api::{
apps::v1::{DaemonSet, DaemonSetSpec},
core::v1::{
Expand All @@ -42,12 +43,11 @@ use stackable_operator::{
},
},
apimachinery::pkg::{apis::meta::v1::LabelSelector, util::intstr::IntOrString},
DeepMerge,
},
kube::{
core::{error_boundary, DeserializeGuard},
runtime::{controller::Action, reflector::ObjectRef},
Resource as KubeResource, ResourceExt,
core::{DeserializeGuard, error_boundary},
runtime::{controller::Action, reflector::ObjectRef},
},
kvp::{Label, LabelError, Labels, ObjectLabels},
logging::controller::ReconcilerError,
Expand All @@ -56,7 +56,7 @@ use stackable_operator::{
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::{
AppenderConfig, AutomaticContainerLogConfig, ContainerLogConfig,
Expand All @@ -77,7 +77,7 @@ use crate::{
discovery::{self, build_discovery_configmaps},
operations::graceful_shutdown::add_graceful_shutdown_config,
product_logging::{
extend_role_group_config_map, resolve_vector_aggregator_address, BundleBuilderLogLevel,
BundleBuilderLogLevel, extend_role_group_config_map, resolve_vector_aggregator_address,
},
};

Expand Down Expand Up @@ -787,11 +787,9 @@ fn build_server_rolegroup_daemonset(
"pipefail".to_string(),
"-c".to_string(),
])
.args(vec![build_prepare_start_command(
merged_config,
&prepare_container_name,
)
.join(" && ")])
.args(vec![
build_prepare_start_command(merged_config, &prepare_container_name).join(" && "),
])
.add_volume_mount(BUNDLES_VOLUME_NAME, BUNDLES_DIR)
.context(AddVolumeMountSnafu)?
.add_volume_mount(LOG_VOLUME_NAME, STACKABLE_LOG_DIR)
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use stackable_operator::{
builder::{configmap::ConfigMapBuilder, meta::ObjectMetaBuilder},
commons::product_image_selection::ResolvedProductImage,
k8s_openapi::api::core::v1::{ConfigMap, Service},
kube::{runtime::reflector::ObjectRef, Resource, ResourceExt},
kube::{Resource, ResourceExt, runtime::reflector::ObjectRef},
utils::cluster_info::KubernetesClusterInfo,
};

use crate::controller::{build_recommended_labels, APP_PORT};
use crate::controller::{APP_PORT, build_recommended_labels};

#[derive(Snafu, Debug)]
pub enum Error {
Expand Down
22 changes: 10 additions & 12 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
use std::sync::Arc;

use clap::{crate_description, crate_version, Parser};
use clap::{Parser, crate_description, crate_version};
use futures::StreamExt;
use product_config::ProductConfigManager;
use stackable_opa_operator::crd::{v1alpha1, OpaCluster, APP_NAME, OPERATOR_NAME};
use stackable_opa_operator::crd::{APP_NAME, OPERATOR_NAME, OpaCluster, v1alpha1};
use stackable_operator::{
YamlSchema,
cli::{Command, ProductOperatorRun},
client::{self, Client},
k8s_openapi::api::{
apps::v1::DaemonSet,
core::v1::{ConfigMap, Service},
},
kube::{
Api,
core::DeserializeGuard,
runtime::{
Controller,
events::{Recorder, Reporter},
watcher, Controller,
watcher,
},
Api,
},
logging::controller::report_controller_reconciled,
namespace::WatchNamespace,
shared::yaml::SerializeOptions,
YamlSchema,
};

use crate::controller::OPA_FULL_CONTROLLER_NAME;
Expand Down Expand Up @@ -127,13 +128,10 @@ async fn create_controller(
.owns(configmaps_api, watcher::Config::default())
.owns(services_api, watcher::Config::default());

let event_recorder = Arc::new(Recorder::new(
client.as_kube_client(),
Reporter {
controller: OPA_FULL_CONTROLLER_NAME.to_string(),
instance: None,
},
));
let event_recorder = Arc::new(Recorder::new(client.as_kube_client(), Reporter {
controller: OPA_FULL_CONTROLLER_NAME.to_string(),
instance: None,
}));
controller
.run(
controller::reconcile_opa,
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/operations/graceful_shutdown.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use snafu::{ResultExt, Snafu};
use stackable_opa_operator::crd::{v1alpha1, SERVER_GRACEFUL_SHUTDOWN_SAFETY_OVERHEAD};
use stackable_opa_operator::crd::{SERVER_GRACEFUL_SHUTDOWN_SAFETY_OVERHEAD, v1alpha1};
use stackable_operator::builder::pod::PodBuilder;

#[derive(Debug, Snafu)]
Expand Down
4 changes: 2 additions & 2 deletions rust/user-info-fetcher/src/backend/active_directory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ use std::{

use byteorder::{BigEndian, LittleEndian, ReadBytesExt};
use hyper::StatusCode;
use ldap3::{ldap_escape, Ldap, LdapConnAsync, LdapConnSettings, LdapError, Scope, SearchEntry};
use ldap3::{Ldap, LdapConnAsync, LdapConnSettings, LdapError, Scope, SearchEntry, ldap_escape};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::commons::tls_verification::TlsClientDetails;
use uuid::Uuid;

use crate::{http_error, utils, ErrorRenderUserInfoRequest, UserInfo, UserInfoRequest};
use crate::{ErrorRenderUserInfoRequest, UserInfo, UserInfoRequest, http_error, utils};

#[derive(Snafu, Debug)]
pub enum Error {
Expand Down
2 changes: 1 addition & 1 deletion rust/user-info-fetcher/src/backend/keycloak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use snafu::{OptionExt, ResultExt, Snafu};
use stackable_opa_operator::crd::user_info_fetcher::v1alpha1;
use stackable_operator::commons::authentication::oidc;

use crate::{http_error, utils::http::send_json_request, Credentials, UserInfo, UserInfoRequest};
use crate::{Credentials, UserInfo, UserInfoRequest, http_error, utils::http::send_json_request};

#[derive(Snafu, Debug)]
pub enum Error {
Expand Down
2 changes: 1 addition & 1 deletion rust/user-info-fetcher/src/backend/xfsc_aas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use snafu::{ResultExt, Snafu};
use stackable_opa_operator::crd::user_info_fetcher::v1alpha1;
use url::Url;

use crate::{http_error, utils::http::send_json_request, UserInfo, UserInfoRequest};
use crate::{UserInfo, UserInfoRequest, http_error, utils::http::send_json_request};

static API_PATH: &str = "/cip/claims";
static SUB_CLAIM: &str = "sub";
Expand Down
2 changes: 1 addition & 1 deletion rust/user-info-fetcher/src/http_error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use axum::{response::IntoResponse, Json};
use axum::{Json, response::IntoResponse};
use hyper::StatusCode;
use serde::Serialize;

Expand Down
4 changes: 2 additions & 2 deletions rust/user-info-fetcher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::{
sync::Arc,
};

use axum::{extract::State, routing::post, Json, Router};
use axum::{Json, Router, extract::State, routing::post};
use clap::Parser;
use futures::{future, pin_mut, FutureExt};
use futures::{FutureExt, future, pin_mut};
use moka::future::Cache;
use reqwest::ClientBuilder;
use serde::{Deserialize, Serialize};
Expand Down
6 changes: 5 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file includes unstable features, so you need to run "cargo +nightly fmt" to format your code.
# It's also ok to use the stable toolchain by simple running "cargo fmt", but using the nigthly formatter is prefered.

# https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rustfmt-style-edition.html
style_edition = "2024"
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
group_imports = "StdExternalCrate"
reorder_impl_items = true
use_field_init_shorthand = true