From b73ea77600e57f50fb69c3f90c0c7669336bc339 Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Mon, 24 Feb 2025 10:53:56 +0100 Subject: [PATCH 1/9] chore: migrate crd crate to operator-binary module. --- Cargo.lock | 18 +--- Cargo.nix | 100 +++++------------- Cargo.toml | 2 +- rust/crd/Cargo.toml | 22 ---- rust/operator-binary/Cargo.toml | 4 +- .../operator-binary/src/authentication/mod.rs | 82 ++++++-------- .../src/authentication/oidc/mod.rs | 17 +-- .../src/authentication/password/file.rs | 11 +- .../src/authentication/password/mod.rs | 16 +-- rust/operator-binary/src/authorization/opa.rs | 3 +- .../operator-binary/src/catalog/black_hole.rs | 2 +- rust/operator-binary/src/catalog/commons.rs | 12 ++- rust/operator-binary/src/catalog/config.rs | 2 +- .../operator-binary/src/catalog/delta_lake.rs | 2 +- rust/operator-binary/src/catalog/generic.rs | 2 +- .../src/catalog/google_sheet.rs | 2 +- rust/operator-binary/src/catalog/hive.rs | 2 +- rust/operator-binary/src/catalog/iceberg.rs | 2 +- rust/operator-binary/src/catalog/tpcds.rs | 2 +- rust/operator-binary/src/catalog/tpch.rs | 2 +- rust/operator-binary/src/command.rs | 12 +-- rust/operator-binary/src/config/jvm.rs | 5 +- rust/operator-binary/src/controller.rs | 32 +++--- .../src/crd}/affinity.rs | 7 +- .../src/crd}/authentication.rs | 0 .../src/crd}/catalog/black_hole.rs | 0 .../src/crd}/catalog/commons.rs | 0 .../src/crd}/catalog/delta_lake.rs | 0 .../src/crd}/catalog/generic.rs | 2 +- .../src/crd}/catalog/google_sheet.rs | 0 .../src/crd}/catalog/hive.rs | 0 .../src/crd}/catalog/iceberg.rs | 0 .../src/crd}/catalog/mod.rs | 0 .../src/crd}/catalog/tpcds.rs | 0 .../src/crd}/catalog/tpch.rs | 0 .../src/crd}/discovery.rs | 2 +- .../lib.rs => operator-binary/src/crd/mod.rs} | 11 +- rust/operator-binary/src/main.rs | 7 +- .../src/operations/graceful_shutdown.rs | 3 +- rust/operator-binary/src/operations/pdb.rs | 6 +- rust/operator-binary/src/product_logging.rs | 3 +- 41 files changed, 156 insertions(+), 239 deletions(-) delete mode 100644 rust/crd/Cargo.toml rename rust/{crd/src => operator-binary/src/crd}/affinity.rs (99%) rename rust/{crd/src => operator-binary/src/crd}/authentication.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/catalog/black_hole.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/catalog/commons.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/catalog/delta_lake.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/catalog/generic.rs (98%) rename rust/{crd/src => operator-binary/src/crd}/catalog/google_sheet.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/catalog/hive.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/catalog/iceberg.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/catalog/mod.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/catalog/tpcds.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/catalog/tpch.rs (100%) rename rust/{crd/src => operator-binary/src/crd}/discovery.rs (97%) rename rust/{crd/src/lib.rs => operator-binary/src/crd/mod.rs} (99%) 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"))] From 6eb997a2ec6678f39b5becc94af03072a3b9b852 Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Mon, 24 Feb 2025 11:34:24 +0100 Subject: [PATCH 2/9] remove unused dependencies --- Cargo.lock | 2 -- Cargo.nix | 8 -------- Cargo.toml | 2 -- rust/operator-binary/Cargo.toml | 2 -- 4 files changed, 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c46a6bee..a3598200 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2455,10 +2455,8 @@ dependencies = [ "futures 0.3.31", "indoc", "openssl", - "pin-project", "product-config", "rstest", - "semver", "serde", "serde_json", "serde_yaml", diff --git a/Cargo.nix b/Cargo.nix index 9fdc4f17..dd3a2352 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -7648,18 +7648,10 @@ rec { name = "openssl"; packageId = "openssl"; } - { - name = "pin-project"; - packageId = "pin-project"; - } { name = "product-config"; packageId = "product-config"; } - { - name = "semver"; - packageId = "semver"; - } { name = "serde"; packageId = "serde"; diff --git a/Cargo.toml b/Cargo.toml index 198bca1d..efa6ca82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,9 +18,7 @@ const_format = "0.2" futures = { version = "0.3", features = ["compat"] } indoc = "2.0" openssl = "0.10" -pin-project = "1.1" rstest = "0.24" -semver = "1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_yaml = "0.9" diff --git a/rust/operator-binary/Cargo.toml b/rust/operator-binary/Cargo.toml index bf0e0459..04755f11 100644 --- a/rust/operator-binary/Cargo.toml +++ b/rust/operator-binary/Cargo.toml @@ -18,9 +18,7 @@ const_format.workspace = true futures.workspace = true indoc.workspace = true openssl.workspace = true -pin-project.workspace = true product-config.workspace = true -semver.workspace = true snafu.workspace = true stackable-operator.workspace = true strum.workspace = true From ff6abf83ef538e9304875d5152e07f11c97ff0ab Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Mon, 24 Feb 2025 11:44:58 +0100 Subject: [PATCH 3/9] chore: add stackable-versioned dependency --- Cargo.lock | 300 +++++++- Cargo.nix | 1151 ++++++++++++++++++++++++++++--- Cargo.toml | 1 + crate-hashes.json | 3 + rust/operator-binary/Cargo.toml | 1 + 5 files changed, 1348 insertions(+), 108 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a3598200..b9798d40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -220,6 +220,12 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.8.0" @@ -368,6 +374,15 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -624,6 +639,15 @@ dependencies = [ "regex-syntax 0.8.5", ] +[[package]] +name = "fluent-uri" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17c704e9dbe1ddd863da1e6ff3567795087b1eb201ce80d8fa81162e1516500d" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "fnv" version = "1.0.7" @@ -795,7 +819,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ - "bitflags", + "bitflags 2.8.0", "libc", "libgit2-sys", "log", @@ -808,6 +832,16 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] + [[package]] name = "hashbrown" version = "0.15.2" @@ -1186,7 +1220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.2", ] [[package]] @@ -1216,6 +1250,15 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.14" @@ -1252,18 +1295,45 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json-patch" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b1fb8864823fad91877e6caea0baca82e49e8db50f8e5c9f9a453e27d3330fc" +dependencies = [ + "jsonptr 0.4.7", + "serde", + "serde_json", + "thiserror 1.0.69", +] + [[package]] name = "json-patch" version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08" dependencies = [ - "jsonptr", + "jsonptr 0.6.3", "serde", "serde_json", "thiserror 1.0.69", ] +[[package]] +name = "jsonpath-rust" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d8fe85bd70ff715f31ce8c739194b423d79811a19602115d611a3ec85d6200" +dependencies = [ + "lazy_static", + "once_cell", + "pest", + "pest_derive", + "regex", + "serde_json", + "thiserror 1.0.69", +] + [[package]] name = "jsonpath-rust" version = "0.7.5" @@ -1277,6 +1347,17 @@ dependencies = [ "thiserror 2.0.11", ] +[[package]] +name = "jsonptr" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c6e529149475ca0b2820835d3dce8fcc41c6b943ca608d32f35b449255e4627" +dependencies = [ + "fluent-uri", + "serde", + "serde_json", +] + [[package]] name = "jsonptr" version = "0.6.3" @@ -1287,6 +1368,20 @@ dependencies = [ "serde_json", ] +[[package]] +name = "k8s-openapi" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8847402328d8301354c94d605481f25a6bdc1ed65471fd96af8eca71141b13" +dependencies = [ + "base64 0.22.1", + "chrono", + "schemars", + "serde", + "serde-value", + "serde_json", +] + [[package]] name = "k8s-openapi" version = "0.24.0" @@ -1301,17 +1396,78 @@ dependencies = [ "serde_json", ] +[[package]] +name = "k8s-version" +version = "0.1.2" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-versioned-0.5.0#048c7d8befddc2f2c6414444006871c95412d67c" +dependencies = [ + "darling", + "regex", + "snafu 0.8.5", +] + +[[package]] +name = "kube" +version = "0.96.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efffeb3df0bd4ef3e5d65044573499c0e4889b988070b08c50b25b1329289a1f" +dependencies = [ + "k8s-openapi 0.23.0", + "kube-client 0.96.0", + "kube-core 0.96.0", + "kube-derive 0.96.0", + "kube-runtime 0.96.0", +] + [[package]] name = "kube" version = "0.98.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32053dc495efad4d188c7b33cc7c02ef4a6e43038115348348876efd39a53cba" dependencies = [ - "k8s-openapi", - "kube-client", - "kube-core", - "kube-derive", - "kube-runtime", + "k8s-openapi 0.24.0", + "kube-client 0.98.0", + "kube-core 0.98.0", + "kube-derive 0.98.0", + "kube-runtime 0.98.0", +] + +[[package]] +name = "kube-client" +version = "0.96.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf471ece8ff8d24735ce78dac4d091e9fcb8d74811aeb6b75de4d1c3f5de0f1" +dependencies = [ + "base64 0.22.1", + "bytes", + "chrono", + "either", + "futures 0.3.31", + "home", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-http-proxy", + "hyper-rustls", + "hyper-timeout", + "hyper-util", + "jsonpath-rust 0.5.1", + "k8s-openapi 0.23.0", + "kube-core 0.96.0", + "pem", + "rustls", + "rustls-pemfile", + "secrecy", + "serde", + "serde_json", + "serde_yaml", + "thiserror 1.0.69", + "tokio", + "tokio-util", + "tower", + "tower-http", + "tracing", ] [[package]] @@ -1334,9 +1490,9 @@ dependencies = [ "hyper-rustls", "hyper-timeout", "hyper-util", - "jsonpath-rust", - "k8s-openapi", - "kube-core", + "jsonpath-rust 0.7.5", + "k8s-openapi 0.24.0", + "kube-core 0.98.0", "pem", "rustls", "rustls-pemfile", @@ -1352,6 +1508,24 @@ dependencies = [ "tracing", ] +[[package]] +name = "kube-core" +version = "0.96.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f42346d30bb34d1d7adc5c549b691bce7aa3a1e60254e68fab7e2d7b26fe3d77" +dependencies = [ + "chrono", + "form_urlencoded", + "http", + "json-patch 2.0.0", + "k8s-openapi 0.23.0", + "schemars", + "serde", + "serde-value", + "serde_json", + "thiserror 1.0.69", +] + [[package]] name = "kube-core" version = "0.98.0" @@ -1361,8 +1535,8 @@ dependencies = [ "chrono", "form_urlencoded", "http", - "json-patch", - "k8s-openapi", + "json-patch 3.0.1", + "k8s-openapi 0.24.0", "schemars", "serde", "serde-value", @@ -1370,6 +1544,19 @@ dependencies = [ "thiserror 2.0.11", ] +[[package]] +name = "kube-derive" +version = "0.96.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9364e04cc5e0482136c6ee8b7fb7551812da25802249f35b3def7aaa31e82ad" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.96", +] + [[package]] name = "kube-derive" version = "0.98.0" @@ -1383,6 +1570,34 @@ dependencies = [ "syn 2.0.96", ] +[[package]] +name = "kube-runtime" +version = "0.96.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fbf1f6ffa98e65f1d2a9a69338bb60605d46be7edf00237784b89e62c9bd44" +dependencies = [ + "ahash", + "async-broadcast", + "async-stream", + "async-trait", + "backoff", + "educe", + "futures 0.3.31", + "hashbrown 0.14.5", + "json-patch 2.0.0", + "jsonptr 0.4.7", + "k8s-openapi 0.23.0", + "kube-client 0.96.0", + "parking_lot", + "pin-project", + "serde", + "serde_json", + "thiserror 1.0.69", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "kube-runtime" version = "0.98.0" @@ -1396,12 +1611,12 @@ dependencies = [ "backoff", "educe", "futures 0.3.31", - "hashbrown", + "hashbrown 0.15.2", "hostname", - "json-patch", - "jsonptr", - "k8s-openapi", - "kube-client", + "json-patch 3.0.1", + "jsonptr 0.6.3", + "k8s-openapi 0.24.0", + "kube-client 0.98.0", "parking_lot", "pin-project", "serde", @@ -1567,7 +1782,7 @@ version = "0.10.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6" dependencies = [ - "bitflags", + "bitflags 2.8.0", "cfg-if", "foreign-types", "libc", @@ -1909,7 +2124,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags", + "bitflags 2.8.0", ] [[package]] @@ -2155,7 +2370,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags", + "bitflags 2.8.0", "core-foundation 0.9.4", "core-foundation-sys", "libc", @@ -2168,7 +2383,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" dependencies = [ - "bitflags", + "bitflags 2.8.0", "core-foundation 0.10.0", "core-foundation-sys", "libc", @@ -2396,9 +2611,9 @@ dependencies = [ "either", "futures 0.3.31", "indexmap", - "json-patch", - "k8s-openapi", - "kube", + "json-patch 3.0.1", + "k8s-openapi 0.24.0", + "kube 0.98.0", "opentelemetry-jaeger", "opentelemetry_sdk", "product-config", @@ -2436,7 +2651,7 @@ name = "stackable-shared" version = "0.0.1" source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.85.0#59506c6202778889a27b6ae8153457e60a49c68d" dependencies = [ - "kube", + "kube 0.98.0", "semver", "serde", "serde_yaml", @@ -2462,11 +2677,36 @@ dependencies = [ "serde_yaml", "snafu 0.8.5", "stackable-operator", + "stackable-versioned", "strum", "tokio", "tracing", ] +[[package]] +name = "stackable-versioned" +version = "0.5.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-versioned-0.5.0#048c7d8befddc2f2c6414444006871c95412d67c" +dependencies = [ + "stackable-versioned-macros", +] + +[[package]] +name = "stackable-versioned-macros" +version = "0.5.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-versioned-0.5.0#048c7d8befddc2f2c6414444006871c95412d67c" +dependencies = [ + "convert_case", + "darling", + "itertools", + "k8s-openapi 0.23.0", + "k8s-version", + "kube 0.96.0", + "proc-macro2", + "quote", + "syn 2.0.96", +] + [[package]] name = "strsim" version = "0.11.1" @@ -2758,7 +2998,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" dependencies = [ "base64 0.22.1", - "bitflags", + "bitflags 2.8.0", "bytes", "http", "http-body", @@ -2910,6 +3150,12 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11cd88e12b17c6494200a9c1b683a04fcac9573ed74cd1b62aeb2727c5592243" +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + [[package]] name = "unicode-xid" version = "0.2.6" diff --git a/Cargo.nix b/Cargo.nix index dd3a2352..09062dc5 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -657,7 +657,22 @@ rec { }; resolvedDefaultFeatures = [ "std" ]; }; - "bitflags" = rec { + "bitflags 1.3.2" = rec { + crateName = "bitflags"; + version = "1.3.2"; + edition = "2018"; + sha256 = "12ki6w8gn1ldq7yz9y680llwk5gmrhrzszaa17g1sbrw2r2qvwxy"; + authors = [ + "The Rust Project Developers" + ]; + features = { + "compiler_builtins" = [ "dep:compiler_builtins" ]; + "core" = [ "dep:core" ]; + "rustc-dep-of-std" = [ "core" "compiler_builtins" ]; + }; + resolvedDefaultFeatures = [ "default" ]; + }; + "bitflags 2.8.0" = rec { crateName = "bitflags"; version = "2.8.0"; edition = "2021"; @@ -1088,6 +1103,25 @@ rec { }; resolvedDefaultFeatures = [ "default" ]; }; + "convert_case" = rec { + crateName = "convert_case"; + version = "0.6.0"; + edition = "2018"; + sha256 = "1jn1pq6fp3rri88zyw6jlhwwgf6qiyc08d6gjv0qypgkl862n67c"; + authors = [ + "Rutrum " + ]; + dependencies = [ + { + name = "unicode-segmentation"; + packageId = "unicode-segmentation"; + } + ]; + features = { + "rand" = [ "dep:rand" ]; + "random" = [ "rand" ]; + }; + }; "core-foundation 0.10.0" = rec { crateName = "core-foundation"; version = "0.10.0"; @@ -1769,6 +1803,26 @@ rec { }; resolvedDefaultFeatures = [ "default" "perf" "std" "unicode" ]; }; + "fluent-uri" = rec { + crateName = "fluent-uri"; + version = "0.1.4"; + edition = "2021"; + sha256 = "03ah2qajw5l1zbc81kh1n8g7n24mfxbg6vqyv9ixipg1vglh9iqp"; + libName = "fluent_uri"; + authors = [ + "Scallop Ye " + ]; + dependencies = [ + { + name = "bitflags"; + packageId = "bitflags 1.3.2"; + } + ]; + features = { + "default" = [ "std" ]; + }; + resolvedDefaultFeatures = [ "std" ]; + }; "fnv" = rec { crateName = "fnv"; version = "1.0.7"; @@ -2250,7 +2304,7 @@ rec { dependencies = [ { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } { name = "libc"; @@ -2291,7 +2345,46 @@ rec { ]; }; - "hashbrown" = rec { + "hashbrown 0.14.5" = rec { + crateName = "hashbrown"; + version = "0.14.5"; + edition = "2021"; + sha256 = "1wa1vy1xs3mp11bn3z9dv0jricgr6a2j0zkf1g19yz3vw4il89z5"; + authors = [ + "Amanieu d'Antras " + ]; + dependencies = [ + { + name = "ahash"; + packageId = "ahash"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "allocator-api2"; + packageId = "allocator-api2"; + optional = true; + usesDefaultFeatures = false; + features = [ "alloc" ]; + } + ]; + features = { + "ahash" = [ "dep:ahash" ]; + "alloc" = [ "dep:alloc" ]; + "allocator-api2" = [ "dep:allocator-api2" ]; + "compiler_builtins" = [ "dep:compiler_builtins" ]; + "core" = [ "dep:core" ]; + "default" = [ "ahash" "inline-more" "allocator-api2" ]; + "equivalent" = [ "dep:equivalent" ]; + "nightly" = [ "allocator-api2?/nightly" "bumpalo/allocator_api" ]; + "rayon" = [ "dep:rayon" ]; + "rkyv" = [ "dep:rkyv" ]; + "rustc-dep-of-std" = [ "nightly" "core" "compiler_builtins" "alloc" "rustc-internal-api" ]; + "serde" = [ "dep:serde" ]; + }; + resolvedDefaultFeatures = [ "ahash" "allocator-api2" "default" "inline-more" ]; + }; + "hashbrown 0.15.2" = rec { crateName = "hashbrown"; version = "0.15.2"; edition = "2021"; @@ -3561,7 +3654,7 @@ rec { } { name = "hashbrown"; - packageId = "hashbrown"; + packageId = "hashbrown 0.15.2"; usesDefaultFeatures = false; } ]; @@ -3635,6 +3728,27 @@ rec { }; resolvedDefaultFeatures = [ "default" ]; }; + "itertools" = rec { + crateName = "itertools"; + version = "0.13.0"; + edition = "2018"; + sha256 = "11hiy3qzl643zcigknclh446qb9zlg4dpdzfkjaa9q9fqpgyfgj1"; + authors = [ + "bluss" + ]; + dependencies = [ + { + name = "either"; + packageId = "either"; + usesDefaultFeatures = false; + } + ]; + features = { + "default" = [ "use_std" ]; + "use_std" = [ "use_alloc" "either/use_std" ]; + }; + resolvedDefaultFeatures = [ "default" "use_alloc" "use_std" ]; + }; "itoa" = rec { crateName = "itoa"; version = "1.0.14"; @@ -3716,7 +3830,48 @@ rec { }; resolvedDefaultFeatures = [ "default" "std" ]; }; - "json-patch" = rec { + "json-patch 2.0.0" = rec { + crateName = "json-patch"; + version = "2.0.0"; + edition = "2021"; + sha256 = "1z1h6dyy4lx4z74yby2hvgl4jbm8mh5ymjp6fwcdkyi3923bh7sv"; + libName = "json_patch"; + authors = [ + "Ivan Dubrov " + ]; + dependencies = [ + { + name = "jsonptr"; + packageId = "jsonptr 0.4.7"; + } + { + name = "serde"; + packageId = "serde"; + features = [ "derive" ]; + } + { + name = "serde_json"; + packageId = "serde_json"; + } + { + name = "thiserror"; + packageId = "thiserror 1.0.69"; + } + ]; + devDependencies = [ + { + name = "serde_json"; + packageId = "serde_json"; + features = [ "preserve_order" ]; + } + ]; + features = { + "default" = [ "diff" ]; + "utoipa" = [ "dep:utoipa" ]; + }; + resolvedDefaultFeatures = [ "default" "diff" ]; + }; + "json-patch 3.0.1" = rec { crateName = "json-patch"; version = "3.0.1"; edition = "2021"; @@ -3728,7 +3883,7 @@ rec { dependencies = [ { name = "jsonptr"; - packageId = "jsonptr"; + packageId = "jsonptr 0.6.3"; } { name = "serde"; @@ -3757,7 +3912,48 @@ rec { }; resolvedDefaultFeatures = [ "default" "diff" ]; }; - "jsonpath-rust" = rec { + "jsonpath-rust 0.5.1" = rec { + crateName = "jsonpath-rust"; + version = "0.5.1"; + edition = "2018"; + sha256 = "0032bp43w6k1bl8h55m126cdf8xljj8p736f65gp3zvhpn2zxn0r"; + libName = "jsonpath_rust"; + authors = [ + "BorisZhguchev " + ]; + dependencies = [ + { + name = "lazy_static"; + packageId = "lazy_static"; + } + { + name = "once_cell"; + packageId = "once_cell"; + } + { + name = "pest"; + packageId = "pest"; + } + { + name = "pest_derive"; + packageId = "pest_derive"; + } + { + name = "regex"; + packageId = "regex"; + } + { + name = "serde_json"; + packageId = "serde_json"; + } + { + name = "thiserror"; + packageId = "thiserror 1.0.69"; + } + ]; + + }; + "jsonpath-rust 0.7.5" = rec { crateName = "jsonpath-rust"; version = "0.7.5"; edition = "2021"; @@ -3790,7 +3986,44 @@ rec { ]; }; - "jsonptr" = rec { + "jsonptr 0.4.7" = rec { + crateName = "jsonptr"; + version = "0.4.7"; + edition = "2021"; + sha256 = "09s6bqjlkd1m5z9hi9iwjimiri7wx3fd6d88hara0p27968m4vhw"; + authors = [ + "chance dinkins" + ]; + dependencies = [ + { + name = "fluent-uri"; + packageId = "fluent-uri"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "serde"; + packageId = "serde"; + usesDefaultFeatures = false; + features = [ "alloc" ]; + } + { + name = "serde_json"; + packageId = "serde_json"; + usesDefaultFeatures = false; + features = [ "alloc" ]; + } + ]; + features = { + "default" = [ "std" ]; + "fluent-uri" = [ "dep:fluent-uri" ]; + "std" = [ "serde/std" "serde_json/std" "fluent-uri?/std" ]; + "uniresid" = [ "dep:uniresid" ]; + "url" = [ "dep:url" ]; + }; + resolvedDefaultFeatures = [ "default" "std" ]; + }; + "jsonptr 0.6.3" = rec { crateName = "jsonptr"; version = "0.6.3"; edition = "2021"; @@ -3824,12 +4057,12 @@ rec { }; resolvedDefaultFeatures = [ "assign" "default" "delete" "json" "resolve" "serde" "std" ]; }; - "k8s-openapi" = rec { + "k8s-openapi 0.23.0" = rec { crateName = "k8s-openapi"; - version = "0.24.0"; + version = "0.23.0"; edition = "2021"; - links = "k8s-openapi-0.24.0"; - sha256 = "1m8ahw59g44kp9p4yd4ar0px15m2nyvhc5krbvqvw2ag6a8bjx9c"; + links = "k8s-openapi-0.23.0"; + sha256 = "04qv2iqwm3mgjvyp2m6n3vf6nnpjh5a60kf9ah9k1n184d04g24w"; libName = "k8s_openapi"; authors = [ "Arnav Singh " @@ -3871,72 +4104,159 @@ rec { } ]; features = { - "earliest" = [ "v1_28" ]; - "latest" = [ "v1_32" ]; + "earliest" = [ "v1_26" ]; + "latest" = [ "v1_31" ]; "schemars" = [ "dep:schemars" ]; }; - resolvedDefaultFeatures = [ "schemars" "v1_32" ]; + resolvedDefaultFeatures = [ "schemars" "v1_31" ]; }; - "kube" = rec { - crateName = "kube"; - version = "0.98.0"; + "k8s-openapi 0.24.0" = rec { + crateName = "k8s-openapi"; + version = "0.24.0"; edition = "2021"; - sha256 = "1fiwllwzsvl7921k85c10d1nwjpg09ycqcvvihc4vbggjp23s19j"; + links = "k8s-openapi-0.24.0"; + sha256 = "1m8ahw59g44kp9p4yd4ar0px15m2nyvhc5krbvqvw2ag6a8bjx9c"; + libName = "k8s_openapi"; authors = [ - "clux " - "Natalie Klestrup Röijezon " - "kazk " + "Arnav Singh " ]; dependencies = [ { - name = "k8s-openapi"; - packageId = "k8s-openapi"; + name = "base64"; + packageId = "base64 0.22.1"; usesDefaultFeatures = false; + features = [ "alloc" ]; } { - name = "kube-client"; - packageId = "kube-client"; - optional = true; + name = "chrono"; + packageId = "chrono"; usesDefaultFeatures = false; + features = [ "alloc" "serde" ]; } { - name = "kube-core"; - packageId = "kube-core"; + name = "schemars"; + packageId = "schemars"; + optional = true; + usesDefaultFeatures = false; } { - name = "kube-derive"; - packageId = "kube-derive"; - optional = true; + name = "serde"; + packageId = "serde"; + usesDefaultFeatures = false; } { - name = "kube-runtime"; - packageId = "kube-runtime"; - optional = true; + name = "serde-value"; + packageId = "serde-value"; + usesDefaultFeatures = false; } - ]; - devDependencies = [ { - name = "k8s-openapi"; - packageId = "k8s-openapi"; + name = "serde_json"; + packageId = "serde_json"; usesDefaultFeatures = false; - features = [ "latest" ]; + features = [ "alloc" ]; } ]; features = { - "admission" = [ "kube-core/admission" ]; - "aws-lc-rs" = [ "kube-client?/aws-lc-rs" ]; - "client" = [ "kube-client/client" "config" ]; - "config" = [ "kube-client/config" ]; - "default" = [ "client" "rustls-tls" ]; - "derive" = [ "kube-derive" "kube-core/schema" ]; - "gzip" = [ "kube-client/gzip" "client" ]; - "http-proxy" = [ "kube-client/http-proxy" "client" ]; - "jsonpatch" = [ "kube-core/jsonpatch" ]; - "kube-client" = [ "dep:kube-client" ]; - "kube-derive" = [ "dep:kube-derive" ]; - "kube-runtime" = [ "dep:kube-runtime" ]; - "kubelet-debug" = [ "kube-client/kubelet-debug" "kube-core/kubelet-debug" ]; - "oauth" = [ "kube-client/oauth" "client" ]; + "earliest" = [ "v1_28" ]; + "latest" = [ "v1_32" ]; + "schemars" = [ "dep:schemars" ]; + }; + resolvedDefaultFeatures = [ "schemars" "v1_32" ]; + }; + "k8s-version" = rec { + crateName = "k8s-version"; + version = "0.1.2"; + edition = "2021"; + workspace_member = null; + src = pkgs.fetchgit { + url = "https://github.com/stackabletech/operator-rs.git"; + rev = "048c7d8befddc2f2c6414444006871c95412d67c"; + sha256 = "1x2pfibrsysmkkmajyj30qkwsjf3rzmc3dxsd09jb9r4x7va6mr6"; + }; + libName = "k8s_version"; + authors = [ + "Stackable GmbH " + ]; + dependencies = [ + { + name = "darling"; + packageId = "darling"; + optional = true; + } + { + name = "regex"; + packageId = "regex"; + } + { + name = "snafu"; + packageId = "snafu 0.8.5"; + } + ]; + features = { + "darling" = [ "dep:darling" ]; + }; + resolvedDefaultFeatures = [ "darling" ]; + }; + "kube 0.96.0" = rec { + crateName = "kube"; + version = "0.96.0"; + edition = "2021"; + sha256 = "07ws50li6nxja26b0w40k2dqir60k4s5fi2hsvjz6kmxy0yypzzg"; + authors = [ + "clux " + "Natalie Klestrup Röijezon " + "kazk " + ]; + dependencies = [ + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + } + { + name = "kube-client"; + packageId = "kube-client 0.96.0"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "kube-core"; + packageId = "kube-core 0.96.0"; + } + { + name = "kube-derive"; + packageId = "kube-derive 0.96.0"; + optional = true; + } + { + name = "kube-runtime"; + packageId = "kube-runtime 0.96.0"; + optional = true; + } + ]; + devDependencies = [ + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + features = [ "latest" ]; + } + ]; + features = { + "admission" = [ "kube-core/admission" ]; + "aws-lc-rs" = [ "kube-client?/aws-lc-rs" ]; + "client" = [ "kube-client/client" "config" ]; + "config" = [ "kube-client/config" ]; + "default" = [ "client" "rustls-tls" ]; + "derive" = [ "kube-derive" "kube-core/schema" ]; + "gzip" = [ "kube-client/gzip" "client" ]; + "http-proxy" = [ "kube-client/http-proxy" "client" ]; + "jsonpatch" = [ "kube-core/jsonpatch" ]; + "kube-client" = [ "dep:kube-client" ]; + "kube-derive" = [ "dep:kube-derive" ]; + "kube-runtime" = [ "dep:kube-runtime" ]; + "kubelet-debug" = [ "kube-client/kubelet-debug" "kube-core/kubelet-debug" ]; + "oauth" = [ "kube-client/oauth" "client" ]; "oidc" = [ "kube-client/oidc" "client" ]; "openssl-tls" = [ "kube-client/openssl-tls" "client" ]; "runtime" = [ "kube-runtime" ]; @@ -3949,7 +4269,321 @@ rec { }; resolvedDefaultFeatures = [ "client" "config" "derive" "jsonpatch" "kube-client" "kube-derive" "kube-runtime" "runtime" "rustls-tls" ]; }; - "kube-client" = rec { + "kube 0.98.0" = rec { + crateName = "kube"; + version = "0.98.0"; + edition = "2021"; + sha256 = "1fiwllwzsvl7921k85c10d1nwjpg09ycqcvvihc4vbggjp23s19j"; + authors = [ + "clux " + "Natalie Klestrup Röijezon " + "kazk " + ]; + dependencies = [ + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; + usesDefaultFeatures = false; + } + { + name = "kube-client"; + packageId = "kube-client 0.98.0"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "kube-core"; + packageId = "kube-core 0.98.0"; + } + { + name = "kube-derive"; + packageId = "kube-derive 0.98.0"; + optional = true; + } + { + name = "kube-runtime"; + packageId = "kube-runtime 0.98.0"; + optional = true; + } + ]; + devDependencies = [ + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; + usesDefaultFeatures = false; + features = [ "latest" ]; + } + ]; + features = { + "admission" = [ "kube-core/admission" ]; + "aws-lc-rs" = [ "kube-client?/aws-lc-rs" ]; + "client" = [ "kube-client/client" "config" ]; + "config" = [ "kube-client/config" ]; + "default" = [ "client" "rustls-tls" ]; + "derive" = [ "kube-derive" "kube-core/schema" ]; + "gzip" = [ "kube-client/gzip" "client" ]; + "http-proxy" = [ "kube-client/http-proxy" "client" ]; + "jsonpatch" = [ "kube-core/jsonpatch" ]; + "kube-client" = [ "dep:kube-client" ]; + "kube-derive" = [ "dep:kube-derive" ]; + "kube-runtime" = [ "dep:kube-runtime" ]; + "kubelet-debug" = [ "kube-client/kubelet-debug" "kube-core/kubelet-debug" ]; + "oauth" = [ "kube-client/oauth" "client" ]; + "oidc" = [ "kube-client/oidc" "client" ]; + "openssl-tls" = [ "kube-client/openssl-tls" "client" ]; + "runtime" = [ "kube-runtime" ]; + "rustls-tls" = [ "kube-client/rustls-tls" "client" ]; + "socks5" = [ "kube-client/socks5" "client" ]; + "unstable-client" = [ "kube-client/unstable-client" "client" ]; + "unstable-runtime" = [ "kube-runtime/unstable-runtime" "runtime" ]; + "webpki-roots" = [ "kube-client/webpki-roots" "client" ]; + "ws" = [ "kube-client/ws" "kube-core/ws" ]; + }; + resolvedDefaultFeatures = [ "client" "config" "derive" "jsonpatch" "kube-client" "kube-derive" "kube-runtime" "runtime" "rustls-tls" ]; + }; + "kube-client 0.96.0" = rec { + crateName = "kube-client"; + version = "0.96.0"; + edition = "2021"; + sha256 = "1wg0blziqkfyfmmyn6l1fj6wp7qy156sr3g7birj93gzx3n73x4b"; + libName = "kube_client"; + authors = [ + "clux " + "Natalie Klestrup Röijezon " + "kazk " + ]; + dependencies = [ + { + name = "base64"; + packageId = "base64 0.22.1"; + optional = true; + } + { + name = "bytes"; + packageId = "bytes"; + optional = true; + } + { + name = "chrono"; + packageId = "chrono"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "either"; + packageId = "either"; + optional = true; + } + { + name = "futures"; + packageId = "futures 0.3.31"; + optional = true; + usesDefaultFeatures = false; + features = [ "std" ]; + } + { + name = "home"; + packageId = "home"; + optional = true; + } + { + name = "http"; + packageId = "http"; + } + { + name = "http-body"; + packageId = "http-body"; + optional = true; + } + { + name = "http-body-util"; + packageId = "http-body-util"; + optional = true; + } + { + name = "hyper"; + packageId = "hyper"; + optional = true; + features = [ "client" "http1" ]; + } + { + name = "hyper-http-proxy"; + packageId = "hyper-http-proxy"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "hyper-rustls"; + packageId = "hyper-rustls"; + optional = true; + usesDefaultFeatures = false; + features = [ "http1" "logging" "native-tokio" "ring" "tls12" ]; + } + { + name = "hyper-timeout"; + packageId = "hyper-timeout"; + optional = true; + } + { + name = "hyper-util"; + packageId = "hyper-util"; + optional = true; + features = [ "client" "client-legacy" "http1" "tokio" ]; + } + { + name = "jsonpath-rust"; + packageId = "jsonpath-rust 0.5.1"; + optional = true; + } + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + } + { + name = "kube-core"; + packageId = "kube-core 0.96.0"; + } + { + name = "pem"; + packageId = "pem"; + optional = true; + } + { + name = "rustls"; + packageId = "rustls"; + optional = true; + usesDefaultFeatures = false; + } + { + name = "rustls-pemfile"; + packageId = "rustls-pemfile"; + optional = true; + } + { + name = "secrecy"; + packageId = "secrecy"; + } + { + name = "serde"; + packageId = "serde"; + features = [ "derive" ]; + } + { + name = "serde_json"; + packageId = "serde_json"; + } + { + name = "serde_yaml"; + packageId = "serde_yaml"; + optional = true; + } + { + name = "thiserror"; + packageId = "thiserror 1.0.69"; + } + { + name = "tokio"; + packageId = "tokio"; + optional = true; + features = [ "time" "signal" "sync" ]; + } + { + name = "tokio-util"; + packageId = "tokio-util"; + optional = true; + features = [ "io" "codec" ]; + } + { + name = "tower"; + packageId = "tower"; + optional = true; + features = [ "buffer" "filter" "util" ]; + } + { + name = "tower-http"; + packageId = "tower-http"; + optional = true; + features = [ "auth" "map-response-body" "trace" ]; + } + { + name = "tracing"; + packageId = "tracing"; + optional = true; + features = [ "log" ]; + } + ]; + devDependencies = [ + { + name = "futures"; + packageId = "futures 0.3.31"; + usesDefaultFeatures = false; + features = [ "async-await" ]; + } + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + features = [ "latest" ]; + } + { + name = "tokio"; + packageId = "tokio"; + features = [ "full" ]; + } + ]; + features = { + "__non_core" = [ "tracing" "serde_yaml" "base64" ]; + "admission" = [ "kube-core/admission" ]; + "aws-lc-rs" = [ "rustls?/aws-lc-rs" ]; + "base64" = [ "dep:base64" ]; + "bytes" = [ "dep:bytes" ]; + "chrono" = [ "dep:chrono" ]; + "client" = [ "config" "__non_core" "hyper" "hyper-util" "http-body" "http-body-util" "tower" "tower-http" "hyper-timeout" "chrono" "jsonpath-rust" "bytes" "futures" "tokio" "tokio-util" "either" ]; + "config" = [ "__non_core" "pem" "home" ]; + "default" = [ "client" ]; + "either" = [ "dep:either" ]; + "form_urlencoded" = [ "dep:form_urlencoded" ]; + "futures" = [ "dep:futures" ]; + "gzip" = [ "client" "tower-http/decompression-gzip" ]; + "home" = [ "dep:home" ]; + "http-body" = [ "dep:http-body" ]; + "http-body-util" = [ "dep:http-body-util" ]; + "http-proxy" = [ "hyper-http-proxy" ]; + "hyper" = [ "dep:hyper" ]; + "hyper-http-proxy" = [ "dep:hyper-http-proxy" ]; + "hyper-openssl" = [ "dep:hyper-openssl" ]; + "hyper-rustls" = [ "dep:hyper-rustls" ]; + "hyper-socks2" = [ "dep:hyper-socks2" ]; + "hyper-timeout" = [ "dep:hyper-timeout" ]; + "hyper-util" = [ "dep:hyper-util" ]; + "jsonpatch" = [ "kube-core/jsonpatch" ]; + "jsonpath-rust" = [ "dep:jsonpath-rust" ]; + "kubelet-debug" = [ "ws" "kube-core/kubelet-debug" ]; + "oauth" = [ "client" "tame-oauth" ]; + "oidc" = [ "client" "form_urlencoded" ]; + "openssl" = [ "dep:openssl" ]; + "openssl-tls" = [ "openssl" "hyper-openssl" ]; + "pem" = [ "dep:pem" ]; + "rand" = [ "dep:rand" ]; + "rustls" = [ "dep:rustls" ]; + "rustls-pemfile" = [ "dep:rustls-pemfile" ]; + "rustls-tls" = [ "rustls" "rustls-pemfile" "hyper-rustls" "hyper-http-proxy?/rustls-tls-native-roots" ]; + "serde_yaml" = [ "dep:serde_yaml" ]; + "socks5" = [ "hyper-socks2" ]; + "tame-oauth" = [ "dep:tame-oauth" ]; + "tokio" = [ "dep:tokio" ]; + "tokio-tungstenite" = [ "dep:tokio-tungstenite" ]; + "tokio-util" = [ "dep:tokio-util" ]; + "tower" = [ "dep:tower" ]; + "tower-http" = [ "dep:tower-http" ]; + "tracing" = [ "dep:tracing" ]; + "webpki-roots" = [ "hyper-rustls/webpki-roots" ]; + "ws" = [ "client" "tokio-tungstenite" "rand" "kube-core/ws" "tokio/macros" ]; + }; + resolvedDefaultFeatures = [ "__non_core" "base64" "bytes" "chrono" "client" "config" "either" "futures" "home" "http-body" "http-body-util" "hyper" "hyper-rustls" "hyper-timeout" "hyper-util" "jsonpatch" "jsonpath-rust" "pem" "rustls" "rustls-pemfile" "rustls-tls" "serde_yaml" "tokio" "tokio-util" "tower" "tower-http" "tracing" ]; + }; + "kube-client 0.98.0" = rec { crateName = "kube-client"; version = "0.98.0"; edition = "2021"; @@ -4040,17 +4674,17 @@ rec { } { name = "jsonpath-rust"; - packageId = "jsonpath-rust"; + packageId = "jsonpath-rust 0.7.5"; optional = true; } { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; usesDefaultFeatures = false; } { name = "kube-core"; - packageId = "kube-core"; + packageId = "kube-core 0.98.0"; } { name = "pem"; @@ -4135,7 +4769,7 @@ rec { } { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; usesDefaultFeatures = false; features = [ "latest" ]; } @@ -4194,9 +4828,86 @@ rec { "webpki-roots" = [ "hyper-rustls/webpki-roots" ]; "ws" = [ "client" "tokio-tungstenite" "rand" "kube-core/ws" "tokio/macros" ]; }; - resolvedDefaultFeatures = [ "__non_core" "base64" "bytes" "chrono" "client" "config" "either" "futures" "home" "http-body" "http-body-util" "hyper" "hyper-rustls" "hyper-timeout" "hyper-util" "jsonpatch" "jsonpath-rust" "pem" "rustls" "rustls-pemfile" "rustls-tls" "serde_yaml" "tokio" "tokio-util" "tower" "tower-http" "tracing" ]; + resolvedDefaultFeatures = [ "__non_core" "base64" "bytes" "chrono" "client" "config" "either" "futures" "home" "http-body" "http-body-util" "hyper" "hyper-rustls" "hyper-timeout" "hyper-util" "jsonpatch" "jsonpath-rust" "pem" "rustls" "rustls-pemfile" "rustls-tls" "serde_yaml" "tokio" "tokio-util" "tower" "tower-http" "tracing" ]; + }; + "kube-core 0.96.0" = rec { + crateName = "kube-core"; + version = "0.96.0"; + edition = "2021"; + sha256 = "0xrxzqk7nbbymf7ycm02wshs6ynf3dlrnm2wvix1skdk1g9lc8zl"; + libName = "kube_core"; + authors = [ + "clux " + "Natalie Klestrup Röijezon " + "kazk " + ]; + dependencies = [ + { + name = "chrono"; + packageId = "chrono"; + usesDefaultFeatures = false; + features = [ "now" ]; + } + { + name = "form_urlencoded"; + packageId = "form_urlencoded"; + } + { + name = "http"; + packageId = "http"; + } + { + name = "json-patch"; + packageId = "json-patch 2.0.0"; + optional = true; + } + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + } + { + name = "schemars"; + packageId = "schemars"; + optional = true; + } + { + name = "serde"; + packageId = "serde"; + features = [ "derive" ]; + } + { + name = "serde-value"; + packageId = "serde-value"; + } + { + name = "serde_json"; + packageId = "serde_json"; + } + { + name = "thiserror"; + packageId = "thiserror 1.0.69"; + } + ]; + devDependencies = [ + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + features = [ "latest" ]; + } + ]; + features = { + "admission" = [ "json-patch" ]; + "json-patch" = [ "dep:json-patch" ]; + "jsonpatch" = [ "json-patch" ]; + "kubelet-debug" = [ "ws" ]; + "schema" = [ "schemars" ]; + "schemars" = [ "dep:schemars" ]; + }; + resolvedDefaultFeatures = [ "json-patch" "jsonpatch" "schema" "schemars" ]; }; - "kube-core" = rec { + "kube-core 0.98.0" = rec { crateName = "kube-core"; version = "0.98.0"; edition = "2021"; @@ -4224,12 +4935,12 @@ rec { } { name = "json-patch"; - packageId = "json-patch"; + packageId = "json-patch 3.0.1"; optional = true; } { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; usesDefaultFeatures = false; } { @@ -4258,7 +4969,7 @@ rec { devDependencies = [ { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; usesDefaultFeatures = false; features = [ "latest" ]; } @@ -4273,7 +4984,44 @@ rec { }; resolvedDefaultFeatures = [ "json-patch" "jsonpatch" "schema" "schemars" ]; }; - "kube-derive" = rec { + "kube-derive 0.96.0" = rec { + crateName = "kube-derive"; + version = "0.96.0"; + edition = "2021"; + sha256 = "1bc23sismxyyncsry902b2i2v0aifpxvgs3fdh9q412yrh24wdpr"; + procMacro = true; + libName = "kube_derive"; + authors = [ + "clux " + "Natalie Klestrup Röijezon " + "kazk " + ]; + dependencies = [ + { + name = "darling"; + packageId = "darling"; + } + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "serde_json"; + packageId = "serde_json"; + } + { + name = "syn"; + packageId = "syn 2.0.96"; + features = [ "extra-traits" ]; + } + ]; + + }; + "kube-derive 0.98.0" = rec { crateName = "kube-derive"; version = "0.98.0"; edition = "2021"; @@ -4310,7 +5058,130 @@ rec { ]; }; - "kube-runtime" = rec { + "kube-runtime 0.96.0" = rec { + crateName = "kube-runtime"; + version = "0.96.0"; + edition = "2021"; + sha256 = "0i5xr5i9xf44fwih1pvypr35sq30pcw979m9sbqnb3m9zzvg3yyk"; + libName = "kube_runtime"; + authors = [ + "clux " + "Natalie Klestrup Röijezon " + "kazk " + ]; + dependencies = [ + { + name = "ahash"; + packageId = "ahash"; + } + { + name = "async-broadcast"; + packageId = "async-broadcast"; + } + { + name = "async-stream"; + packageId = "async-stream"; + } + { + name = "async-trait"; + packageId = "async-trait"; + } + { + name = "backoff"; + packageId = "backoff"; + } + { + name = "educe"; + packageId = "educe"; + usesDefaultFeatures = false; + features = [ "Clone" "Debug" "Hash" "PartialEq" ]; + } + { + name = "futures"; + packageId = "futures 0.3.31"; + usesDefaultFeatures = false; + features = [ "async-await" ]; + } + { + name = "hashbrown"; + packageId = "hashbrown 0.14.5"; + } + { + name = "json-patch"; + packageId = "json-patch 2.0.0"; + } + { + name = "jsonptr"; + packageId = "jsonptr 0.4.7"; + } + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + } + { + name = "kube-client"; + packageId = "kube-client 0.96.0"; + usesDefaultFeatures = false; + features = [ "jsonpatch" "client" ]; + } + { + name = "parking_lot"; + packageId = "parking_lot"; + } + { + name = "pin-project"; + packageId = "pin-project"; + } + { + name = "serde"; + packageId = "serde"; + } + { + name = "serde_json"; + packageId = "serde_json"; + } + { + name = "thiserror"; + packageId = "thiserror 1.0.69"; + } + { + name = "tokio"; + packageId = "tokio"; + features = [ "time" ]; + } + { + name = "tokio-util"; + packageId = "tokio-util"; + features = [ "time" ]; + } + { + name = "tracing"; + packageId = "tracing"; + } + ]; + devDependencies = [ + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + features = [ "latest" ]; + } + { + name = "serde_json"; + packageId = "serde_json"; + } + { + name = "tokio"; + packageId = "tokio"; + features = [ "full" "test-util" ]; + } + ]; + features = { + "unstable-runtime" = [ "unstable-runtime-subscribe" "unstable-runtime-stream-control" "unstable-runtime-reconcile-on" ]; + }; + }; + "kube-runtime 0.98.0" = rec { crateName = "kube-runtime"; version = "0.98.0"; edition = "2021"; @@ -4356,7 +5227,7 @@ rec { } { name = "hashbrown"; - packageId = "hashbrown"; + packageId = "hashbrown 0.15.2"; } { name = "hostname"; @@ -4364,20 +5235,20 @@ rec { } { name = "json-patch"; - packageId = "json-patch"; + packageId = "json-patch 3.0.1"; } { name = "jsonptr"; - packageId = "jsonptr"; + packageId = "jsonptr 0.6.3"; } { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; usesDefaultFeatures = false; } { name = "kube-client"; - packageId = "kube-client"; + packageId = "kube-client 0.98.0"; usesDefaultFeatures = false; features = [ "jsonpatch" "client" ]; } @@ -4419,7 +5290,7 @@ rec { devDependencies = [ { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; usesDefaultFeatures = false; features = [ "latest" ]; } @@ -4886,7 +5757,7 @@ rec { dependencies = [ { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } { name = "cfg-if"; @@ -5906,7 +6777,7 @@ rec { dependencies = [ { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } ]; features = { @@ -6687,7 +7558,7 @@ rec { dependencies = [ { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } { name = "core-foundation"; @@ -6734,7 +7605,7 @@ rec { dependencies = [ { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } { name = "core-foundation"; @@ -7424,17 +8295,17 @@ rec { } { name = "json-patch"; - packageId = "json-patch"; + packageId = "json-patch 3.0.1"; } { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; usesDefaultFeatures = false; features = [ "schemars" "v1_32" ]; } { name = "kube"; - packageId = "kube"; + packageId = "kube 0.98.0"; usesDefaultFeatures = false; features = [ "client" "jsonpatch" "runtime" "derive" "rustls-tls" ]; } @@ -7579,7 +8450,7 @@ rec { dependencies = [ { name = "kube"; - packageId = "kube"; + packageId = "kube 0.98.0"; usesDefaultFeatures = false; features = [ "client" "jsonpatch" "runtime" "derive" "rustls-tls" ]; } @@ -7673,6 +8544,11 @@ rec { name = "stackable-operator"; packageId = "stackable-operator"; } + { + name = "stackable-versioned"; + packageId = "stackable-versioned"; + features = [ "k8s" ]; + } { name = "strum"; packageId = "strum"; @@ -7707,6 +8583,106 @@ rec { ]; }; + "stackable-versioned" = rec { + crateName = "stackable-versioned"; + version = "0.5.0"; + edition = "2021"; + workspace_member = null; + src = pkgs.fetchgit { + url = "https://github.com/stackabletech/operator-rs.git"; + rev = "048c7d8befddc2f2c6414444006871c95412d67c"; + sha256 = "1x2pfibrsysmkkmajyj30qkwsjf3rzmc3dxsd09jb9r4x7va6mr6"; + }; + libName = "stackable_versioned"; + authors = [ + "Stackable GmbH " + ]; + dependencies = [ + { + name = "stackable-versioned-macros"; + packageId = "stackable-versioned-macros"; + } + ]; + features = { + "full" = [ "k8s" ]; + "k8s" = [ "stackable-versioned-macros/k8s" ]; + }; + resolvedDefaultFeatures = [ "k8s" ]; + }; + "stackable-versioned-macros" = rec { + crateName = "stackable-versioned-macros"; + version = "0.5.0"; + edition = "2021"; + workspace_member = null; + src = pkgs.fetchgit { + url = "https://github.com/stackabletech/operator-rs.git"; + rev = "048c7d8befddc2f2c6414444006871c95412d67c"; + sha256 = "1x2pfibrsysmkkmajyj30qkwsjf3rzmc3dxsd09jb9r4x7va6mr6"; + }; + procMacro = true; + libName = "stackable_versioned_macros"; + authors = [ + "Stackable GmbH " + ]; + dependencies = [ + { + name = "convert_case"; + packageId = "convert_case"; + } + { + name = "darling"; + packageId = "darling"; + } + { + name = "itertools"; + packageId = "itertools"; + } + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + optional = true; + usesDefaultFeatures = false; + features = [ "schemars" "v1_31" ]; + } + { + name = "k8s-version"; + packageId = "k8s-version"; + features = [ "darling" ]; + } + { + name = "kube"; + packageId = "kube 0.96.0"; + optional = true; + usesDefaultFeatures = false; + features = [ "client" "jsonpatch" "runtime" "derive" "rustls-tls" ]; + } + { + name = "proc-macro2"; + packageId = "proc-macro2"; + } + { + name = "quote"; + packageId = "quote"; + } + { + name = "syn"; + packageId = "syn 2.0.96"; + } + ]; + devDependencies = [ + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + features = [ "schemars" "v1_31" ]; + } + ]; + features = { + "full" = [ "k8s" ]; + "k8s" = [ "dep:kube" "dep:k8s-openapi" ]; + }; + resolvedDefaultFeatures = [ "k8s" ]; + }; "strsim" = rec { crateName = "strsim"; version = "0.11.1"; @@ -8660,7 +9636,7 @@ rec { } { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } { name = "bytes"; @@ -9252,6 +10228,19 @@ rec { ]; }; + "unicode-segmentation" = rec { + crateName = "unicode-segmentation"; + version = "1.12.0"; + edition = "2018"; + sha256 = "14qla2jfx74yyb9ds3d2mpwpa4l4lzb9z57c6d2ba511458z5k7n"; + libName = "unicode_segmentation"; + authors = [ + "kwantam " + "Manish Goregaokar " + ]; + features = { + }; + }; "unicode-xid" = rec { crateName = "unicode-xid"; version = "0.2.6"; diff --git a/Cargo.toml b/Cargo.toml index efa6ca82..335517f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ serde_json = "1.0" serde_yaml = "0.9" snafu = "0.8" stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.85.0" } +stackable-versioned = { git = "https://github.com/stackabletech/operator-rs.git", features = ["k8s"], tag = "stackable-versioned-0.5.0" } product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" } strum = { version = "0.26", features = ["derive"] } tokio = { version = "1.40", features = ["full"] } diff --git a/crate-hashes.json b/crate-hashes.json index 290d87f2..c7d32c3a 100644 --- a/crate-hashes.json +++ b/crate-hashes.json @@ -2,5 +2,8 @@ "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.85.0#stackable-operator-derive@0.3.1": "0rh476rmn5850yj85hq8znwmlfhd7l5bkxz0n5i9m4cddxhi2cl5", "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.85.0#stackable-operator@0.85.0": "0rh476rmn5850yj85hq8znwmlfhd7l5bkxz0n5i9m4cddxhi2cl5", "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.85.0#stackable-shared@0.0.1": "0rh476rmn5850yj85hq8znwmlfhd7l5bkxz0n5i9m4cddxhi2cl5", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-versioned-0.5.0#k8s-version@0.1.2": "1x2pfibrsysmkkmajyj30qkwsjf3rzmc3dxsd09jb9r4x7va6mr6", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-versioned-0.5.0#stackable-versioned-macros@0.5.0": "1x2pfibrsysmkkmajyj30qkwsjf3rzmc3dxsd09jb9r4x7va6mr6", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-versioned-0.5.0#stackable-versioned@0.5.0": "1x2pfibrsysmkkmajyj30qkwsjf3rzmc3dxsd09jb9r4x7va6mr6", "git+https://github.com/stackabletech/product-config.git?tag=0.7.0#product-config@0.7.0": "0gjsm80g6r75pm3824dcyiz4ysq1ka4c1if6k1mjm9cnd5ym0gny" } \ No newline at end of file diff --git a/rust/operator-binary/Cargo.toml b/rust/operator-binary/Cargo.toml index 04755f11..bbc41909 100644 --- a/rust/operator-binary/Cargo.toml +++ b/rust/operator-binary/Cargo.toml @@ -21,6 +21,7 @@ openssl.workspace = true product-config.workspace = true snafu.workspace = true stackable-operator.workspace = true +stackable-versioned.workspace = true strum.workspace = true tokio.workspace = true tracing.workspace = true From 37a2f019ed2ba51335991b5421d819cccc243eb9 Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Mon, 24 Feb 2025 12:34:11 +0100 Subject: [PATCH 4/9] reorganize specs for versioning --- rust/operator-binary/src/crd/mod.rs | 174 ++++++++++++++-------------- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index 7e4f2063..ce868efe 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -188,6 +188,44 @@ pub struct TrinoClusterSpec { pub workers: Option>, } +#[derive(Clone, Debug, Default, Fragment, JsonSchema, PartialEq)] +#[fragment_attrs( + derive( + Clone, + Debug, + Default, + Deserialize, + Merge, + JsonSchema, + PartialEq, + Serialize + ), + serde(rename_all = "camelCase") +)] +pub struct TrinoConfig { + // config.properties + pub query_max_memory: Option, + pub query_max_memory_per_node: Option, + #[fragment_attrs(serde(default))] + pub logging: Logging, + #[fragment_attrs(serde(default))] + pub resources: Resources, + #[fragment_attrs(serde(default))] + pub affinity: StackableAffinity, + + /// Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details. + #[fragment_attrs(serde(default))] + pub graceful_shutdown_timeout: Option, + + /// Request secret (currently only autoTls certificates) lifetime from the secret operator, e.g. `7d`, or `30d`. + /// This can be shortened by the `maxCertificateLifetime` setting on the SecretClass issuing the TLS certificate. + /// + /// Defaults to `15d` for coordinators (as currently a restart kills all running queries) + /// and `1d` for workers. + #[fragment_attrs(serde(default))] + pub requested_secret_lifetime: Option, +} + #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct TrinoClusterConfig { @@ -231,29 +269,6 @@ pub struct TrinoClusterConfig { pub listener_class: CurrentlySupportedListenerClasses, } -// TODO: Temporary solution until listener-operator is finished -#[derive(Clone, Debug, Default, Display, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] -#[serde(rename_all = "PascalCase")] -pub enum CurrentlySupportedListenerClasses { - #[default] - #[serde(rename = "cluster-internal")] - ClusterInternal, - #[serde(rename = "external-unstable")] - ExternalUnstable, - #[serde(rename = "external-stable")] - ExternalStable, -} - -impl CurrentlySupportedListenerClasses { - pub fn k8s_service_type(&self) -> String { - match self { - CurrentlySupportedListenerClasses::ClusterInternal => "ClusterIP".to_string(), - CurrentlySupportedListenerClasses::ExternalUnstable => "NodePort".to_string(), - CurrentlySupportedListenerClasses::ExternalStable => "LoadBalancer".to_string(), - } - } -} - #[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct TrinoAuthorization { @@ -285,6 +300,55 @@ pub struct TrinoTls { pub internal_secret_class: Option, } +#[derive(Clone, Debug, Default, JsonSchema, PartialEq, Fragment)] +#[fragment_attrs( + derive( + Clone, + Debug, + Default, + Deserialize, + Merge, + JsonSchema, + PartialEq, + Serialize + ), + serde(rename_all = "camelCase") +)] +pub struct TrinoStorageConfig { + #[fragment_attrs(serde(default))] + pub data: PvcConfig, +} + +#[derive(Clone, Default, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct TrinoClusterStatus { + #[serde(default)] + pub conditions: Vec, +} + +// TODO: Temporary solution until listener-operator is finished +#[derive(Clone, Debug, Default, Display, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] +#[serde(rename_all = "PascalCase")] +pub enum CurrentlySupportedListenerClasses { + #[default] + #[serde(rename = "cluster-internal")] + ClusterInternal, + #[serde(rename = "external-unstable")] + ExternalUnstable, + #[serde(rename = "external-stable")] + ExternalStable, +} + +impl CurrentlySupportedListenerClasses { + pub fn k8s_service_type(&self) -> String { + match self { + CurrentlySupportedListenerClasses::ClusterInternal => "ClusterIP".to_string(), + CurrentlySupportedListenerClasses::ExternalUnstable => "NodePort".to_string(), + CurrentlySupportedListenerClasses::ExternalStable => "LoadBalancer".to_string(), + } + } +} + impl Default for TrinoTls { fn default() -> Self { TrinoTls { @@ -350,25 +414,6 @@ impl TrinoRole { } } -#[derive(Clone, Debug, Default, JsonSchema, PartialEq, Fragment)] -#[fragment_attrs( - derive( - Clone, - Debug, - Default, - Deserialize, - Merge, - JsonSchema, - PartialEq, - Serialize - ), - serde(rename_all = "camelCase") -)] -pub struct TrinoStorageConfig { - #[fragment_attrs(serde(default))] - pub data: PvcConfig, -} - #[derive( Clone, Debug, @@ -396,44 +441,6 @@ pub enum Container { Trino, } -#[derive(Clone, Debug, Default, Fragment, JsonSchema, PartialEq)] -#[fragment_attrs( - derive( - Clone, - Debug, - Default, - Deserialize, - Merge, - JsonSchema, - PartialEq, - Serialize - ), - serde(rename_all = "camelCase") -)] -pub struct TrinoConfig { - // config.properties - pub query_max_memory: Option, - pub query_max_memory_per_node: Option, - #[fragment_attrs(serde(default))] - pub logging: Logging, - #[fragment_attrs(serde(default))] - pub resources: Resources, - #[fragment_attrs(serde(default))] - pub affinity: StackableAffinity, - - /// Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details. - #[fragment_attrs(serde(default))] - pub graceful_shutdown_timeout: Option, - - /// Request secret (currently only autoTls certificates) lifetime from the secret operator, e.g. `7d`, or `30d`. - /// This can be shortened by the `maxCertificateLifetime` setting on the SecretClass issuing the TLS certificate. - /// - /// Defaults to `15d` for coordinators (as currently a restart kills all running queries) - /// and `1d` for workers. - #[fragment_attrs(serde(default))] - pub requested_secret_lifetime: Option, -} - impl TrinoConfig { fn default_config( cluster_name: &str, @@ -859,13 +866,6 @@ impl TrinoCluster { } } -#[derive(Clone, Default, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct TrinoClusterStatus { - #[serde(default)] - pub conditions: Vec, -} - impl HasStatusCondition for TrinoCluster { fn conditions(&self) -> Vec { match &self.status { From fef4dea1d6c7f4fcb50a90ec1628a745b561073a Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Mon, 24 Feb 2025 12:43:52 +0100 Subject: [PATCH 5/9] versioning for the TrinoCatalog spec --- rust/operator-binary/src/catalog/config.rs | 4 +- rust/operator-binary/src/controller.rs | 6 +- rust/operator-binary/src/crd/affinity.rs | 10 ++-- .../src/crd/catalog/generic.rs | 4 +- rust/operator-binary/src/crd/catalog/mod.rs | 55 ++++++++++--------- rust/operator-binary/src/crd/mod.rs | 6 +- rust/operator-binary/src/main.rs | 6 +- 7 files changed, 47 insertions(+), 44 deletions(-) diff --git a/rust/operator-binary/src/catalog/config.rs b/rust/operator-binary/src/catalog/config.rs index 99cf20cb..a52a0533 100644 --- a/rust/operator-binary/src/catalog/config.rs +++ b/rust/operator-binary/src/catalog/config.rs @@ -9,7 +9,7 @@ use stackable_operator::{ }; use super::{FromTrinoCatalogError, ToCatalogConfig}; -use crate::crd::catalog::{TrinoCatalog, TrinoCatalogConnector}; +use crate::crd::catalog::{v1alpha1, TrinoCatalogConnector}; pub struct CatalogConfig { /// Name of the catalog @@ -103,7 +103,7 @@ impl CatalogConfig { } pub async fn from_catalog( - catalog: &TrinoCatalog, + catalog: &v1alpha1::TrinoCatalog, client: &Client, ) -> Result { let catalog_name = catalog diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index e4d105ea..2a45cfa6 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -80,7 +80,7 @@ use crate::{ command, config, crd::{ authentication::resolve_authentication_classes, - catalog::TrinoCatalog, + catalog::v1alpha1, discovery::{TrinoDiscovery, TrinoDiscoveryProtocol, TrinoPodRef}, Container, TrinoCluster, TrinoClusterStatus, TrinoConfig, TrinoConfigFragment, TrinoRole, ACCESS_CONTROL_PROPERTIES, APP_NAME, CONFIG_DIR_NAME, CONFIG_PROPERTIES, DATA_DIR_NAME, @@ -218,7 +218,7 @@ pub enum Error { #[snafu(display("failed to parse {catalog}"))] ParseCatalog { source: FromTrinoCatalogError, - catalog: ObjectRef, + catalog: ObjectRef, }, #[snafu(display("illegal container name: [{container_name}]"))] @@ -389,7 +389,7 @@ pub async fn reconcile_trino( .context(InvalidAuthenticationConfigSnafu)?; let catalog_definitions = client - .list_with_label_selector::( + .list_with_label_selector::( trino .metadata .namespace diff --git a/rust/operator-binary/src/crd/affinity.rs b/rust/operator-binary/src/crd/affinity.rs index 562a0841..26c199ea 100644 --- a/rust/operator-binary/src/crd/affinity.rs +++ b/rust/operator-binary/src/crd/affinity.rs @@ -6,14 +6,14 @@ use stackable_operator::{ }; use crate::crd::{ - catalog::{TrinoCatalog, TrinoCatalogConnector}, + catalog::{v1alpha1, TrinoCatalogConnector}, TrinoRole, APP_NAME, }; pub fn get_affinity( cluster_name: &str, role: &TrinoRole, - trino_catalogs: &[TrinoCatalog], + trino_catalogs: &[v1alpha1::TrinoCatalog], ) -> StackableAffinityFragment { let affinity_between_cluster_pods = affinity_between_cluster_pods(APP_NAME, cluster_name, 20); let mut affinities = vec![affinity_between_cluster_pods]; @@ -234,7 +234,7 @@ mod tests { configMap: simple-hdfs "#; let deserializer = serde_yaml::Deserializer::from_str(input); - let hive_catalog_1: TrinoCatalog = + let hive_catalog_1: v1alpha1::TrinoCatalog = serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap(); let input = r#" @@ -249,7 +249,7 @@ mod tests { tpch: {} "#; let deserializer = serde_yaml::Deserializer::from_str(input); - let tpch_catalog: TrinoCatalog = + let tpch_catalog: v1alpha1::TrinoCatalog = serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap(); let input = r#" @@ -268,7 +268,7 @@ mod tests { reference: minio "#; let deserializer = serde_yaml::Deserializer::from_str(input); - let hive_catalog_2: TrinoCatalog = + let hive_catalog_2: v1alpha1::TrinoCatalog = serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap(); let merged_config = trino diff --git a/rust/operator-binary/src/crd/catalog/generic.rs b/rust/operator-binary/src/crd/catalog/generic.rs index 442ac298..0341bd71 100644 --- a/rust/operator-binary/src/crd/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::crd::catalog::{TrinoCatalog, TrinoCatalogConnector}; + use crate::crd::catalog::{v1alpha1, TrinoCatalogConnector}; #[test] fn test_cr_parsing() { @@ -66,7 +66,7 @@ mod tests { key: password "#; let deserializer = serde_yaml::Deserializer::from_str(input); - let catalog: TrinoCatalog = + let catalog: v1alpha1::TrinoCatalog = serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap(); assert_eq!( diff --git a/rust/operator-binary/src/crd/catalog/mod.rs b/rust/operator-binary/src/crd/catalog/mod.rs index 3e0f6b51..5f2a9046 100644 --- a/rust/operator-binary/src/crd/catalog/mod.rs +++ b/rust/operator-binary/src/crd/catalog/mod.rs @@ -20,36 +20,39 @@ use stackable_operator::{ kube::CustomResource, schemars::{self, JsonSchema}, }; +use stackable_versioned::versioned; use tpcds::TpcdsConnector; use tpch::TpchConnector; use self::delta_lake::DeltaLakeConnector; -/// The TrinoCatalog resource can be used to define catalogs in Kubernetes objects. -/// Read more about it in the [Trino operator concept docs](DOCS_BASE_URL_PLACEHOLDER/trino/concepts) -/// and the [Trino operator usage guide](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/). -/// The documentation also contains a list of all the supported backends. -#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] -#[kube( - group = "trino.stackable.tech", - version = "v1alpha1", - kind = "TrinoCatalog", - plural = "trinocatalogs", - namespaced, - crates( - kube_core = "stackable_operator::kube::core", - k8s_openapi = "stackable_operator::k8s_openapi", - schemars = "stackable_operator::schemars" - ) -)] -#[serde(rename_all = "camelCase")] -pub struct TrinoCatalogSpec { - /// The `connector` defines which connector is used. - pub connector: TrinoCatalogConnector, - #[serde(default)] - /// The `configOverrides` allow overriding arbitrary Trino settings. - /// For example, for Hive you could add `hive.metastore.username: trino`. - pub config_overrides: HashMap, +#[versioned(version(name = "v1alpha1"), options(skip(from)))] +pub mod versioned { + /// The TrinoCatalog resource can be used to define catalogs in Kubernetes objects. + /// Read more about it in the [Trino operator concept docs](DOCS_BASE_URL_PLACEHOLDER/trino/concepts) + /// and the [Trino operator usage guide](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/catalogs/). + /// The documentation also contains a list of all the supported backends. + #[versioned(k8s( + group = "trino.stackable.tech", + kind = "TrinoCatalog", + plural = "trinocatalogs", + namespaced, + crates( + kube_core = "stackable_operator::kube::core", + k8s_openapi = "stackable_operator::k8s_openapi", + schemars = "stackable_operator::schemars" + ) + ))] + #[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct TrinoCatalogSpec { + /// The `connector` defines which connector is used. + pub connector: TrinoCatalogConnector, + #[serde(default)] + /// The `configOverrides` allow overriding arbitrary Trino settings. + /// For example, for Hive you could add `hive.metastore.username: trino`. + pub config_overrides: HashMap, + } } #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] @@ -88,6 +91,6 @@ mod tests { #[test] fn test_crd_generation() { - TrinoCatalog::crd(); + v1alpha1::TrinoCatalog::crd(); } } diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index ce868efe..ee19c5f5 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -6,7 +6,7 @@ pub mod discovery; use std::{collections::BTreeMap, str::FromStr}; use affinity::get_affinity; -use catalog::TrinoCatalog; +use catalog::v1alpha1; use serde::{Deserialize, Serialize}; use snafu::{OptionExt, ResultExt, Snafu}; use stackable_operator::{ @@ -445,7 +445,7 @@ impl TrinoConfig { fn default_config( cluster_name: &str, role: &TrinoRole, - trino_catalogs: &[TrinoCatalog], + trino_catalogs: &[v1alpha1::TrinoCatalog], ) -> TrinoConfigFragment { let (cpu_min, cpu_max, memory) = match role { TrinoRole::Coordinator => ("500m", "2", "4Gi"), @@ -840,7 +840,7 @@ impl TrinoCluster { &self, role: &TrinoRole, rolegroup_ref: &RoleGroupRef, - trino_catalogs: &[TrinoCatalog], + trino_catalogs: &[v1alpha1::TrinoCatalog], ) -> Result { // Initialize the result with all default values as baseline let conf_defaults = TrinoConfig::default_config(&self.name_any(), role, trino_catalogs); diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index f5e8db05..583c1101 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -34,7 +34,7 @@ use stackable_operator::{ use crate::{ controller::{FULL_CONTROLLER_NAME, OPERATOR_NAME}, - crd::{catalog::TrinoCatalog, TrinoCluster, APP_NAME}, + crd::{catalog::v1alpha1, TrinoCluster, APP_NAME}, }; mod built_info { @@ -54,7 +54,7 @@ async fn main() -> anyhow::Result<()> { match opts.cmd { Command::Crd => { TrinoCluster::print_yaml_schema(built_info::PKG_VERSION)?; - TrinoCatalog::print_yaml_schema(built_info::PKG_VERSION)?; + v1alpha1::TrinoCatalog::print_yaml_schema(built_info::PKG_VERSION)?; } Command::Run(ProductOperatorRun { product_config, @@ -115,7 +115,7 @@ async fn main() -> anyhow::Result<()> { ) .shutdown_on_signal() .watches( - watch_namespace.get_api::>(&client), + watch_namespace.get_api::>(&client), watcher::Config::default(), move |catalog| { // TODO: Filter clusters more precisely based on the catalogLabelSelector to avoid unnecessary reconciles From ab97223440b62ff65990704669a23b9d3da25e1e Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Mon, 24 Feb 2025 14:44:00 +0100 Subject: [PATCH 6/9] versioning for the TrinoCluster and referenced specs --- rust/operator-binary/src/authorization/opa.rs | 2 +- rust/operator-binary/src/command.rs | 8 +- rust/operator-binary/src/config/jvm.rs | 13 +- rust/operator-binary/src/controller.rs | 90 ++-- rust/operator-binary/src/crd/affinity.rs | 18 +- rust/operator-binary/src/crd/mod.rs | 422 +++++++++--------- rust/operator-binary/src/main.rs | 13 +- .../src/operations/graceful_shutdown.rs | 9 +- rust/operator-binary/src/operations/pdb.rs | 4 +- rust/operator-binary/src/product_logging.rs | 6 +- 10 files changed, 303 insertions(+), 282 deletions(-) diff --git a/rust/operator-binary/src/authorization/opa.rs b/rust/operator-binary/src/authorization/opa.rs index 752e5155..f76eeb11 100644 --- a/rust/operator-binary/src/authorization/opa.rs +++ b/rust/operator-binary/src/authorization/opa.rs @@ -5,7 +5,7 @@ use stackable_operator::{ commons::opa::{OpaApiVersion, OpaConfig}, }; -use crate::crd::TrinoCluster; +use crate::crd::v1alpha1::TrinoCluster; pub struct TrinoOpaConfig { /// URI for OPA policies, e.g. diff --git a/rust/operator-binary/src/command.rs b/rust/operator-binary/src/command.rs index eb5c56e1..c4404d34 100644 --- a/rust/operator-binary/src/command.rs +++ b/rust/operator-binary/src/command.rs @@ -11,17 +11,17 @@ use crate::{ 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, + v1alpha1, Container, 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( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, catalogs: &[CatalogConfig], - merged_config: &TrinoConfig, + merged_config: &v1alpha1::TrinoConfig, ) -> Vec { let mut args = vec![]; diff --git a/rust/operator-binary/src/config/jvm.rs b/rust/operator-binary/src/config/jvm.rs index 4c77d44d..ff0dca61 100644 --- a/rust/operator-binary/src/config/jvm.rs +++ b/rust/operator-binary/src/config/jvm.rs @@ -7,8 +7,8 @@ use stackable_operator::{ }; 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, + v1alpha1, JVM_HEAP_FACTOR, JVM_SECURITY_PROPERTIES, METRICS_PORT, RW_CONFIG_DIR_NAME, + STACKABLE_CLIENT_TLS_DIR, STACKABLE_TLS_STORE_PASSWORD, }; #[derive(Snafu, Debug)] @@ -39,8 +39,8 @@ pub enum Error { // in the future depending on the role and version. pub fn jvm_config( product_version: &str, - merged_config: &TrinoConfig, - role: &Role, + merged_config: &v1alpha1::TrinoConfig, + role: &Role, role_group: &str, ) -> Result { let memory_unit = BinaryMultiple::Mebi; @@ -153,7 +153,7 @@ mod tests { use indoc::indoc; use super::*; - use crate::crd::{TrinoCluster, TrinoRole}; + use crate::crd::{v1alpha1, TrinoRole}; #[test] fn test_jvm_config_defaults() { @@ -262,7 +262,8 @@ mod tests { } fn construct_jvm_config(trino_cluster: &str) -> String { - let trino: TrinoCluster = serde_yaml::from_str(trino_cluster).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(trino_cluster).expect("illegal test input"); let role = TrinoRole::Coordinator; let rolegroup_ref = role.rolegroup_ref(&trino, "default"); diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index 2a45cfa6..a2533288 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -80,15 +80,15 @@ use crate::{ command, config, crd::{ authentication::resolve_authentication_classes, - catalog::v1alpha1, + catalog, 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, + v1alpha1, Container, 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, @@ -152,25 +152,25 @@ pub enum Error { #[snafu(display("failed to apply Service for {}", rolegroup))] ApplyRoleGroupService { source: stackable_operator::cluster_resources::Error, - rolegroup: RoleGroupRef, + rolegroup: RoleGroupRef, }, #[snafu(display("failed to build ConfigMap for {}", rolegroup))] BuildRoleGroupConfig { source: stackable_operator::builder::configmap::Error, - rolegroup: RoleGroupRef, + rolegroup: RoleGroupRef, }, #[snafu(display("failed to apply ConfigMap for {}", rolegroup))] ApplyRoleGroupConfig { source: stackable_operator::cluster_resources::Error, - rolegroup: RoleGroupRef, + rolegroup: RoleGroupRef, }, #[snafu(display("failed to apply StatefulSet for {}", rolegroup))] ApplyRoleGroupStatefulSet { source: stackable_operator::cluster_resources::Error, - rolegroup: RoleGroupRef, + rolegroup: RoleGroupRef, }, #[snafu(display("failed to apply internal secret"))] @@ -218,7 +218,7 @@ pub enum Error { #[snafu(display("failed to parse {catalog}"))] ParseCatalog { source: FromTrinoCatalogError, - catalog: ObjectRef, + catalog: ObjectRef, }, #[snafu(display("illegal container name: [{container_name}]"))] @@ -360,7 +360,7 @@ impl ReconcilerError for Error { } pub async fn reconcile_trino( - trino: Arc>, + trino: Arc>, ctx: Arc, ) -> Result { tracing::info!("Starting reconcile"); @@ -389,7 +389,7 @@ pub async fn reconcile_trino( .context(InvalidAuthenticationConfigSnafu)?; let catalog_definitions = client - .list_with_label_selector::( + .list_with_label_selector::( trino .metadata .namespace @@ -475,7 +475,7 @@ pub async fn reconcile_trino( for (trino_role_str, role_config) in validated_config { let trino_role = TrinoRole::from_str(&trino_role_str).context(FailedToParseRoleSnafu)?; - let role: &Role = + let role: &Role = trino.role(&trino_role).context(ReadRoleSnafu)?; for (role_group, config) in role_config { let rolegroup = trino_role.rolegroup_ref(trino, &role_group); @@ -561,7 +561,7 @@ pub async fn reconcile_trino( let cluster_operation_cond_builder = ClusterOperationsConditionBuilder::new(&trino.spec.cluster_operation); - let status = TrinoClusterStatus { + let status = v1alpha1::TrinoClusterStatus { conditions: compute_conditions( trino, &[&sts_cond_builder, &cluster_operation_cond_builder], @@ -583,7 +583,7 @@ pub async fn reconcile_trino( /// The coordinator-role service is the primary endpoint that should be used by clients that do not /// perform internal load balancing, including targets outside of the cluster. pub fn build_coordinator_role_service( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, resolved_product_image: &ResolvedProductImage, ) -> Result { let role = TrinoRole::Coordinator; @@ -622,13 +622,13 @@ pub fn build_coordinator_role_service( /// The rolegroup [`ConfigMap`] configures the rolegroup based on the configuration given by the administrator #[allow(clippy::too_many_arguments)] fn build_rolegroup_config_map( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, resolved_product_image: &ResolvedProductImage, - role: &Role, + role: &Role, trino_role: &TrinoRole, - rolegroup_ref: &RoleGroupRef, + rolegroup_ref: &RoleGroupRef, config: &HashMap>, - merged_config: &TrinoConfig, + merged_config: &v1alpha1::TrinoConfig, trino_authentication_config: &TrinoAuthenticationConfig, trino_opa_config: &Option, vector_aggregator_address: Option<&str>, @@ -830,9 +830,9 @@ fn build_rolegroup_config_map( /// The rolegroup catalog [`ConfigMap`] configures the rolegroup catalog based on the configuration /// given by the administrator fn build_rolegroup_catalog_config_map( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, resolved_product_image: &ResolvedProductImage, - rolegroup_ref: &RoleGroupRef, + rolegroup_ref: &RoleGroupRef, catalogs: &[CatalogConfig], ) -> Result { ConfigMapBuilder::new() @@ -886,12 +886,12 @@ fn build_rolegroup_catalog_config_map( /// corresponding [`Service`] (from [`build_rolegroup_service`]). #[allow(clippy::too_many_arguments)] fn build_rolegroup_statefulset( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, trino_role: &TrinoRole, resolved_product_image: &ResolvedProductImage, - rolegroup_ref: &RoleGroupRef, + rolegroup_ref: &RoleGroupRef, config: &HashMap>, - merged_config: &TrinoConfig, + merged_config: &v1alpha1::TrinoConfig, trino_authentication_config: &TrinoAuthenticationConfig, catalogs: &[CatalogConfig], sa_name: &str, @@ -1226,9 +1226,9 @@ fn build_rolegroup_statefulset( /// /// This is mostly useful for internal communication between peers, or for clients that perform client-side load balancing. fn build_rolegroup_service( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, resolved_product_image: &ResolvedProductImage, - rolegroup_ref: &RoleGroupRef, + rolegroup_ref: &RoleGroupRef, ) -> Result { Ok(Service { metadata: ObjectMetaBuilder::new() @@ -1268,7 +1268,7 @@ fn build_rolegroup_service( } pub fn error_policy( - _obj: Arc>, + _obj: Arc>, error: &Error, _ctx: Arc, ) -> Action { @@ -1306,7 +1306,7 @@ fn env_var_from_secret(secret_name: &str, secret_key: Option<&str>, env_var: &st /// * `product_config` - The product config to validate and complement the user config. /// fn validated_product_config( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, version: &str, product_config: &ProductConfigManager, ) -> Result { @@ -1357,11 +1357,11 @@ fn validated_product_config( } fn build_recommended_labels<'a>( - owner: &'a TrinoCluster, + owner: &'a v1alpha1::TrinoCluster, app_version: &'a str, role: &'a str, role_group: &'a str, -) -> ObjectLabels<'a, TrinoCluster> { +) -> ObjectLabels<'a, v1alpha1::TrinoCluster> { ObjectLabels { owner, app_name: APP_NAME, @@ -1373,7 +1373,10 @@ fn build_recommended_labels<'a>( } } -async fn create_shared_internal_secret(trino: &TrinoCluster, client: &Client) -> Result<()> { +async fn create_shared_internal_secret( + trino: &v1alpha1::TrinoCluster, + client: &Client, +) -> Result<()> { let secret = build_shared_internal_secret(trino)?; if client .get_opt::( @@ -1396,7 +1399,7 @@ async fn create_shared_internal_secret(trino: &TrinoCluster, client: &Client) -> Ok(()) } -fn build_shared_internal_secret(trino: &TrinoCluster) -> Result { +fn build_shared_internal_secret(trino: &v1alpha1::TrinoCluster) -> Result { let mut internal_secret = BTreeMap::new(); internal_secret.insert(ENV_INTERNAL_SECRET.to_string(), get_random_base64()); @@ -1413,7 +1416,7 @@ fn build_shared_internal_secret(trino: &TrinoCluster) -> Result { }) } -fn build_shared_internal_secret_name(trino: &TrinoCluster) -> String { +fn build_shared_internal_secret_name(trino: &v1alpha1::TrinoCluster) -> String { format!("{}-internal-secret", trino.name_any()) } @@ -1423,7 +1426,7 @@ fn get_random_base64() -> String { openssl::base64::encode_block(&buf) } -fn service_ports(trino: &TrinoCluster) -> Vec { +fn service_ports(trino: &v1alpha1::TrinoCluster) -> Vec { let mut ports = vec![ServicePort { name: Some(METRICS_PORT_NAME.to_string()), port: METRICS_PORT.into(), @@ -1452,7 +1455,7 @@ fn service_ports(trino: &TrinoCluster) -> Vec { ports } -fn container_ports(trino: &TrinoCluster) -> Vec { +fn container_ports(trino: &v1alpha1::TrinoCluster) -> Vec { let mut ports = vec![ContainerPort { name: Some(METRICS_PORT_NAME.to_string()), container_port: METRICS_PORT.into(), @@ -1481,7 +1484,7 @@ fn container_ports(trino: &TrinoCluster) -> Vec { ports } -fn readiness_probe(trino: &TrinoCluster) -> Probe { +fn readiness_probe(trino: &v1alpha1::TrinoCluster) -> Probe { let port_name = if trino.expose_https_port() { HTTPS_PORT_NAME } else { @@ -1500,7 +1503,7 @@ fn readiness_probe(trino: &TrinoCluster) -> Probe { } } -fn liveness_probe(trino: &TrinoCluster) -> Probe { +fn liveness_probe(trino: &v1alpha1::TrinoCluster) -> Probe { let port_name = if trino.expose_https_port() { HTTPS_PORT_NAME } else { @@ -1537,7 +1540,7 @@ fn create_tls_volume( } fn tls_volume_mounts( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, pod_builder: &mut PodBuilder, cb_prepare: &mut ContainerBuilder, cb_trino: &mut ContainerBuilder, @@ -1686,7 +1689,8 @@ mod tests { } fn build_config_map(trino_yaml: &str) -> ConfigMap { - let mut trino: TrinoCluster = serde_yaml::from_str(trino_yaml).expect("illegal test input"); + let mut trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(trino_yaml).expect("illegal test input"); trino.metadata.namespace = Some("default".to_owned()); trino.metadata.uid = Some("42".to_owned()); let cluster_info = KubernetesClusterInfo { @@ -1803,7 +1807,7 @@ mod tests { replicas: 1 "#; let deserializer = serde_yaml::Deserializer::from_str(trino_yaml); - let trino: TrinoCluster = + let trino: v1alpha1::TrinoCluster = serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap(); let validated_config = validated_product_config( diff --git a/rust/operator-binary/src/crd/affinity.rs b/rust/operator-binary/src/crd/affinity.rs index 26c199ea..65c8fe28 100644 --- a/rust/operator-binary/src/crd/affinity.rs +++ b/rust/operator-binary/src/crd/affinity.rs @@ -6,14 +6,14 @@ use stackable_operator::{ }; use crate::crd::{ - catalog::{v1alpha1, TrinoCatalogConnector}, + catalog::{self, TrinoCatalogConnector}, TrinoRole, APP_NAME, }; pub fn get_affinity( cluster_name: &str, role: &TrinoRole, - trino_catalogs: &[v1alpha1::TrinoCatalog], + trino_catalogs: &[catalog::v1alpha1::TrinoCatalog], ) -> StackableAffinityFragment { let affinity_between_cluster_pods = affinity_between_cluster_pods(APP_NAME, cluster_name, 20); let mut affinities = vec![affinity_between_cluster_pods]; @@ -102,7 +102,7 @@ mod tests { }; use super::*; - use crate::crd::TrinoCluster; + use crate::crd::v1alpha1; #[rstest] #[case(TrinoRole::Coordinator)] @@ -129,7 +129,8 @@ mod tests { default: replicas: 1 "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); let merged_config = trino .merged_config(&role, &role.rolegroup_ref(&trino, "default"), &[]) .unwrap(); @@ -216,7 +217,8 @@ mod tests { default: replicas: 1 "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); let input = r#" apiVersion: trino.stackable.tech/v1alpha1 @@ -234,7 +236,7 @@ mod tests { configMap: simple-hdfs "#; let deserializer = serde_yaml::Deserializer::from_str(input); - let hive_catalog_1: v1alpha1::TrinoCatalog = + let hive_catalog_1: catalog::v1alpha1::TrinoCatalog = serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap(); let input = r#" @@ -249,7 +251,7 @@ mod tests { tpch: {} "#; let deserializer = serde_yaml::Deserializer::from_str(input); - let tpch_catalog: v1alpha1::TrinoCatalog = + let tpch_catalog: catalog::v1alpha1::TrinoCatalog = serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap(); let input = r#" @@ -268,7 +270,7 @@ mod tests { reference: minio "#; let deserializer = serde_yaml::Deserializer::from_str(input); - let hive_catalog_2: v1alpha1::TrinoCatalog = + let hive_catalog_2: catalog::v1alpha1::TrinoCatalog = serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap(); let merged_config = trino diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index ee19c5f5..6fea1c80 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -6,7 +6,6 @@ pub mod discovery; use std::{collections::BTreeMap, str::FromStr}; use affinity::get_affinity; -use catalog::v1alpha1; use serde::{Deserialize, Serialize}; use snafu::{OptionExt, ResultExt, Snafu}; use stackable_operator::{ @@ -35,6 +34,7 @@ use stackable_operator::{ time::Duration, utils::cluster_info::KubernetesClusterInfo, }; +use stackable_versioned::versioned; use strum::{Display, EnumIter, EnumString, IntoEnumIterator}; use crate::crd::discovery::TrinoPodRef; @@ -148,182 +148,184 @@ pub enum Error { FragmentValidationFailure { source: ValidationError }, } -/// A Trino cluster stacklet. This resource is managed by the Stackable operator for Trino. -/// Find more information on how to use it and the resources that the operator generates in the -/// [operator documentation](DOCS_BASE_URL_PLACEHOLDER/trino/). -#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] -#[kube( - group = "trino.stackable.tech", - version = "v1alpha1", - kind = "TrinoCluster", - plural = "trinoclusters", - shortname = "trino", - namespaced, - crates( - kube_core = "stackable_operator::kube::core", - k8s_openapi = "stackable_operator::k8s_openapi", - schemars = "stackable_operator::schemars" - ) -)] -#[kube(status = "TrinoClusterStatus")] -#[serde(rename_all = "camelCase")] -pub struct TrinoClusterSpec { - // no doc - it's in the struct. - pub image: ProductImage, - - /// Settings that affect all roles and role groups. - /// The settings in the `clusterConfig` are cluster wide settings that do not need to be configurable at role or role group level. - pub cluster_config: TrinoClusterConfig, - - // no doc - it's in the struct. - #[serde(default)] - pub cluster_operation: ClusterOperation, - - // no doc - it's in the struct. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub coordinators: Option>, - - // no doc - it's in the struct. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub workers: Option>, -} +#[versioned(version(name = "v1alpha1"), options(skip(from)))] +pub mod versioned { + /// A Trino cluster stacklet. This resource is managed by the Stackable operator for Trino. + /// Find more information on how to use it and the resources that the operator generates in the + /// [operator documentation](DOCS_BASE_URL_PLACEHOLDER/trino/). + #[versioned(k8s( + group = "trino.stackable.tech", + kind = "TrinoCluster", + plural = "trinoclusters", + shortname = "trino", + status = "TrinoClusterStatus", + namespaced, + crates( + kube_core = "stackable_operator::kube::core", + k8s_openapi = "stackable_operator::k8s_openapi", + schemars = "stackable_operator::schemars" + ) + ))] + #[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct TrinoClusterSpec { + // no doc - it's in the struct. + pub image: ProductImage, + + /// Settings that affect all roles and role groups. + /// The settings in the `clusterConfig` are cluster wide settings that do not need to be configurable at role or role group level. + pub cluster_config: TrinoClusterConfig, + + // no doc - it's in the struct. + #[serde(default)] + pub cluster_operation: ClusterOperation, + + // no doc - it's in the struct. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub coordinators: Option>, + + // no doc - it's in the struct. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub workers: Option>, + } -#[derive(Clone, Debug, Default, Fragment, JsonSchema, PartialEq)] -#[fragment_attrs( - derive( - Clone, - Debug, - Default, - Deserialize, - Merge, - JsonSchema, - PartialEq, - Serialize - ), - serde(rename_all = "camelCase") -)] -pub struct TrinoConfig { - // config.properties - pub query_max_memory: Option, - pub query_max_memory_per_node: Option, - #[fragment_attrs(serde(default))] - pub logging: Logging, - #[fragment_attrs(serde(default))] - pub resources: Resources, - #[fragment_attrs(serde(default))] - pub affinity: StackableAffinity, - - /// Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details. - #[fragment_attrs(serde(default))] - pub graceful_shutdown_timeout: Option, - - /// Request secret (currently only autoTls certificates) lifetime from the secret operator, e.g. `7d`, or `30d`. - /// This can be shortened by the `maxCertificateLifetime` setting on the SecretClass issuing the TLS certificate. - /// - /// Defaults to `15d` for coordinators (as currently a restart kills all running queries) - /// and `1d` for workers. - #[fragment_attrs(serde(default))] - pub requested_secret_lifetime: Option, -} + #[derive(Clone, Debug, Default, Fragment, JsonSchema, PartialEq)] + #[fragment_attrs( + derive( + Clone, + Debug, + Default, + Deserialize, + Merge, + JsonSchema, + PartialEq, + Serialize + ), + serde(rename_all = "camelCase") + )] + pub struct TrinoConfig { + // config.properties + pub query_max_memory: Option, + pub query_max_memory_per_node: Option, + #[fragment_attrs(serde(default))] + pub logging: Logging, + #[fragment_attrs(serde(default))] + pub resources: Resources, + #[fragment_attrs(serde(default))] + pub affinity: StackableAffinity, + + /// Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details. + #[fragment_attrs(serde(default))] + pub graceful_shutdown_timeout: Option, + + /// Request secret (currently only autoTls certificates) lifetime from the secret operator, e.g. `7d`, or `30d`. + /// This can be shortened by the `maxCertificateLifetime` setting on the SecretClass issuing the TLS certificate. + /// + /// Defaults to `15d` for coordinators (as currently a restart kills all running queries) + /// and `1d` for workers. + #[fragment_attrs(serde(default))] + pub requested_secret_lifetime: Option, + } -#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct TrinoClusterConfig { - /// Authentication options for Trino. - /// Learn more in the [Trino authentication usage guide](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/security#authentication). - #[serde(default)] - pub authentication: Vec, - - /// Authorization options for Trino. - /// Learn more in the [Trino authorization usage guide](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/security#authorization). - #[serde(skip_serializing_if = "Option::is_none")] - pub authorization: Option, - - /// [LabelSelector](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors) selecting the Catalogs - /// to include in the Trino instance. - pub catalog_label_selector: LabelSelector, - - /// TLS configuration options for server and internal communication. - #[serde(default)] - pub tls: TrinoTls, - - /// Name of the Vector aggregator [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery). - /// It must contain the key `ADDRESS` with the address of the Vector aggregator. - /// Follow the [logging tutorial](DOCS_BASE_URL_PLACEHOLDER/tutorials/logging-vector-aggregator) - /// to learn how to configure log aggregation with Vector. - #[serde(skip_serializing_if = "Option::is_none")] - pub vector_aggregator_config_map_name: Option, - - /// This field controls which type of Service the Operator creates for this TrinoCluster: - /// - /// * cluster-internal: Use a ClusterIP service - /// - /// * external-unstable: Use a NodePort service - /// - /// * external-stable: Use a LoadBalancer service - /// - /// This is a temporary solution with the goal to keep yaml manifests forward compatible. - /// In the future, this setting will control which [ListenerClass](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass.html) - /// will be used to expose the service, and ListenerClass names will stay the same, allowing for a non-breaking change. - #[serde(default)] - pub listener_class: CurrentlySupportedListenerClasses, -} + #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct TrinoClusterConfig { + /// Authentication options for Trino. + /// Learn more in the [Trino authentication usage guide](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/security#authentication). + #[serde(default)] + pub authentication: Vec, + + /// Authorization options for Trino. + /// Learn more in the [Trino authorization usage guide](DOCS_BASE_URL_PLACEHOLDER/trino/usage-guide/security#authorization). + #[serde(skip_serializing_if = "Option::is_none")] + pub authorization: Option, + + /// [LabelSelector](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors) selecting the Catalogs + /// to include in the Trino instance. + pub catalog_label_selector: LabelSelector, + + /// TLS configuration options for server and internal communication. + #[serde(default)] + pub tls: TrinoTls, + + /// Name of the Vector aggregator [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery). + /// It must contain the key `ADDRESS` with the address of the Vector aggregator. + /// Follow the [logging tutorial](DOCS_BASE_URL_PLACEHOLDER/tutorials/logging-vector-aggregator) + /// to learn how to configure log aggregation with Vector. + #[serde(skip_serializing_if = "Option::is_none")] + pub vector_aggregator_config_map_name: Option, + + /// This field controls which type of Service the Operator creates for this TrinoCluster: + /// + /// * cluster-internal: Use a ClusterIP service + /// + /// * external-unstable: Use a NodePort service + /// + /// * external-stable: Use a LoadBalancer service + /// + /// This is a temporary solution with the goal to keep yaml manifests forward compatible. + /// In the future, this setting will control which [ListenerClass](DOCS_BASE_URL_PLACEHOLDER/listener-operator/listenerclass.html) + /// will be used to expose the service, and ListenerClass names will stay the same, allowing for a non-breaking change. + #[serde(default)] + pub listener_class: CurrentlySupportedListenerClasses, + } -#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct TrinoAuthorization { - // no doc - it's in the struct. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub opa: Option, -} + #[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct TrinoAuthorization { + // no doc - it's in the struct. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub opa: Option, + } -#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct TrinoTls { - /// Only affects client connections. - /// This setting controls: - /// - If TLS encryption is used at all - /// - Which cert the servers should use to authenticate themselves against the client - #[serde( - default = "tls_secret_class_default", - skip_serializing_if = "Option::is_none" - )] - pub server_secret_class: Option, - /// Only affects internal communication. Use mutual verification between Trino nodes - /// This setting controls: - /// - Which cert the servers should use to authenticate themselves against other servers - /// - Which ca.crt to use when validating the other server - #[serde( - default = "tls_secret_class_default", - skip_serializing_if = "Option::is_none" - )] - pub internal_secret_class: Option, -} + #[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct TrinoTls { + /// Only affects client connections. + /// This setting controls: + /// - If TLS encryption is used at all + /// - Which cert the servers should use to authenticate themselves against the client + #[serde( + default = "tls_secret_class_default", + skip_serializing_if = "Option::is_none" + )] + pub server_secret_class: Option, + /// Only affects internal communication. Use mutual verification between Trino nodes + /// This setting controls: + /// - Which cert the servers should use to authenticate themselves against other servers + /// - Which ca.crt to use when validating the other server + #[serde( + default = "tls_secret_class_default", + skip_serializing_if = "Option::is_none" + )] + pub internal_secret_class: Option, + } -#[derive(Clone, Debug, Default, JsonSchema, PartialEq, Fragment)] -#[fragment_attrs( - derive( - Clone, - Debug, - Default, - Deserialize, - Merge, - JsonSchema, - PartialEq, - Serialize - ), - serde(rename_all = "camelCase") -)] -pub struct TrinoStorageConfig { - #[fragment_attrs(serde(default))] - pub data: PvcConfig, -} + #[derive(Clone, Debug, Default, JsonSchema, PartialEq, Fragment)] + #[fragment_attrs( + derive( + Clone, + Debug, + Default, + Deserialize, + Merge, + JsonSchema, + PartialEq, + Serialize + ), + serde(rename_all = "camelCase") + )] + pub struct TrinoStorageConfig { + #[fragment_attrs(serde(default))] + pub data: PvcConfig, + } -#[derive(Clone, Default, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct TrinoClusterStatus { - #[serde(default)] - pub conditions: Vec, + #[derive(Clone, Default, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct TrinoClusterStatus { + #[serde(default)] + pub conditions: Vec, + } } // TODO: Temporary solution until listener-operator is finished @@ -349,9 +351,9 @@ impl CurrentlySupportedListenerClasses { } } -impl Default for TrinoTls { +impl Default for v1alpha1::TrinoTls { fn default() -> Self { - TrinoTls { + v1alpha1::TrinoTls { server_secret_class: tls_secret_class_default(), internal_secret_class: tls_secret_class_default(), } @@ -395,9 +397,9 @@ impl TrinoRole { /// Metadata about a rolegroup pub fn rolegroup_ref( &self, - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, group_name: impl Into, - ) -> RoleGroupRef { + ) -> RoleGroupRef { RoleGroupRef { cluster: ObjectRef::from_obj(trino), role: self.to_string(), @@ -441,12 +443,12 @@ pub enum Container { Trino, } -impl TrinoConfig { +impl v1alpha1::TrinoConfig { fn default_config( cluster_name: &str, role: &TrinoRole, - trino_catalogs: &[v1alpha1::TrinoCatalog], - ) -> TrinoConfigFragment { + trino_catalogs: &[catalog::v1alpha1::TrinoCatalog], + ) -> v1alpha1::TrinoConfigFragment { let (cpu_min, cpu_max, memory) = match role { TrinoRole::Coordinator => ("500m", "2", "4Gi"), TrinoRole::Worker => ("1", "4", "4Gi"), @@ -463,7 +465,7 @@ impl TrinoConfig { TrinoRole::Worker => Duration::from_days_unchecked(1), }; - TrinoConfigFragment { + v1alpha1::TrinoConfigFragment { logging: product_logging::spec::default_logging(), affinity: get_affinity(cluster_name, role, trino_catalogs), resources: ResourcesFragment { @@ -475,7 +477,7 @@ impl TrinoConfig { limit: Some(Quantity(memory.to_string())), runtime_limits: NoRuntimeLimitsFragment {}, }, - storage: TrinoStorageConfigFragment { + storage: v1alpha1::TrinoStorageConfigFragment { data: PvcConfigFragment { capacity: Some(Quantity("1Gi".to_owned())), storage_class: None, @@ -491,8 +493,8 @@ impl TrinoConfig { } } -impl Configuration for TrinoConfigFragment { - type Configurable = TrinoCluster; +impl Configuration for v1alpha1::TrinoConfigFragment { + type Configurable = v1alpha1::TrinoCluster; fn compute_env( &self, @@ -651,7 +653,7 @@ impl Configuration for TrinoConfigFragment { } } -impl TrinoCluster { +impl v1alpha1::TrinoCluster { /// Returns the name of the cluster and raises an Error if the name is not set. pub fn name_r(&self) -> Result { self.metadata.name.to_owned().context(NoNameSnafu) @@ -683,7 +685,8 @@ impl TrinoCluster { pub fn role( &self, role_variant: &TrinoRole, - ) -> Result<&Role, Error> { + ) -> Result<&Role, Error> + { match role_variant { TrinoRole::Coordinator => self.spec.coordinators.as_ref(), TrinoRole::Worker => self.spec.workers.as_ref(), @@ -696,8 +699,8 @@ impl TrinoCluster { /// Returns a reference to the role group. Raises an error if the role or role group are not defined. pub fn rolegroup( &self, - rolegroup_ref: &RoleGroupRef, - ) -> Result<&RoleGroup, Error> { + rolegroup_ref: &RoleGroupRef, + ) -> Result<&RoleGroup, Error> { let role_variant = TrinoRole::from_str(&rolegroup_ref.role).with_context(|_| UnknownTrinoRoleSnafu { role: rolegroup_ref.role.to_owned(), @@ -782,7 +785,7 @@ impl TrinoCluster { /// Check if any authentication settings are provided pub fn authentication_enabled(&self) -> bool { - let spec: &TrinoClusterSpec = &self.spec; + let spec: &v1alpha1::TrinoClusterSpec = &self.spec; !spec.cluster_config.authentication.is_empty() } @@ -796,7 +799,7 @@ impl TrinoCluster { /// Return user provided server TLS settings pub fn get_server_tls(&self) -> Option<&str> { - let spec: &TrinoClusterSpec = &self.spec; + let spec: &v1alpha1::TrinoClusterSpec = &self.spec; spec.cluster_config.tls.server_secret_class.as_deref() } @@ -807,7 +810,7 @@ impl TrinoCluster { /// Return user provided internal TLS settings. pub fn get_internal_tls(&self) -> Option<&str> { - let spec: &TrinoClusterSpec = &self.spec; + let spec: &v1alpha1::TrinoClusterSpec = &self.spec; spec.cluster_config.tls.internal_secret_class.as_deref() } @@ -839,11 +842,12 @@ impl TrinoCluster { pub fn merged_config( &self, role: &TrinoRole, - rolegroup_ref: &RoleGroupRef, - trino_catalogs: &[v1alpha1::TrinoCatalog], - ) -> Result { + rolegroup_ref: &RoleGroupRef, + trino_catalogs: &[catalog::v1alpha1::TrinoCatalog], + ) -> Result { // Initialize the result with all default values as baseline - let conf_defaults = TrinoConfig::default_config(&self.name_any(), role, trino_catalogs); + let conf_defaults = + v1alpha1::TrinoConfig::default_config(&self.name_any(), role, trino_catalogs); let role = self.role(role)?; @@ -866,7 +870,7 @@ impl TrinoCluster { } } -impl HasStatusCondition for TrinoCluster { +impl HasStatusCondition for v1alpha1::TrinoCluster { fn conditions(&self) -> Vec { match &self.status { Some(status) => status.conditions.clone(), @@ -892,7 +896,8 @@ mod tests { clusterConfig: catalogLabelSelector: {} "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!(trino.get_server_tls(), Some(TLS_DEFAULT_SECRET_CLASS)); assert_eq!(trino.get_internal_tls(), Some(TLS_DEFAULT_SECRET_CLASS)); @@ -909,7 +914,8 @@ mod tests { tls: serverSecretClass: simple-trino-server-tls "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!(trino.get_server_tls(), Some("simple-trino-server-tls")); assert_eq!(trino.get_internal_tls(), Some(TLS_DEFAULT_SECRET_CLASS)); @@ -927,7 +933,8 @@ mod tests { serverSecretClass: null internalSecretClass: null "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!(trino.get_server_tls(), None); assert_eq!(trino.get_internal_tls(), None); @@ -944,7 +951,8 @@ mod tests { tls: internalSecretClass: simple-trino-internal-tls "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!(trino.get_server_tls(), Some(TLS_DEFAULT_SECRET_CLASS)); assert_eq!(trino.get_internal_tls(), Some("simple-trino-internal-tls")); } @@ -962,7 +970,8 @@ mod tests { clusterConfig: catalogLabelSelector: {} "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!(trino.get_internal_tls(), Some(TLS_DEFAULT_SECRET_CLASS)); assert_eq!(trino.get_server_tls(), Some(TLS_DEFAULT_SECRET_CLASS)); @@ -979,7 +988,8 @@ mod tests { tls: internalSecretClass: simple-trino-internal-tls "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!(trino.get_internal_tls(), Some("simple-trino-internal-tls")); assert_eq!(trino.get_server_tls(), Some(TLS_DEFAULT_SECRET_CLASS)); @@ -997,7 +1007,8 @@ mod tests { serverSecretClass: simple-trino-server-tls internalSecretClass: null "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!(trino.get_internal_tls(), None); assert_eq!(trino.get_server_tls(), Some("simple-trino-server-tls")); } @@ -1015,7 +1026,8 @@ mod tests { clusterConfig: catalogLabelSelector: {} "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!( trino.min_worker_graceful_shutdown_timeout(), DEFAULT_WORKER_GRACEFUL_SHUTDOWN_TIMEOUT @@ -1041,7 +1053,8 @@ mod tests { default: replicas: 1 "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!( trino.min_worker_graceful_shutdown_timeout(), Duration::from_hours_unchecked(42) @@ -1075,7 +1088,8 @@ mod tests { config: gracefulShutdownTimeout: 7d "#; - let trino: TrinoCluster = serde_yaml::from_str(input).expect("illegal test input"); + let trino: v1alpha1::TrinoCluster = + serde_yaml::from_str(input).expect("illegal test input"); assert_eq!( trino.min_worker_graceful_shutdown_timeout(), Duration::from_minutes_unchecked(5) diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index 583c1101..f064889a 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -34,7 +34,7 @@ use stackable_operator::{ use crate::{ controller::{FULL_CONTROLLER_NAME, OPERATOR_NAME}, - crd::{catalog::v1alpha1, TrinoCluster, APP_NAME}, + crd::{v1alpha1, APP_NAME}, }; mod built_info { @@ -53,8 +53,8 @@ async fn main() -> anyhow::Result<()> { let opts = Opts::parse(); match opts.cmd { Command::Crd => { - TrinoCluster::print_yaml_schema(built_info::PKG_VERSION)?; - v1alpha1::TrinoCatalog::print_yaml_schema(built_info::PKG_VERSION)?; + v1alpha1::TrinoCluster::print_yaml_schema(built_info::PKG_VERSION)?; + crd::catalog::v1alpha1::TrinoCatalog::print_yaml_schema(built_info::PKG_VERSION)?; } Command::Run(ProductOperatorRun { product_config, @@ -94,7 +94,7 @@ async fn main() -> anyhow::Result<()> { )); let cluster_controller = Controller::new( - watch_namespace.get_api::>(&client), + watch_namespace.get_api::>(&client), watcher::Config::default(), ); let catalog_cluster_store = Arc::new(cluster_controller.store()); @@ -115,7 +115,8 @@ async fn main() -> anyhow::Result<()> { ) .shutdown_on_signal() .watches( - watch_namespace.get_api::>(&client), + watch_namespace + .get_api::>(&client), watcher::Config::default(), move |catalog| { // TODO: Filter clusters more precisely based on the catalogLabelSelector to avoid unnecessary reconciles @@ -173,7 +174,7 @@ async fn main() -> anyhow::Result<()> { } fn references_authentication_class( - trino: &DeserializeGuard, + trino: &DeserializeGuard, authentication_class: &DeserializeGuard, ) -> bool { let Ok(trino) = &trino.0 else { diff --git a/rust/operator-binary/src/operations/graceful_shutdown.rs b/rust/operator-binary/src/operations/graceful_shutdown.rs index e36fe661..77f3329a 100644 --- a/rust/operator-binary/src/operations/graceful_shutdown.rs +++ b/rust/operator-binary/src/operations/graceful_shutdown.rs @@ -10,8 +10,7 @@ use stackable_operator::{ }; use crate::crd::{ - TrinoCluster, TrinoConfig, TrinoRole, WORKER_GRACEFUL_SHUTDOWN_SAFETY_OVERHEAD, - WORKER_SHUTDOWN_GRACE_PERIOD, + v1alpha1, TrinoRole, WORKER_GRACEFUL_SHUTDOWN_SAFETY_OVERHEAD, WORKER_SHUTDOWN_GRACE_PERIOD, }; #[derive(Debug, Snafu)] @@ -23,7 +22,7 @@ pub enum Error { } pub fn graceful_shutdown_config_properties( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, role: &TrinoRole, ) -> BTreeMap> { match role { @@ -47,9 +46,9 @@ pub fn graceful_shutdown_config_properties( } pub fn add_graceful_shutdown_config( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, role: &TrinoRole, - merged_config: &TrinoConfig, + merged_config: &v1alpha1::TrinoConfig, pod_builder: &mut PodBuilder, trino_builder: &mut ContainerBuilder, ) -> Result<(), Error> { diff --git a/rust/operator-binary/src/operations/pdb.rs b/rust/operator-binary/src/operations/pdb.rs index d4110e30..4e47602b 100644 --- a/rust/operator-binary/src/operations/pdb.rs +++ b/rust/operator-binary/src/operations/pdb.rs @@ -8,7 +8,7 @@ use stackable_operator::{ use crate::{ controller::{CONTROLLER_NAME, OPERATOR_NAME}, - crd::{TrinoCluster, TrinoRole, APP_NAME}, + crd::{v1alpha1, TrinoRole, APP_NAME}, }; #[derive(Snafu, Debug)] @@ -28,7 +28,7 @@ pub enum Error { pub async fn add_pdbs( pdb: &PdbConfig, - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, role: &TrinoRole, client: &Client, cluster_resources: &mut ClusterResources, diff --git a/rust/operator-binary/src/product_logging.rs b/rust/operator-binary/src/product_logging.rs index 08d5d6a0..b41db3a4 100644 --- a/rust/operator-binary/src/product_logging.rs +++ b/rust/operator-binary/src/product_logging.rs @@ -14,7 +14,7 @@ use stackable_operator::{ }; use strum::Display; -use crate::crd::{Container, TrinoCluster}; +use crate::crd::{v1alpha1, Container}; #[derive(Snafu, Debug)] pub enum Error { @@ -66,7 +66,7 @@ impl From for TrinoLogLevel { /// Return the address of the Vector aggregator if the corresponding ConfigMap name is given in the /// cluster spec pub async fn resolve_vector_aggregator_address( - trino: &TrinoCluster, + trino: &v1alpha1::TrinoCluster, client: &Client, ) -> Result> { let vector_aggregator_address = if let Some(vector_aggregator_config_map_name) = &trino @@ -115,7 +115,7 @@ pub fn get_log_properties(logging: &Logging) -> Option { /// Return the vector toml configuration pub fn get_vector_toml( - rolegroup: &RoleGroupRef, + rolegroup: &RoleGroupRef, vector_aggregator_address: Option<&str>, logging: &Logging, ) -> Result> { From 5fd88d96366125f1da25c5ee05b4399befe76b11 Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Mon, 24 Feb 2025 15:59:45 +0100 Subject: [PATCH 7/9] fix rustdoc references --- rust/operator-binary/src/controller.rs | 2 +- rust/operator-binary/src/crd/discovery.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index a2533288..27c08b36 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -1,4 +1,4 @@ -//! Ensures that `Pod`s are configured and running for each [`TrinoCluster`] +//! Ensures that `Pod`s are configured and running for each [`v1alpha1::TrinoCluster`] use std::{ collections::{BTreeMap, HashMap}, convert::Infallible, diff --git a/rust/operator-binary/src/crd/discovery.rs b/rust/operator-binary/src/crd/discovery.rs index 871f7de8..70b89579 100644 --- a/rust/operator-binary/src/crd/discovery.rs +++ b/rust/operator-binary/src/crd/discovery.rs @@ -2,7 +2,7 @@ use stackable_operator::utils::cluster_info::KubernetesClusterInfo; use crate::crd::{HTTPS_PORT, HTTP_PORT}; -/// Reference to a single `Pod` that is a component of a [`crate::TrinoCluster`] +/// Reference to a single `Pod` that is a component of a [`crate::crd::v1alpha1::TrinoCluster`] #[derive(Clone, Debug, Eq, PartialEq)] pub struct TrinoPodRef { pub namespace: String, From cdc58bc54a61a0faba1375af2b0d90173c5a036d Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Tue, 25 Feb 2025 10:52:07 +0100 Subject: [PATCH 8/9] review feedback --- rust/operator-binary/src/crd/catalog/mod.rs | 1 + rust/operator-binary/src/main.rs | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/rust/operator-binary/src/crd/catalog/mod.rs b/rust/operator-binary/src/crd/catalog/mod.rs index 5f2a9046..2f154454 100644 --- a/rust/operator-binary/src/crd/catalog/mod.rs +++ b/rust/operator-binary/src/crd/catalog/mod.rs @@ -49,6 +49,7 @@ pub mod versioned { /// The `connector` defines which connector is used. pub connector: TrinoCatalogConnector, #[serde(default)] + /// The `configOverrides` allow overriding arbitrary Trino settings. /// For example, for Hive you could add `hive.metastore.username: trino`. pub config_overrides: HashMap, diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index f064889a..5c17d2f7 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -29,12 +29,13 @@ use stackable_operator::{ ResourceExt, }, logging::controller::report_controller_reconciled, - CustomResourceExt, + shared::yaml::SerializeOptions, + YamlSchema, }; use crate::{ controller::{FULL_CONTROLLER_NAME, OPERATOR_NAME}, - crd::{v1alpha1, APP_NAME}, + crd::{catalog::TrinoCatalog, v1alpha1, TrinoCluster, APP_NAME}, }; mod built_info { @@ -53,8 +54,10 @@ async fn main() -> anyhow::Result<()> { let opts = Opts::parse(); match opts.cmd { Command::Crd => { - v1alpha1::TrinoCluster::print_yaml_schema(built_info::PKG_VERSION)?; - crd::catalog::v1alpha1::TrinoCatalog::print_yaml_schema(built_info::PKG_VERSION)?; + TrinoCluster::merged_crd(TrinoCluster::V1Alpha1)? + .print_yaml_schema(built_info::PKG_VERSION, SerializeOptions::default())?; + TrinoCatalog::merged_crd(TrinoCatalog::V1Alpha1)? + .print_yaml_schema(built_info::PKG_VERSION, SerializeOptions::default())?; } Command::Run(ProductOperatorRun { product_config, From 1ed647756527238b874abc230ba3d57d7ba61407 Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Tue, 25 Feb 2025 11:01:55 +0100 Subject: [PATCH 9/9] review feedback (part 2) --- rust/operator-binary/src/crd/catalog/mod.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/rust/operator-binary/src/crd/catalog/mod.rs b/rust/operator-binary/src/crd/catalog/mod.rs index 2f154454..ac26569b 100644 --- a/rust/operator-binary/src/crd/catalog/mod.rs +++ b/rust/operator-binary/src/crd/catalog/mod.rs @@ -86,12 +86,9 @@ pub enum TrinoCatalogConnector { #[cfg(test)] mod tests { - use stackable_operator::kube::CustomResourceExt; - - use super::*; - + use crate::crd::catalog::TrinoCatalog; #[test] fn test_crd_generation() { - v1alpha1::TrinoCatalog::crd(); + TrinoCatalog::merged_crd(TrinoCatalog::V1Alpha1).unwrap(); } }