Skip to content

chore: Update templated files (9001281) #704

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

Merged
merged 3 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
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 @@ -85,12 +85,9 @@ pub fn get_affinity(

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

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

use crate::TrinoCluster;
use rstest::rstest;
use stackable_operator::{
commons::affinity::StackableAffinity,
k8s_openapi::{
Expand All @@ -101,6 +98,9 @@ mod tests {
},
};

use super::*;
use crate::TrinoCluster;

#[rstest]
#[case(TrinoRole::Coordinator)]
#[case(TrinoRole::Worker)]
Expand Down
3 changes: 2 additions & 1 deletion rust/crd/src/catalog/delta_lake.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use super::commons::{HdfsConnection, MetastoreConnection};
use serde::{Deserialize, Serialize};
use stackable_operator::{
commons::s3::S3ConnectionInlineOrReference,
schemars::{self, JsonSchema},
};

use super::commons::{HdfsConnection, MetastoreConnection};

// This struct is similar to [`super::hive::HiveConnector`], but we do not `#[serde(flatten)]` it here, to avoid changing
// stuff there and missing that these settings don't apply to other connectors (such as Iceberg or Delta Lake).
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
Expand Down
1 change: 0 additions & 1 deletion rust/crd/src/catalog/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub enum Property {
#[cfg(test)]
mod tests {
use super::*;

use crate::catalog::{TrinoCatalog, TrinoCatalogConnector};

#[test]
Expand Down
3 changes: 2 additions & 1 deletion rust/crd/src/catalog/hive.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use super::commons::{HdfsConnection, MetastoreConnection};
use serde::{Deserialize, Serialize};
use stackable_operator::{
commons::s3::S3ConnectionInlineOrReference,
schemars::{self, JsonSchema},
};

use super::commons::{HdfsConnection, MetastoreConnection};

#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct HiveConnector {
Expand Down
3 changes: 2 additions & 1 deletion rust/crd/src/catalog/iceberg.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use super::commons::{HdfsConnection, MetastoreConnection};
use serde::{Deserialize, Serialize};
use stackable_operator::{
commons::s3::S3ConnectionInlineOrReference,
schemars::{self, JsonSchema},
};

use super::commons::{HdfsConnection, MetastoreConnection};

// This struct is similar to [`super::hive::HiveConnector`], but we do not `#[serde(flatten)]` it here, to avoid changing
// stuff there and missing that these settings don't apply to other connectors (such as Iceberg or Delta Lake).
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
Expand Down
10 changes: 5 additions & 5 deletions rust/crd/src/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ pub mod iceberg;
pub mod tpcds;
pub mod tpch;

use serde::{Deserialize, Serialize};
use stackable_operator::{
kube::CustomResource,
schemars::{self, JsonSchema},
};
use std::collections::HashMap;

use black_hole::BlackHoleConnector;
use generic::GenericConnector;
use google_sheet::GoogleSheetConnector;
use hive::HiveConnector;
use iceberg::IcebergConnector;
use serde::{Deserialize, Serialize};
use stackable_operator::{
kube::CustomResource,
schemars::{self, JsonSchema},
};
use tpcds::TpcdsConnector;
use tpch::TpchConnector;

Expand Down
5 changes: 3 additions & 2 deletions rust/crd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod authentication;
pub mod catalog;
pub mod discovery;

use crate::discovery::TrinoPodRef;
use std::{collections::BTreeMap, str::FromStr};

use affinity::get_affinity;
use catalog::TrinoCatalog;
Expand Down Expand Up @@ -35,9 +35,10 @@ use stackable_operator::{
time::Duration,
utils::cluster_info::KubernetesClusterInfo,
};
use std::{collections::BTreeMap, str::FromStr};
use strum::{Display, EnumIter, EnumString, IntoEnumIterator};

use crate::discovery::TrinoPodRef;

pub const APP_NAME: &str = "trino";
// ports
pub const HTTP_PORT: u16 = 8080;
Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/authentication/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,11 @@ impl TryFrom<Vec<ResolvedAuthenticationClassRef>> for TrinoAuthenticationTypes {

#[cfg(test)]
mod tests {
use super::*;
use stackable_operator::commons::authentication::oidc::ClientAuthenticationOptions;
use stackable_trino_crd::RW_CONFIG_DIR_NAME;

use super::*;

const OIDC_AUTH_CLASS_1: &str = "oidc-auth-1";
const FILE_AUTH_CLASS_1: &str = "file-auth-1";
const FILE_AUTH_CLASS_2: &str = "file-auth-2";
Expand Down
7 changes: 4 additions & 3 deletions rust/operator-binary/src/authentication/oidc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! This module computes all resources required for Trino OAUTH2 authentication.
//!

use crate::authentication::TrinoAuthenticationConfig;
use crate::command;
use snafu::{ResultExt, Snafu};
use stackable_operator::commons::{authentication::oidc, tls_verification::TlsClientDetailsError};
use stackable_trino_crd::{TrinoRole, STACKABLE_CLIENT_TLS_DIR};

use crate::{authentication::TrinoAuthenticationConfig, command};

// Trino properties
const HTTP_SERVER_AUTHENTICATION_OAUTH2_CLIENT_ID: &str =
"http-server.authentication.oauth2.client-id";
Expand Down Expand Up @@ -209,10 +209,11 @@ impl TrinoOidcAuthentication {
mod tests {
use std::mem;

use super::*;
use rstest::rstest;
use stackable_trino_crd::Container;

use super::*;

const IDP_PORT: u16 = 8080;
const IDP_SCOPE_1: &str = "openid";
const IDP_SCOPE_2: &str = "test";
Expand Down
9 changes: 5 additions & 4 deletions rust/operator-binary/src/authentication/password/file.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::authentication::password::PASSWORD_AUTHENTICATOR_NAME;
use crate::controller::STACKABLE_LOG_DIR;
use std::collections::BTreeMap;

use snafu::{ResultExt, Snafu};
use stackable_operator::{
Expand All @@ -16,7 +15,8 @@ use stackable_operator::{
product_logging::{self, spec::AutomaticContainerLogConfig},
utils::COMMON_BASH_TRAP_FUNCTIONS,
};
use std::collections::BTreeMap;

use crate::{authentication::password::PASSWORD_AUTHENTICATOR_NAME, controller::STACKABLE_LOG_DIR};

// mounts
const PASSWORD_DB_VOLUME_NAME: &str = "users";
Expand Down Expand Up @@ -205,9 +205,10 @@ wait_for_termination $!

#[cfg(test)]
mod tests {
use super::*;
use stackable_operator::commons::authentication::static_::UserCredentialsSecretRef;

use super::*;

const AUTH_CLASS_NAME: &str = "test-auth";

#[test]
Expand Down
6 changes: 4 additions & 2 deletions rust/operator-binary/src/authentication/password/ldap.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use crate::authentication::password;
use std::collections::BTreeMap;

use snafu::{ResultExt, Snafu};
use stackable_operator::{
commons::authentication::ldap,
k8s_openapi::api::core::v1::{Volume, VolumeMount},
};
use std::collections::BTreeMap;

use crate::authentication::password;

// ldap
const PASSWORD_AUTHENTICATOR_NAME_LDAP: &str = "ldap";
Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/authentication/password/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,12 @@ impl TrinoPasswordAuthentication {

#[cfg(test)]
mod tests {
use super::*;
use stackable_operator::commons::authentication::{
ldap, static_, static_::UserCredentialsSecretRef,
};

use super::*;

const FILE_AUTH_CLASS_1: &str = "file-auth-1";
const FILE_AUTH_CLASS_2: &str = "file-auth-2";
const LDAP_AUTH_CLASS_1: &str = "ldap-auth-1";
Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/catalog/black_hole.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use async_trait::async_trait;
use stackable_operator::client::Client;
use stackable_trino_crd::catalog::black_hole::BlackHoleConnector;

use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};

pub const CONNECTOR_NAME: &str = "blackhole";

#[async_trait]
Expand Down
9 changes: 5 additions & 4 deletions rust/operator-binary/src/catalog/commons.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::command;

use async_trait::async_trait;
use snafu::{OptionExt, ResultExt};
use stackable_operator::{
Expand All @@ -11,8 +9,10 @@ use stackable_operator::{
},
k8s_openapi::api::core::v1::ConfigMap,
};
use stackable_trino_crd::catalog::commons::{HdfsConnection, MetastoreConnection};
use stackable_trino_crd::{CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR};
use stackable_trino_crd::{
catalog::commons::{HdfsConnection, MetastoreConnection},
CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR,
};

use super::{
config::CatalogConfig,
Expand All @@ -23,6 +23,7 @@ use super::{
},
ExtendCatalogConfig, FromTrinoCatalogError,
};
use crate::command;

#[async_trait]
impl ExtendCatalogConfig for MetastoreConnection {
Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/catalog/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::collections::BTreeMap;

use stackable_operator::{
client::Client,
k8s_openapi::api::core::v1::{
Expand All @@ -6,7 +8,6 @@ use stackable_operator::{
kube::{Resource, ResourceExt},
};
use stackable_trino_crd::catalog::{TrinoCatalog, TrinoCatalogConnector};
use std::collections::BTreeMap;

use super::{FromTrinoCatalogError, ToCatalogConfig};

Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/catalog/delta_lake.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use async_trait::async_trait;
use stackable_operator::client::Client;
use stackable_trino_crd::catalog::delta_lake::DeltaLakeConnector;

use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig};

pub const CONNECTOR_NAME: &str = "delta_lake";

#[async_trait]
Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/catalog/generic.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use async_trait::async_trait;
use stackable_operator::client::Client;
use stackable_trino_crd::catalog::generic::{GenericConnector, Property};

use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};

#[async_trait]
impl ToCatalogConfig for GenericConnector {
async fn to_catalog_config(
Expand Down
12 changes: 7 additions & 5 deletions rust/operator-binary/src/catalog/google_sheet.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use async_trait::async_trait;
use stackable_operator::builder::pod::volume::{VolumeBuilder, VolumeMountBuilder};
use stackable_operator::client::Client;
use stackable_trino_crd::catalog::google_sheet::GoogleSheetConnector;
use stackable_trino_crd::CONFIG_DIR_NAME;
use stackable_operator::{
builder::pod::volume::{VolumeBuilder, VolumeMountBuilder},
client::Client,
};
use stackable_trino_crd::{catalog::google_sheet::GoogleSheetConnector, CONFIG_DIR_NAME};

use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};

pub const CONNECTOR_NAME: &str = "gsheets";

Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/catalog/hive.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use async_trait::async_trait;
use stackable_operator::client::Client;
use stackable_trino_crd::catalog::hive::HiveConnector;

use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig};

pub const CONNECTOR_NAME: &str = "hive";

#[async_trait]
Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/catalog/iceberg.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use async_trait::async_trait;
use stackable_operator::client::Client;
use stackable_trino_crd::catalog::iceberg::IcebergConnector;

use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig};

pub const CONNECTOR_NAME: &str = "iceberg";

#[async_trait]
Expand Down
3 changes: 2 additions & 1 deletion rust/operator-binary/src/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ pub mod iceberg;
pub mod tpcds;
pub mod tpch;

use self::config::CatalogConfig;
use async_trait::async_trait;
use snafu::Snafu;
use stackable_operator::{
client::Client,
commons::{s3::S3Error, tls_verification::TlsClientDetailsError},
};

use self::config::CatalogConfig;

#[derive(Debug, Snafu)]
#[snafu(module)]
pub enum FromTrinoCatalogError {
Expand Down
Loading