diff --git a/Cargo.lock b/Cargo.lock index ac52c387..c46a6bee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2443,21 +2443,6 @@ dependencies = [ "snafu 0.8.5", ] -[[package]] -name = "stackable-trino-crd" -version = "0.0.0-dev" -dependencies = [ - "rstest", - "semver", - "serde", - "serde_json", - "serde_yaml", - "snafu 0.8.5", - "stackable-operator", - "strum", - "tracing", -] - [[package]] name = "stackable-trino-operator" version = "0.0.0-dev" @@ -2474,10 +2459,11 @@ dependencies = [ "product-config", "rstest", "semver", + "serde", + "serde_json", "serde_yaml", "snafu 0.8.5", "stackable-operator", - "stackable-trino-crd", "strum", "tokio", "tracing", diff --git a/Cargo.nix b/Cargo.nix index 1ab1ddf3..9fdc4f17 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -32,21 +32,23 @@ rec { # "public" attributes that we attempt to keep stable with new versions of crate2nix. # + rootCrate = rec { + packageId = "stackable-trino-operator"; + # Use this attribute to refer to the derivation building your root crate package. + # You can override the features with rootCrate.build.override { features = [ "default" "feature1" ... ]; }. + build = internal.buildRustCrateWithFeatures { + inherit packageId; + }; + + # Debug support which might change between releases. + # File a bug if you depend on any for non-debug work! + debug = internal.debugCrate { inherit packageId; }; + }; # Refer your crate build derivation by name here. # You can override the features with # workspaceMembers."${crateName}".build.override { features = [ "default" "feature1" ... ]; }. workspaceMembers = { - "stackable-trino-crd" = rec { - packageId = "stackable-trino-crd"; - build = internal.buildRustCrateWithFeatures { - packageId = "stackable-trino-crd"; - }; - - # Debug support which might change between releases. - # File a bug if you depend on any for non-debug work! - debug = internal.debugCrate { inherit packageId; }; - }; "stackable-trino-operator" = rec { packageId = "stackable-trino-operator"; build = internal.buildRustCrateWithFeatures { @@ -4875,9 +4877,9 @@ rec { }; "openssl" = rec { crateName = "openssl"; - version = "0.10.68"; + version = "0.10.70"; edition = "2021"; - sha256 = "1xbiz2bmba2fibg70s462yk2fndp3f9vz11c7iw0ilh2y54bqx31"; + sha256 = "1ij21wa5hzip17v91gl9x3n4h0am10ivq065andqrfx8cvhv9kv1"; authors = [ "Steven Fackler " ]; @@ -4956,10 +4958,10 @@ rec { }; "openssl-sys" = rec { crateName = "openssl-sys"; - version = "0.9.104"; + version = "0.9.105"; edition = "2021"; links = "openssl"; - sha256 = "0hf712xcxmycnlc09r8d446b3mwqchsbfrjv374fp7grrc3g7as5"; + sha256 = "1p59q259h73w58fgajyd588hzaj9r3vp3jy78xlqsnp09fwda8lb"; build = "build/main.rs"; libName = "openssl_sys"; authors = [ @@ -7600,59 +7602,6 @@ rec { } ]; - }; - "stackable-trino-crd" = rec { - crateName = "stackable-trino-crd"; - version = "0.0.0-dev"; - edition = "2021"; - src = lib.cleanSourceWith { filter = sourceFilter; src = ./rust/crd; }; - libName = "stackable_trino_crd"; - authors = [ - "Stackable GmbH " - ]; - dependencies = [ - { - name = "semver"; - packageId = "semver"; - } - { - name = "serde"; - packageId = "serde"; - features = [ "derive" ]; - } - { - name = "serde_json"; - packageId = "serde_json"; - } - { - name = "snafu"; - packageId = "snafu 0.8.5"; - } - { - name = "stackable-operator"; - packageId = "stackable-operator"; - } - { - name = "strum"; - packageId = "strum"; - features = [ "derive" ]; - } - { - name = "tracing"; - packageId = "tracing"; - } - ]; - devDependencies = [ - { - name = "rstest"; - packageId = "rstest"; - } - { - name = "serde_yaml"; - packageId = "serde_yaml"; - } - ]; - }; "stackable-trino-operator" = rec { crateName = "stackable-trino-operator"; @@ -7711,6 +7660,15 @@ rec { name = "semver"; packageId = "semver"; } + { + name = "serde"; + packageId = "serde"; + features = [ "derive" ]; + } + { + name = "serde_json"; + packageId = "serde_json"; + } { name = "serde_yaml"; packageId = "serde_yaml"; @@ -7723,10 +7681,6 @@ rec { name = "stackable-operator"; packageId = "stackable-operator"; } - { - name = "stackable-trino-crd"; - packageId = "stackable-trino-crd"; - } { name = "strum"; packageId = "strum"; @@ -7754,6 +7708,10 @@ rec { name = "rstest"; packageId = "rstest"; } + { + name = "serde_yaml"; + packageId = "serde_yaml"; + } ]; }; diff --git a/Cargo.toml b/Cargo.toml index 12757d3d..198bca1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["rust/crd", "rust/operator-binary"] +members = ["rust/operator-binary"] resolver = "2" [workspace.package] diff --git a/rust/crd/Cargo.toml b/rust/crd/Cargo.toml deleted file mode 100644 index ce886053..00000000 --- a/rust/crd/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "stackable-trino-crd" -description = "Contains the Trino CRD structs and utilities" -version.workspace = true -authors.workspace = true -license.workspace = true -edition.workspace = true -repository.workspace = true -publish = false - -[dependencies] -semver.workspace = true -serde.workspace = true -serde_json.workspace = true -snafu.workspace = true -stackable-operator.workspace = true -strum.workspace = true -tracing.workspace = true - -[dev-dependencies] -rstest.workspace = true -serde_yaml.workspace = true diff --git a/rust/operator-binary/Cargo.toml b/rust/operator-binary/Cargo.toml index 11110f7a..bf0e0459 100644 --- a/rust/operator-binary/Cargo.toml +++ b/rust/operator-binary/Cargo.toml @@ -10,7 +10,6 @@ publish = false build = "build.rs" [dependencies] -stackable-trino-crd = { path = "../crd" } anyhow.workspace = true async-trait.workspace = true @@ -28,9 +27,12 @@ strum.workspace = true tokio.workspace = true tracing.workspace = true serde_yaml.workspace = true +serde.workspace = true +serde_json.workspace = true [dev-dependencies] rstest.workspace = true +serde_yaml.workspace = true [build-dependencies] built.workspace = true diff --git a/rust/operator-binary/src/authentication/mod.rs b/rust/operator-binary/src/authentication/mod.rs index 5eea8baa..730b9afc 100644 --- a/rust/operator-binary/src/authentication/mod.rs +++ b/rust/operator-binary/src/authentication/mod.rs @@ -22,16 +22,18 @@ use stackable_operator::{ k8s_openapi::api::core::v1::{Container, EnvVar, Volume, VolumeMount}, kube::{runtime::reflector::ObjectRef, ResourceExt}, }; -use stackable_trino_crd::{authentication::ResolvedAuthenticationClassRef, TrinoRole}; use strum::EnumDiscriminants; use tracing::trace; -use crate::authentication::{ - oidc::{OidcAuthenticator, TrinoOidcAuthentication}, - password::{ - file::FileAuthenticator, ldap::LdapAuthenticator, TrinoPasswordAuthentication, - TrinoPasswordAuthenticator, +use crate::{ + authentication::{ + oidc::{OidcAuthenticator, TrinoOidcAuthentication}, + password::{ + file::FileAuthenticator, ldap::LdapAuthenticator, TrinoPasswordAuthentication, + TrinoPasswordAuthenticator, + }, }, + crd::{authentication::ResolvedAuthenticationClassRef, TrinoRole}, }; pub(crate) mod oidc; @@ -85,14 +87,14 @@ pub struct TrinoAuthenticationConfig { /// All extra config files required for authentication for each role. config_files: HashMap>, /// Additional env variables for a certain role and container - env_vars: HashMap>>, + env_vars: HashMap>>, /// All extra container commands for a certain role and container - commands: HashMap>>, + commands: HashMap>>, /// Additional volumes like secret mounts, user file database etc. volumes: Vec, /// Additional volume mounts for each role and container. Shared volumes have to be added /// manually in each container. - volume_mounts: HashMap>>, + volume_mounts: HashMap>>, /// Additional side car container for the provided role sidecar_containers: HashMap>, } @@ -157,29 +159,27 @@ impl TrinoAuthenticationConfig { .add_volumes(self.volumes()) .context(AddVolumeSnafu)?; - let affected_containers = vec![ - stackable_trino_crd::Container::Prepare, - stackable_trino_crd::Container::Trino, - ]; + let affected_containers = + vec![crate::crd::Container::Prepare, crate::crd::Container::Trino]; for container in &affected_containers { let volume_mounts = self.volume_mounts(role, container); match container { - stackable_trino_crd::Container::Prepare => { + crate::crd::Container::Prepare => { prepare_builder .add_volume_mounts(volume_mounts) .context(AddVolumeMountSnafu)?; } - stackable_trino_crd::Container::Trino => { + crate::crd::Container::Trino => { trino_builder .add_volume_mounts(volume_mounts) .context(AddVolumeMountSnafu)?; } // handled internally - stackable_trino_crd::Container::PasswordFileUpdater => {} + crate::crd::Container::PasswordFileUpdater => {} // nothing to do here - stackable_trino_crd::Container::Vector => {} + crate::crd::Container::Vector => {} } } @@ -220,7 +220,7 @@ impl TrinoAuthenticationConfig { pub fn add_env_vars( &mut self, role: TrinoRole, - container: stackable_trino_crd::Container, + container: crate::crd::Container, env_var: Vec, ) { self.env_vars @@ -235,7 +235,7 @@ impl TrinoAuthenticationConfig { pub fn add_commands( &mut self, role: TrinoRole, - container: stackable_trino_crd::Container, + container: crate::crd::Container, commands: Vec, ) { self.commands @@ -265,7 +265,7 @@ impl TrinoAuthenticationConfig { pub fn add_volume_mount( &mut self, role: TrinoRole, - container: stackable_trino_crd::Container, + container: crate::crd::Container, volume_mount: VolumeMount, ) { let current_volume_mounts = self @@ -288,7 +288,7 @@ impl TrinoAuthenticationConfig { pub fn add_volume_mounts( &mut self, role: TrinoRole, - container: stackable_trino_crd::Container, + container: crate::crd::Container, volume_mounts: Vec, ) { for volume_mount in volume_mounts { @@ -319,11 +319,7 @@ impl TrinoAuthenticationConfig { } /// Retrieve additional env vars for a given role and container. - pub fn env_vars( - &self, - role: &TrinoRole, - container: &stackable_trino_crd::Container, - ) -> Vec { + pub fn env_vars(&self, role: &TrinoRole, container: &crate::crd::Container) -> Vec { self.env_vars .get(role) .cloned() @@ -334,11 +330,7 @@ impl TrinoAuthenticationConfig { } /// Retrieve additional container commands for a given role and container. - pub fn commands( - &self, - role: &TrinoRole, - container: &stackable_trino_crd::Container, - ) -> Vec { + pub fn commands(&self, role: &TrinoRole, container: &crate::crd::Container) -> Vec { self.commands .get(role) .cloned() @@ -357,7 +349,7 @@ impl TrinoAuthenticationConfig { pub fn volume_mounts( &self, role: &TrinoRole, - container: &stackable_trino_crd::Container, + container: &crate::crd::Container, ) -> Vec { if let Some(volume_mounts) = self.volume_mounts.get(role) { volume_mounts.get(container).cloned().unwrap_or_default() @@ -565,9 +557,9 @@ impl TryFrom> for TrinoAuthenticationTypes { #[cfg(test)] mod tests { use stackable_operator::commons::authentication::oidc::ClientAuthenticationOptions; - use stackable_trino_crd::RW_CONFIG_DIR_NAME; use super::*; + use crate::crd::RW_CONFIG_DIR_NAME; const OIDC_AUTH_CLASS_1: &str = "oidc-auth-1"; const FILE_AUTH_CLASS_1: &str = "file-auth-1"; @@ -800,17 +792,15 @@ mod tests { fn test_trino_password_authenticator_volume_mounts() { // nothing for workers assert!(setup_authentication_config() - .volume_mounts(&TrinoRole::Worker, &stackable_trino_crd::Container::Trino,) + .volume_mounts(&TrinoRole::Worker, &crate::crd::Container::Trino,) .is_empty()); assert!(setup_authentication_config() - .volume_mounts(&TrinoRole::Worker, &stackable_trino_crd::Container::Prepare,) + .volume_mounts(&TrinoRole::Worker, &crate::crd::Container::Prepare,) .is_empty()); // coordinator - main container - let coordinator_main_mounts = setup_authentication_config().volume_mounts( - &TrinoRole::Coordinator, - &stackable_trino_crd::Container::Trino, - ); + let coordinator_main_mounts = setup_authentication_config() + .volume_mounts(&TrinoRole::Coordinator, &crate::crd::Container::Trino); // we expect one user password db mount assert_eq!(coordinator_main_mounts.len(), 1); @@ -828,19 +818,16 @@ mod tests { // nothing for workers assert!(auth_config - .commands(&TrinoRole::Worker, &stackable_trino_crd::Container::Trino) + .commands(&TrinoRole::Worker, &crate::crd::Container::Trino) .is_empty()); assert!(auth_config_with_ldap_bind - .commands(&TrinoRole::Worker, &stackable_trino_crd::Container::Trino) + .commands(&TrinoRole::Worker, &crate::crd::Container::Trino) .is_empty()); // we expect 0 entries because no bind credentials env export assert_eq!( auth_config - .commands( - &TrinoRole::Coordinator, - &stackable_trino_crd::Container::Trino - ) + .commands(&TrinoRole::Coordinator, &crate::crd::Container::Trino) .len(), 0 ); @@ -848,10 +835,7 @@ mod tests { // We expect 8 entries because of "set +x", "set -x" and 2x user:password bind credential env export assert_eq!( auth_config_with_ldap_bind - .commands( - &TrinoRole::Coordinator, - &stackable_trino_crd::Container::Trino - ) + .commands(&TrinoRole::Coordinator, &crate::crd::Container::Trino) .len(), 8 ); diff --git a/rust/operator-binary/src/authentication/oidc/mod.rs b/rust/operator-binary/src/authentication/oidc/mod.rs index f2c4d367..5fc6c9db 100644 --- a/rust/operator-binary/src/authentication/oidc/mod.rs +++ b/rust/operator-binary/src/authentication/oidc/mod.rs @@ -3,9 +3,12 @@ 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}; +use crate::{ + authentication::TrinoAuthenticationConfig, + command, + crd::{TrinoRole, STACKABLE_CLIENT_TLS_DIR}, +}; // Trino properties const HTTP_SERVER_AUTHENTICATION_OAUTH2_CLIENT_ID: &str = @@ -115,7 +118,7 @@ impl TrinoOidcAuthentication { oauth2_authentication_config.add_env_vars( TrinoRole::Coordinator, - stackable_trino_crd::Container::Trino, + crate::crd::Container::Trino, oidc::AuthenticationProvider::client_credentials_env_var_mounts( authenticator.client_credentials_secret, ), @@ -159,12 +162,12 @@ impl TrinoOidcAuthentication { oauth2_authentication_config.add_volumes(tls_volumes); oauth2_authentication_config.add_volume_mounts( TrinoRole::Coordinator, - stackable_trino_crd::Container::Prepare, + crate::crd::Container::Prepare, tls_mounts.clone(), ); oauth2_authentication_config.add_volume_mounts( TrinoRole::Worker, - stackable_trino_crd::Container::Prepare, + crate::crd::Container::Prepare, tls_mounts, ); @@ -178,7 +181,7 @@ impl TrinoOidcAuthentication { if let Some(path) = authenticator.oidc.tls.tls_ca_cert_mount_path() { oauth2_authentication_config.add_commands( TrinoRole::Coordinator, - stackable_trino_crd::Container::Prepare, + crate::crd::Container::Prepare, command::add_cert_to_truststore(&path, STACKABLE_CLIENT_TLS_DIR, "oidc-idp"), ); } @@ -210,9 +213,9 @@ mod tests { use std::mem; use rstest::rstest; - use stackable_trino_crd::Container; use super::*; + use crate::crd::Container; const IDP_PORT: u16 = 8080; const IDP_SCOPE_1: &str = "openid"; diff --git a/rust/operator-binary/src/authentication/password/file.rs b/rust/operator-binary/src/authentication/password/file.rs index ba3567aa..924be944 100644 --- a/rust/operator-binary/src/authentication/password/file.rs +++ b/rust/operator-binary/src/authentication/password/file.rs @@ -116,17 +116,16 @@ pub fn build_password_file_update_container( resolved_product_image: &ResolvedProductImage, volume_mounts: Vec, ) -> Result { - let mut cb_pw_file_updater = - ContainerBuilder::new(&stackable_trino_crd::Container::PasswordFileUpdater.to_string()) - .expect( - "Invalid container name. This should not happen, as the container name is fixed", - ); + let mut cb_pw_file_updater = ContainerBuilder::new( + &crate::crd::Container::PasswordFileUpdater.to_string(), + ) + .expect("Invalid container name. This should not happen, as the container name is fixed"); let mut commands = vec![]; commands.push(product_logging::framework::capture_shell_output( STACKABLE_LOG_DIR, - &stackable_trino_crd::Container::PasswordFileUpdater.to_string(), + &crate::crd::Container::PasswordFileUpdater.to_string(), // we do not access any of the crd config options for this and just log it to file &AutomaticContainerLogConfig::default(), )); diff --git a/rust/operator-binary/src/authentication/password/mod.rs b/rust/operator-binary/src/authentication/password/mod.rs index f7615087..88145e95 100644 --- a/rust/operator-binary/src/authentication/password/mod.rs +++ b/rust/operator-binary/src/authentication/password/mod.rs @@ -12,12 +12,14 @@ use std::collections::BTreeMap; use snafu::{ResultExt, Snafu}; use stackable_operator::commons::product_image_selection::ResolvedProductImage; -use stackable_trino_crd::{Container, TrinoRole, RW_CONFIG_DIR_NAME}; use tracing::trace; -use crate::authentication::{ - password::{file::FileAuthenticator, ldap::LdapAuthenticator}, - TrinoAuthenticationConfig, +use crate::{ + authentication::{ + password::{file::FileAuthenticator, ldap::LdapAuthenticator}, + TrinoAuthenticationConfig, + }, + crd::{Container, TrinoRole, RW_CONFIG_DIR_NAME}, }; pub mod file; @@ -143,7 +145,7 @@ impl TrinoPasswordAuthentication { // extra commands password_authentication_config.add_commands( TrinoRole::Coordinator, - stackable_trino_crd::Container::Trino, + crate::crd::Container::Trino, ldap_authenticator.commands(), ); @@ -159,12 +161,12 @@ impl TrinoPasswordAuthentication { for volume_mount in volume_mounts { password_authentication_config.add_volume_mount( TrinoRole::Coordinator, - stackable_trino_crd::Container::Trino, + crate::crd::Container::Trino, volume_mount.clone(), ); password_authentication_config.add_volume_mount( TrinoRole::Coordinator, - stackable_trino_crd::Container::Prepare, + crate::crd::Container::Prepare, volume_mount.clone(), ); } diff --git a/rust/operator-binary/src/authorization/opa.rs b/rust/operator-binary/src/authorization/opa.rs index 39a23a29..752e5155 100644 --- a/rust/operator-binary/src/authorization/opa.rs +++ b/rust/operator-binary/src/authorization/opa.rs @@ -4,7 +4,8 @@ use stackable_operator::{ client::Client, commons::opa::{OpaApiVersion, OpaConfig}, }; -use stackable_trino_crd::TrinoCluster; + +use crate::crd::TrinoCluster; pub struct TrinoOpaConfig { /// URI for OPA policies, e.g. diff --git a/rust/operator-binary/src/catalog/black_hole.rs b/rust/operator-binary/src/catalog/black_hole.rs index e9cb1375..079c325a 100644 --- a/rust/operator-binary/src/catalog/black_hole.rs +++ b/rust/operator-binary/src/catalog/black_hole.rs @@ -1,8 +1,8 @@ use async_trait::async_trait; use stackable_operator::client::Client; -use stackable_trino_crd::catalog::black_hole::BlackHoleConnector; use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig}; +use crate::crd::catalog::black_hole::BlackHoleConnector; pub const CONNECTOR_NAME: &str = "blackhole"; diff --git a/rust/operator-binary/src/catalog/commons.rs b/rust/operator-binary/src/catalog/commons.rs index 633e43f6..8368e8ce 100644 --- a/rust/operator-binary/src/catalog/commons.rs +++ b/rust/operator-binary/src/catalog/commons.rs @@ -9,10 +9,6 @@ use stackable_operator::{ }, k8s_openapi::api::core::v1::ConfigMap, }; -use stackable_trino_crd::{ - catalog::commons::{HdfsConnection, MetastoreConnection}, - CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR, -}; use super::{ config::CatalogConfig, @@ -23,7 +19,13 @@ use super::{ }, ExtendCatalogConfig, FromTrinoCatalogError, }; -use crate::command; +use crate::{ + command, + crd::{ + catalog::commons::{HdfsConnection, MetastoreConnection}, + CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR, + }, +}; #[async_trait] impl ExtendCatalogConfig for MetastoreConnection { diff --git a/rust/operator-binary/src/catalog/config.rs b/rust/operator-binary/src/catalog/config.rs index 3ba2f21a..99cf20cb 100644 --- a/rust/operator-binary/src/catalog/config.rs +++ b/rust/operator-binary/src/catalog/config.rs @@ -7,9 +7,9 @@ use stackable_operator::{ }, kube::{Resource, ResourceExt}, }; -use stackable_trino_crd::catalog::{TrinoCatalog, TrinoCatalogConnector}; use super::{FromTrinoCatalogError, ToCatalogConfig}; +use crate::crd::catalog::{TrinoCatalog, TrinoCatalogConnector}; pub struct CatalogConfig { /// Name of the catalog diff --git a/rust/operator-binary/src/catalog/delta_lake.rs b/rust/operator-binary/src/catalog/delta_lake.rs index 7427ab53..f676fe76 100644 --- a/rust/operator-binary/src/catalog/delta_lake.rs +++ b/rust/operator-binary/src/catalog/delta_lake.rs @@ -1,8 +1,8 @@ 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}; +use crate::crd::catalog::delta_lake::DeltaLakeConnector; pub const CONNECTOR_NAME: &str = "delta_lake"; diff --git a/rust/operator-binary/src/catalog/generic.rs b/rust/operator-binary/src/catalog/generic.rs index c39c0976..8f6662b7 100644 --- a/rust/operator-binary/src/catalog/generic.rs +++ b/rust/operator-binary/src/catalog/generic.rs @@ -1,8 +1,8 @@ use async_trait::async_trait; use stackable_operator::client::Client; -use stackable_trino_crd::catalog::generic::{GenericConnector, Property}; use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig}; +use crate::crd::catalog::generic::{GenericConnector, Property}; #[async_trait] impl ToCatalogConfig for GenericConnector { diff --git a/rust/operator-binary/src/catalog/google_sheet.rs b/rust/operator-binary/src/catalog/google_sheet.rs index 9de41511..a80d6cc1 100644 --- a/rust/operator-binary/src/catalog/google_sheet.rs +++ b/rust/operator-binary/src/catalog/google_sheet.rs @@ -3,9 +3,9 @@ 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}; +use crate::crd::{catalog::google_sheet::GoogleSheetConnector, CONFIG_DIR_NAME}; pub const CONNECTOR_NAME: &str = "gsheets"; diff --git a/rust/operator-binary/src/catalog/hive.rs b/rust/operator-binary/src/catalog/hive.rs index b8d8f087..e20da0cf 100644 --- a/rust/operator-binary/src/catalog/hive.rs +++ b/rust/operator-binary/src/catalog/hive.rs @@ -1,8 +1,8 @@ use async_trait::async_trait; use stackable_operator::client::Client; -use stackable_trino_crd::catalog::hive::HiveConnector; use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig}; +use crate::crd::catalog::hive::HiveConnector; pub const CONNECTOR_NAME: &str = "hive"; diff --git a/rust/operator-binary/src/catalog/iceberg.rs b/rust/operator-binary/src/catalog/iceberg.rs index 2efc9436..987d7edb 100644 --- a/rust/operator-binary/src/catalog/iceberg.rs +++ b/rust/operator-binary/src/catalog/iceberg.rs @@ -1,8 +1,8 @@ use async_trait::async_trait; use stackable_operator::client::Client; -use stackable_trino_crd::catalog::iceberg::IcebergConnector; use super::{config::CatalogConfig, ExtendCatalogConfig, FromTrinoCatalogError, ToCatalogConfig}; +use crate::crd::catalog::iceberg::IcebergConnector; pub const CONNECTOR_NAME: &str = "iceberg"; diff --git a/rust/operator-binary/src/catalog/tpcds.rs b/rust/operator-binary/src/catalog/tpcds.rs index 28aae0d3..cf710816 100644 --- a/rust/operator-binary/src/catalog/tpcds.rs +++ b/rust/operator-binary/src/catalog/tpcds.rs @@ -1,8 +1,8 @@ use async_trait::async_trait; use stackable_operator::client::Client; -use stackable_trino_crd::catalog::tpcds::TpcdsConnector; use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig}; +use crate::crd::catalog::tpcds::TpcdsConnector; pub const CONNECTOR_NAME: &str = "tpcds"; diff --git a/rust/operator-binary/src/catalog/tpch.rs b/rust/operator-binary/src/catalog/tpch.rs index 37986c49..591122b4 100644 --- a/rust/operator-binary/src/catalog/tpch.rs +++ b/rust/operator-binary/src/catalog/tpch.rs @@ -1,8 +1,8 @@ use async_trait::async_trait; use stackable_operator::client::Client; -use stackable_trino_crd::catalog::tpch::TpchConnector; use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig}; +use crate::crd::catalog::tpch::TpchConnector; pub const CONNECTOR_NAME: &str = "tpch"; diff --git a/rust/operator-binary/src/command.rs b/rust/operator-binary/src/command.rs index 2117405f..eb5c56e1 100644 --- a/rust/operator-binary/src/command.rs +++ b/rust/operator-binary/src/command.rs @@ -5,17 +5,17 @@ use stackable_operator::{ }, utils::COMMON_BASH_TRAP_FUNCTIONS, }; -use stackable_trino_crd::{ - Container, TrinoCluster, TrinoConfig, TrinoRole, CONFIG_DIR_NAME, DATA_DIR_NAME, - LOG_PROPERTIES, RW_CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR, STACKABLE_INTERNAL_TLS_DIR, - STACKABLE_MOUNT_INTERNAL_TLS_DIR, STACKABLE_MOUNT_SERVER_TLS_DIR, STACKABLE_SERVER_TLS_DIR, - STACKABLE_TLS_STORE_PASSWORD, SYSTEM_TRUST_STORE, SYSTEM_TRUST_STORE_PASSWORD, -}; use crate::{ authentication::TrinoAuthenticationConfig, catalog::config::CatalogConfig, controller::{STACKABLE_LOG_CONFIG_DIR, STACKABLE_LOG_DIR}, + crd::{ + Container, TrinoCluster, TrinoConfig, TrinoRole, CONFIG_DIR_NAME, DATA_DIR_NAME, + LOG_PROPERTIES, RW_CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR, STACKABLE_INTERNAL_TLS_DIR, + STACKABLE_MOUNT_INTERNAL_TLS_DIR, STACKABLE_MOUNT_SERVER_TLS_DIR, STACKABLE_SERVER_TLS_DIR, + STACKABLE_TLS_STORE_PASSWORD, SYSTEM_TRUST_STORE, SYSTEM_TRUST_STORE_PASSWORD, + }, }; pub fn container_prepare_args( diff --git a/rust/operator-binary/src/config/jvm.rs b/rust/operator-binary/src/config/jvm.rs index 79b15152..4c77d44d 100644 --- a/rust/operator-binary/src/config/jvm.rs +++ b/rust/operator-binary/src/config/jvm.rs @@ -5,7 +5,8 @@ use stackable_operator::{ memory::{BinaryMultiple, MemoryQuantity}, role_utils::{self, GenericRoleConfig, JavaCommonConfig, JvmArgumentOverrides, Role}, }; -use stackable_trino_crd::{ + +use crate::crd::{ TrinoConfig, TrinoConfigFragment, JVM_HEAP_FACTOR, JVM_SECURITY_PROPERTIES, METRICS_PORT, RW_CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR, STACKABLE_TLS_STORE_PASSWORD, }; @@ -150,9 +151,9 @@ fn recommended_trino_jvm_args(product_version: &str) -> Result, Erro #[cfg(test)] mod tests { use indoc::indoc; - use stackable_trino_crd::{TrinoCluster, TrinoRole}; use super::*; + use crate::crd::{TrinoCluster, TrinoRole}; #[test] fn test_jvm_config_defaults() { diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index ee32c4df..e4d105ea 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -71,18 +71,6 @@ use stackable_operator::{ time::Duration, utils::cluster_info::KubernetesClusterInfo, }; -use stackable_trino_crd::{ - authentication::resolve_authentication_classes, - catalog::TrinoCatalog, - discovery::{TrinoDiscovery, TrinoDiscoveryProtocol, TrinoPodRef}, - Container, TrinoCluster, TrinoClusterStatus, TrinoConfig, TrinoConfigFragment, TrinoRole, - ACCESS_CONTROL_PROPERTIES, APP_NAME, CONFIG_DIR_NAME, CONFIG_PROPERTIES, DATA_DIR_NAME, - DISCOVERY_URI, ENV_INTERNAL_SECRET, HTTPS_PORT, HTTPS_PORT_NAME, HTTP_PORT, HTTP_PORT_NAME, - JVM_CONFIG, JVM_SECURITY_PROPERTIES, LOG_COMPRESSION, LOG_FORMAT, LOG_MAX_SIZE, - LOG_MAX_TOTAL_SIZE, LOG_PATH, LOG_PROPERTIES, METRICS_PORT, METRICS_PORT_NAME, NODE_PROPERTIES, - RW_CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR, STACKABLE_INTERNAL_TLS_DIR, - STACKABLE_MOUNT_INTERNAL_TLS_DIR, STACKABLE_MOUNT_SERVER_TLS_DIR, STACKABLE_SERVER_TLS_DIR, -}; use strum::{EnumDiscriminants, IntoStaticStr}; use crate::{ @@ -90,6 +78,18 @@ use crate::{ authorization::opa::TrinoOpaConfig, catalog::{config::CatalogConfig, FromTrinoCatalogError}, command, config, + crd::{ + authentication::resolve_authentication_classes, + catalog::TrinoCatalog, + discovery::{TrinoDiscovery, TrinoDiscoveryProtocol, TrinoPodRef}, + Container, TrinoCluster, TrinoClusterStatus, TrinoConfig, TrinoConfigFragment, TrinoRole, + ACCESS_CONTROL_PROPERTIES, APP_NAME, CONFIG_DIR_NAME, CONFIG_PROPERTIES, DATA_DIR_NAME, + DISCOVERY_URI, ENV_INTERNAL_SECRET, HTTPS_PORT, HTTPS_PORT_NAME, HTTP_PORT, HTTP_PORT_NAME, + JVM_CONFIG, JVM_SECURITY_PROPERTIES, LOG_COMPRESSION, LOG_FORMAT, LOG_MAX_SIZE, + LOG_MAX_TOTAL_SIZE, LOG_PATH, LOG_PROPERTIES, METRICS_PORT, METRICS_PORT_NAME, + NODE_PROPERTIES, RW_CONFIG_DIR_NAME, STACKABLE_CLIENT_TLS_DIR, STACKABLE_INTERNAL_TLS_DIR, + STACKABLE_MOUNT_INTERNAL_TLS_DIR, STACKABLE_MOUNT_SERVER_TLS_DIR, STACKABLE_SERVER_TLS_DIR, + }, operations::{ add_graceful_shutdown_config, graceful_shutdown_config_properties, pdb::add_pdbs, }, @@ -200,7 +200,7 @@ pub enum Error { FailedToParseRole { source: strum::ParseError }, #[snafu(display("internal operator failure: {source}"))] - InternalOperatorFailure { source: stackable_trino_crd::Error }, + InternalOperatorFailure { source: crate::crd::Error }, #[snafu(display("no coordinator pods found for discovery"))] MissingCoordinatorPods, @@ -233,7 +233,7 @@ pub enum Error { }, #[snafu(display("failed to resolve and merge config for role and role group"))] - FailedToResolveConfig { source: stackable_trino_crd::Error }, + FailedToResolveConfig { source: crate::crd::Error }, #[snafu(display("failed to resolve the Vector aggregator address"))] ResolveVectorAggregatorAddress { @@ -271,7 +271,7 @@ pub enum Error { #[snafu(display("Failed to retrieve AuthenticationClass"))] AuthenticationClassRetrieval { - source: stackable_trino_crd::authentication::Error, + source: crate::crd::authentication::Error, }, #[snafu(display("Unsupported Trino authentication"))] @@ -343,7 +343,7 @@ pub enum Error { }, #[snafu(display("failed to read role"))] - ReadRole { source: stackable_trino_crd::Error }, + ReadRole { source: crate::crd::Error }, #[snafu(display("failed to get merged jvmArgumentOverrides"))] GetMergedJvmArgumentOverrides { diff --git a/rust/crd/src/affinity.rs b/rust/operator-binary/src/crd/affinity.rs similarity index 99% rename from rust/crd/src/affinity.rs rename to rust/operator-binary/src/crd/affinity.rs index 9b2c0a5d..562a0841 100644 --- a/rust/crd/src/affinity.rs +++ b/rust/operator-binary/src/crd/affinity.rs @@ -5,7 +5,10 @@ use stackable_operator::{ k8s_openapi::api::core::v1::{PodAffinity, PodAntiAffinity}, }; -use crate::{catalog::TrinoCatalogConnector, TrinoCatalog, TrinoRole, APP_NAME}; +use crate::crd::{ + catalog::{TrinoCatalog, TrinoCatalogConnector}, + TrinoRole, APP_NAME, +}; pub fn get_affinity( cluster_name: &str, @@ -99,7 +102,7 @@ mod tests { }; use super::*; - use crate::TrinoCluster; + use crate::crd::TrinoCluster; #[rstest] #[case(TrinoRole::Coordinator)] diff --git a/rust/crd/src/authentication.rs b/rust/operator-binary/src/crd/authentication.rs similarity index 100% rename from rust/crd/src/authentication.rs rename to rust/operator-binary/src/crd/authentication.rs diff --git a/rust/crd/src/catalog/black_hole.rs b/rust/operator-binary/src/crd/catalog/black_hole.rs similarity index 100% rename from rust/crd/src/catalog/black_hole.rs rename to rust/operator-binary/src/crd/catalog/black_hole.rs diff --git a/rust/crd/src/catalog/commons.rs b/rust/operator-binary/src/crd/catalog/commons.rs similarity index 100% rename from rust/crd/src/catalog/commons.rs rename to rust/operator-binary/src/crd/catalog/commons.rs diff --git a/rust/crd/src/catalog/delta_lake.rs b/rust/operator-binary/src/crd/catalog/delta_lake.rs similarity index 100% rename from rust/crd/src/catalog/delta_lake.rs rename to rust/operator-binary/src/crd/catalog/delta_lake.rs diff --git a/rust/crd/src/catalog/generic.rs b/rust/operator-binary/src/crd/catalog/generic.rs similarity index 98% rename from rust/crd/src/catalog/generic.rs rename to rust/operator-binary/src/crd/catalog/generic.rs index a6b80d3c..442ac298 100644 --- a/rust/crd/src/catalog/generic.rs +++ b/rust/operator-binary/src/crd/catalog/generic.rs @@ -38,7 +38,7 @@ pub enum Property { #[cfg(test)] mod tests { use super::*; - use crate::catalog::{TrinoCatalog, TrinoCatalogConnector}; + use crate::crd::catalog::{TrinoCatalog, TrinoCatalogConnector}; #[test] fn test_cr_parsing() { diff --git a/rust/crd/src/catalog/google_sheet.rs b/rust/operator-binary/src/crd/catalog/google_sheet.rs similarity index 100% rename from rust/crd/src/catalog/google_sheet.rs rename to rust/operator-binary/src/crd/catalog/google_sheet.rs diff --git a/rust/crd/src/catalog/hive.rs b/rust/operator-binary/src/crd/catalog/hive.rs similarity index 100% rename from rust/crd/src/catalog/hive.rs rename to rust/operator-binary/src/crd/catalog/hive.rs diff --git a/rust/crd/src/catalog/iceberg.rs b/rust/operator-binary/src/crd/catalog/iceberg.rs similarity index 100% rename from rust/crd/src/catalog/iceberg.rs rename to rust/operator-binary/src/crd/catalog/iceberg.rs diff --git a/rust/crd/src/catalog/mod.rs b/rust/operator-binary/src/crd/catalog/mod.rs similarity index 100% rename from rust/crd/src/catalog/mod.rs rename to rust/operator-binary/src/crd/catalog/mod.rs diff --git a/rust/crd/src/catalog/tpcds.rs b/rust/operator-binary/src/crd/catalog/tpcds.rs similarity index 100% rename from rust/crd/src/catalog/tpcds.rs rename to rust/operator-binary/src/crd/catalog/tpcds.rs diff --git a/rust/crd/src/catalog/tpch.rs b/rust/operator-binary/src/crd/catalog/tpch.rs similarity index 100% rename from rust/crd/src/catalog/tpch.rs rename to rust/operator-binary/src/crd/catalog/tpch.rs diff --git a/rust/crd/src/discovery.rs b/rust/operator-binary/src/crd/discovery.rs similarity index 97% rename from rust/crd/src/discovery.rs rename to rust/operator-binary/src/crd/discovery.rs index b74c8f3b..871f7de8 100644 --- a/rust/crd/src/discovery.rs +++ b/rust/operator-binary/src/crd/discovery.rs @@ -1,6 +1,6 @@ use stackable_operator::utils::cluster_info::KubernetesClusterInfo; -use crate::{HTTPS_PORT, HTTP_PORT}; +use crate::crd::{HTTPS_PORT, HTTP_PORT}; /// Reference to a single `Pod` that is a component of a [`crate::TrinoCluster`] #[derive(Clone, Debug, Eq, PartialEq)] diff --git a/rust/crd/src/lib.rs b/rust/operator-binary/src/crd/mod.rs similarity index 99% rename from rust/crd/src/lib.rs rename to rust/operator-binary/src/crd/mod.rs index adfa4d14..7e4f2063 100644 --- a/rust/crd/src/lib.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -37,7 +37,7 @@ use stackable_operator::{ }; use strum::{Display, EnumIter, EnumString, IntoEnumIterator}; -use crate::discovery::TrinoPodRef; +use crate::crd::discovery::TrinoPodRef; pub const APP_NAME: &str = "trino"; // ports @@ -84,10 +84,6 @@ pub const INTERNAL_COMMUNICATION_HTTPS_TRUSTSTORE_KEY: &str = "internal-communication.https.truststore.key"; pub const NODE_INTERNAL_ADDRESS_SOURCE: &str = "node.internal-address-source"; pub const NODE_INTERNAL_ADDRESS_SOURCE_FQDN: &str = "FQDN"; -// log.properties -pub const IO_TRINO: &str = "io.trino"; -// jvm.config -pub const METRICS_PORT_PROPERTY: &str = "metricsPort"; // directories pub const CONFIG_DIR_NAME: &str = "/stackable/config"; pub const RW_CONFIG_DIR_NAME: &str = "/stackable/rwconfig"; @@ -103,11 +99,6 @@ pub const STACKABLE_TLS_STORE_PASSWORD: &str = "changeit"; pub const SYSTEM_TRUST_STORE_PASSWORD: &str = "changeit"; // secret vars pub const ENV_INTERNAL_SECRET: &str = "INTERNAL_SECRET"; -// S3 secrets -pub const ENV_S3_ACCESS_KEY: &str = "S3_ACCESS_KEY"; -pub const ENV_S3_SECRET_KEY: &str = "S3_SECRET_KEY"; -pub const SECRET_KEY_S3_ACCESS_KEY: &str = "accessKey"; -pub const SECRET_KEY_S3_SECRET_KEY: &str = "secretKey"; // TLS pub const TLS_DEFAULT_SECRET_CLASS: &str = "tls"; // Logging diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index 3245ac5b..f5e8db05 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -4,6 +4,7 @@ mod catalog; mod command; mod config; mod controller; +mod crd; mod operations; mod product_logging; @@ -30,9 +31,11 @@ use stackable_operator::{ logging::controller::report_controller_reconciled, CustomResourceExt, }; -use stackable_trino_crd::{catalog::TrinoCatalog, TrinoCluster, APP_NAME}; -use crate::controller::{FULL_CONTROLLER_NAME, OPERATOR_NAME}; +use crate::{ + controller::{FULL_CONTROLLER_NAME, OPERATOR_NAME}, + crd::{catalog::TrinoCatalog, TrinoCluster, APP_NAME}, +}; mod built_info { include!(concat!(env!("OUT_DIR"), "/built.rs")); diff --git a/rust/operator-binary/src/operations/graceful_shutdown.rs b/rust/operator-binary/src/operations/graceful_shutdown.rs index 507e86e4..e36fe661 100644 --- a/rust/operator-binary/src/operations/graceful_shutdown.rs +++ b/rust/operator-binary/src/operations/graceful_shutdown.rs @@ -8,7 +8,8 @@ use stackable_operator::{ builder::pod::{container::ContainerBuilder, PodBuilder}, k8s_openapi::api::core::v1::{ExecAction, LifecycleHandler}, }; -use stackable_trino_crd::{ + +use crate::crd::{ TrinoCluster, TrinoConfig, TrinoRole, WORKER_GRACEFUL_SHUTDOWN_SAFETY_OVERHEAD, WORKER_SHUTDOWN_GRACE_PERIOD, }; diff --git a/rust/operator-binary/src/operations/pdb.rs b/rust/operator-binary/src/operations/pdb.rs index 2361061c..d4110e30 100644 --- a/rust/operator-binary/src/operations/pdb.rs +++ b/rust/operator-binary/src/operations/pdb.rs @@ -5,9 +5,11 @@ use stackable_operator::{ builder::pdb::PodDisruptionBudgetBuilder, client::Client, cluster_resources::ClusterResources, commons::pdb::PdbConfig, kube::ResourceExt, }; -use stackable_trino_crd::{TrinoCluster, TrinoRole, APP_NAME}; -use crate::controller::{CONTROLLER_NAME, OPERATOR_NAME}; +use crate::{ + controller::{CONTROLLER_NAME, OPERATOR_NAME}, + crd::{TrinoCluster, TrinoRole, APP_NAME}, +}; #[derive(Snafu, Debug)] pub enum Error { diff --git a/rust/operator-binary/src/product_logging.rs b/rust/operator-binary/src/product_logging.rs index 4913e276..08d5d6a0 100644 --- a/rust/operator-binary/src/product_logging.rs +++ b/rust/operator-binary/src/product_logging.rs @@ -12,9 +12,10 @@ use stackable_operator::{ }, role_utils::RoleGroupRef, }; -use stackable_trino_crd::{Container, TrinoCluster}; use strum::Display; +use crate::crd::{Container, TrinoCluster}; + #[derive(Snafu, Debug)] pub enum Error { #[snafu(display("object has no namespace"))]