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: 4 additions & 5 deletions nix/sources.json

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

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"
58 changes: 36 additions & 22 deletions rust/operator-binary/src/authentication/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{
builder::{
self,
pod::{container::ContainerBuilder, PodBuilder},
pod::{PodBuilder, container::ContainerBuilder},
},
commons::{
authentication::{AuthenticationClass, AuthenticationClassProvider},
product_image_selection::ResolvedProductImage,
},
k8s_openapi::api::core::v1::{Container, EnvVar, Volume, VolumeMount},
kube::{runtime::reflector::ObjectRef, ResourceExt},
kube::{ResourceExt, runtime::reflector::ObjectRef},
};
use strum::EnumDiscriminants;
use tracing::trace;
Expand All @@ -29,11 +29,11 @@ use crate::{
authentication::{
oidc::{OidcAuthenticator, TrinoOidcAuthentication},
password::{
file::FileAuthenticator, ldap::LdapAuthenticator, TrinoPasswordAuthentication,
TrinoPasswordAuthenticator,
TrinoPasswordAuthentication, TrinoPasswordAuthenticator, file::FileAuthenticator,
ldap::LdapAuthenticator,
},
},
crd::{authentication::ResolvedAuthenticationClassRef, TrinoRole},
crd::{TrinoRole, authentication::ResolvedAuthenticationClassRef},
};

pub(crate) mod oidc;
Expand All @@ -44,7 +44,9 @@ const HTTP_SERVER_AUTHENTICATION_TYPE: &str = "http-server.authentication.type";

#[derive(Snafu, Debug)]
pub enum Error {
#[snafu(display("The Trino Operator does not support the AuthenticationClass provider [{authentication_class_provider}] from AuthenticationClass [{authentication_class}]."))]
#[snafu(display(
"The Trino Operator does not support the AuthenticationClass provider [{authentication_class_provider}] from AuthenticationClass [{authentication_class}]."
))]
AuthenticationClassProviderNotSupported {
authentication_class_provider: String,
authentication_class: ObjectRef<AuthenticationClass>,
Expand All @@ -61,7 +63,9 @@ pub enum Error {
#[snafu(display("Failed to configure trino OAuth2 authentication"))]
InvalidOauth2AuthenticationConfig { source: oidc::Error },

#[snafu(display("OIDC authentication details not specified. The AuthenticationClass {auth_class_name:?} uses an OIDC provider, you need to specify OIDC authentication details (such as client credentials) as well"))]
#[snafu(display(
"OIDC authentication details not specified. The AuthenticationClass {auth_class_name:?} uses an OIDC provider, you need to specify OIDC authentication details (such as client credentials) as well"
))]
OidcAuthenticationDetailsNotSpecified { auth_class_name: String },

#[snafu(display("failed to add needed volume"))]
Expand Down Expand Up @@ -740,9 +744,11 @@ mod tests {
#[test]
fn test_trino_password_authenticator_config_files() {
// Nothing for workers
assert!(setup_authentication_config()
.config_files(&TrinoRole::Worker)
.is_empty());
assert!(
setup_authentication_config()
.config_files(&TrinoRole::Worker)
.is_empty()
);

// coordinators
let config_files = setup_authentication_config().config_files(&TrinoRole::Coordinator);
Expand Down Expand Up @@ -791,12 +797,16 @@ mod tests {
#[test]
fn test_trino_password_authenticator_volume_mounts() {
// nothing for workers
assert!(setup_authentication_config()
.volume_mounts(&TrinoRole::Worker, &crate::crd::Container::Trino,)
.is_empty());
assert!(setup_authentication_config()
.volume_mounts(&TrinoRole::Worker, &crate::crd::Container::Prepare,)
.is_empty());
assert!(
setup_authentication_config()
.volume_mounts(&TrinoRole::Worker, &crate::crd::Container::Trino,)
.is_empty()
);
assert!(
setup_authentication_config()
.volume_mounts(&TrinoRole::Worker, &crate::crd::Container::Prepare,)
.is_empty()
);

// coordinator - main container
let coordinator_main_mounts = setup_authentication_config()
Expand All @@ -817,12 +827,16 @@ mod tests {
let auth_config_with_ldap_bind = setup_authentication_config_bind_credentials();

// nothing for workers
assert!(auth_config
.commands(&TrinoRole::Worker, &crate::crd::Container::Trino)
.is_empty());
assert!(auth_config_with_ldap_bind
.commands(&TrinoRole::Worker, &crate::crd::Container::Trino)
.is_empty());
assert!(
auth_config
.commands(&TrinoRole::Worker, &crate::crd::Container::Trino)
.is_empty()
);
assert!(
auth_config_with_ldap_bind
.commands(&TrinoRole::Worker, &crate::crd::Container::Trino)
.is_empty()
);

// we expect 0 entries because no bind credentials env export
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/authentication/oidc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use stackable_operator::commons::{authentication::oidc, tls_verification::TlsCli
use crate::{
authentication::TrinoAuthenticationConfig,
command,
crd::{TrinoRole, STACKABLE_CLIENT_TLS_DIR},
crd::{STACKABLE_CLIENT_TLS_DIR, TrinoRole},
};

// Trino properties
Expand Down
34 changes: 21 additions & 13 deletions rust/operator-binary/src/authentication/password/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ use tracing::trace;

use crate::{
authentication::{
password::{file::FileAuthenticator, ldap::LdapAuthenticator},
TrinoAuthenticationConfig,
password::{file::FileAuthenticator, ldap::LdapAuthenticator},
},
crd::{Container, TrinoRole, RW_CONFIG_DIR_NAME},
crd::{Container, RW_CONFIG_DIR_NAME, TrinoRole},
};

pub mod file;
Expand Down Expand Up @@ -299,24 +299,32 @@ mod tests {
// check file auth
assert_eq!(
config_files.get(&file_auth_1.config_file_name()).unwrap(),
&format!("file.password-file=/stackable/users/{FILE_AUTH_CLASS_1}.db\npassword-authenticator.name=file\n")
&format!(
"file.password-file=/stackable/users/{FILE_AUTH_CLASS_1}.db\npassword-authenticator.name=file\n"
)
);
// check ldap
assert!(config_files
.get(&ldap_auth_1.config_file_name())
.unwrap()
.contains("password-authenticator.name=ldap"));
assert!(
config_files
.get(&ldap_auth_1.config_file_name())
.unwrap()
.contains("password-authenticator.name=ldap")
);

// Coordinator
assert!(!auth_config
.volume_mounts(&TrinoRole::Coordinator, &Container::Trino)
.is_empty());
assert!(
!auth_config
.volume_mounts(&TrinoRole::Coordinator, &Container::Trino)
.is_empty()
);
assert!(!auth_config.volumes().is_empty());

// Nothing to be set for workers
assert!(auth_config
.volume_mounts(&TrinoRole::Worker, &Container::Trino)
.is_empty());
assert!(
auth_config
.volume_mounts(&TrinoRole::Worker, &Container::Trino)
.is_empty()
);
assert!(auth_config.config_files(&TrinoRole::Worker).is_empty());
}
}
2 changes: 1 addition & 1 deletion rust/operator-binary/src/catalog/black_hole.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use stackable_operator::client::Client;

use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use super::{FromTrinoCatalogError, ToCatalogConfig, config::CatalogConfig};
use crate::crd::catalog::black_hole::BlackHoleConnector;

pub const CONNECTOR_NAME: &str = "blackhole";
Expand Down
6 changes: 3 additions & 3 deletions rust/operator-binary/src/catalog/commons.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use snafu::{ensure, OptionExt, ResultExt};
use snafu::{OptionExt, ResultExt, ensure};
use stackable_operator::{
builder::pod::volume::{VolumeBuilder, VolumeMountBuilder},
client::Client,
Expand All @@ -11,19 +11,19 @@ use stackable_operator::{
};

use super::{
ExtendCatalogConfig, FromTrinoCatalogError,
config::CatalogConfig,
from_trino_catalog_error::{
ConfigureS3Snafu, FailedToGetDiscoveryConfigMapDataKeySnafu,
FailedToGetDiscoveryConfigMapDataSnafu, FailedToGetDiscoveryConfigMapSnafu,
ObjectHasNoNamespaceSnafu, S3TlsNoVerificationNotSupportedSnafu, S3TlsRequiredSnafu,
},
ExtendCatalogConfig, FromTrinoCatalogError,
};
use crate::{
command,
crd::{
catalog::commons::{HdfsConnection, MetastoreConnection},
CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR,
catalog::commons::{HdfsConnection, MetastoreConnection},
},
};

Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/catalog/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use stackable_operator::{
};

use super::{FromTrinoCatalogError, ToCatalogConfig};
use crate::crd::catalog::{v1alpha1, TrinoCatalogConnector};
use crate::crd::catalog::{TrinoCatalogConnector, v1alpha1};

pub struct CatalogConfig {
/// Name of the catalog
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/catalog/delta_lake.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use stackable_operator::client::Client;

use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use super::{ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig, config::CatalogConfig};
use crate::crd::catalog::delta_lake::DeltaLakeConnector;

pub const CONNECTOR_NAME: &str = "delta_lake";
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/catalog/generic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use stackable_operator::client::Client;

use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use super::{FromTrinoCatalogError, ToCatalogConfig, config::CatalogConfig};
use crate::crd::catalog::generic::{GenericConnector, Property};

#[async_trait]
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/catalog/google_sheet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use stackable_operator::{
client::Client,
};

use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use crate::crd::{catalog::google_sheet::GoogleSheetConnector, CONFIG_DIR_NAME};
use super::{FromTrinoCatalogError, ToCatalogConfig, config::CatalogConfig};
use crate::crd::{CONFIG_DIR_NAME, catalog::google_sheet::GoogleSheetConnector};

pub const CONNECTOR_NAME: &str = "gsheets";

Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/catalog/hive.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use stackable_operator::client::Client;

use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use super::{ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig, config::CatalogConfig};
use crate::crd::catalog::hive::HiveConnector;

pub const CONNECTOR_NAME: &str = "hive";
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/catalog/iceberg.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use stackable_operator::client::Client;

use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use super::{ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig, config::CatalogConfig};
use crate::crd::catalog::iceberg::IcebergConnector;

pub const CONNECTOR_NAME: &str = "iceberg";
Expand Down
4 changes: 1 addition & 3 deletions rust/operator-binary/src/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ pub enum FromTrinoCatalogError {
cm_name: String,
},

#[snafu(display(
"failed to retrieve [{catalog}] discovery config map [{cm_name}] data field"
))]
#[snafu(display("failed to retrieve [{catalog}] discovery config map [{cm_name}] data field"))]
FailedToGetDiscoveryConfigMapData { catalog: String, cm_name: String },

#[snafu(display(
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/catalog/tpcds.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use stackable_operator::client::Client;

use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use super::{FromTrinoCatalogError, ToCatalogConfig, config::CatalogConfig};
use crate::crd::catalog::tpcds::TpcdsConnector;

pub const CONNECTOR_NAME: &str = "tpcds";
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/catalog/tpch.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use async_trait::async_trait;
use stackable_operator::client::Client;

use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use super::{FromTrinoCatalogError, ToCatalogConfig, config::CatalogConfig};
use crate::crd::catalog::tpch::TpchConnector;

pub const CONNECTOR_NAME: &str = "tpch";
Expand Down
Loading
Loading