From 46a5ef41759c3af7131f50732ca5194eefeb18b4 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 10 Feb 2025 12:01:17 +0100 Subject: [PATCH 1/6] chore: Remove separate CRD crate --- Cargo.lock | 16 -------------- Cargo.toml | 2 +- rust/crd/Cargo.toml | 22 ------------------- rust/operator-binary/Cargo.toml | 2 -- rust/operator-binary/src/config/jvm.rs | 6 +++-- rust/operator-binary/src/config/mod.rs | 11 +++++----- rust/operator-binary/src/controller.rs | 16 +++++++------- .../src/crd}/affinity.rs | 2 +- .../src/crd}/authentication.rs | 0 .../lib.rs => operator-binary/src/crd/mod.rs} | 6 ++--- .../src => operator-binary/src/crd}/tls.rs | 0 rust/operator-binary/src/main.rs | 18 +++++++-------- .../src/operations/graceful_shutdown.rs | 3 ++- rust/operator-binary/src/operations/pdb.rs | 7 ++++-- rust/operator-binary/src/product_logging.rs | 5 +++-- .../operator-binary/src/reporting_task/mod.rs | 14 ++++++------ .../src/security/authentication.rs | 6 +++-- rust/operator-binary/src/security/mod.rs | 3 ++- rust/operator-binary/src/security/oidc.rs | 9 +++----- .../src/security/sensitive_key.rs | 3 ++- rust/operator-binary/src/security/tls.rs | 3 +-- 21 files changed, 60 insertions(+), 94 deletions(-) delete mode 100644 rust/crd/Cargo.toml rename rust/{crd/src => operator-binary/src/crd}/affinity.rs (98%) rename rust/{crd/src => operator-binary/src/crd}/authentication.rs (100%) rename rust/{crd/src/lib.rs => operator-binary/src/crd/mod.rs} (99%) rename rust/{crd/src => operator-binary/src/crd}/tls.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 3bbc1ced..f9a2a9cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2329,21 +2329,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "stackable-nifi-crd" -version = "0.0.0-dev" -dependencies = [ - "rand", - "serde", - "serde_json", - "serde_yaml", - "snafu 0.8.5", - "stackable-operator", - "strum", - "tracing", - "xml-rs", -] - [[package]] name = "stackable-nifi-operator" version = "0.0.0-dev" @@ -2364,7 +2349,6 @@ dependencies = [ "serde_json", "serde_yaml", "snafu 0.8.5", - "stackable-nifi-crd", "stackable-operator", "strum", "tokio", diff --git a/Cargo.toml b/Cargo.toml index d22b6a11..c21fa087 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 9c081ecd..00000000 --- a/rust/crd/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "stackable-nifi-crd" -description = "Contains the Apache NiFi CRD structs and utilities" -version.workspace = true -authors.workspace = true -license.workspace = true -edition.workspace = true -repository.workspace = true -publish = false - -[dependencies] -rand.workspace = true -serde.workspace = true -serde_json.workspace = true -snafu.workspace = true -stackable-operator.workspace = true -strum.workspace = true -tracing.workspace = true -xml-rs.workspace = true - -[dev-dependencies] -serde_yaml.workspace = true diff --git a/rust/operator-binary/Cargo.toml b/rust/operator-binary/Cargo.toml index 253ac54b..e7874620 100644 --- a/rust/operator-binary/Cargo.toml +++ b/rust/operator-binary/Cargo.toml @@ -9,8 +9,6 @@ repository.workspace = true publish = false [dependencies] -stackable-nifi-crd = { path = "../crd" } - anyhow.workspace = true clap.workspace = true const_format.workspace = true diff --git a/rust/operator-binary/src/config/jvm.rs b/rust/operator-binary/src/config/jvm.rs index 723d728a..f9d3c25c 100644 --- a/rust/operator-binary/src/config/jvm.rs +++ b/rust/operator-binary/src/config/jvm.rs @@ -1,11 +1,13 @@ use snafu::{OptionExt, ResultExt, Snafu}; -use stackable_nifi_crd::{NifiConfig, NifiConfigFragment}; use stackable_operator::{ memory::{BinaryMultiple, MemoryQuantity}, role_utils::{self, GenericRoleConfig, JavaCommonConfig, JvmArgumentOverrides, Role}, }; -use super::{JVM_SECURITY_PROPERTIES_FILE, NIFI_CONFIG_DIRECTORY}; +use crate::{ + config::{JVM_SECURITY_PROPERTIES_FILE, NIFI_CONFIG_DIRECTORY}, + crd::{NifiConfig, NifiConfigFragment}, +}; // Part of memory resources allocated for Java heap const JAVA_HEAP_FACTOR: f32 = 0.8; diff --git a/rust/operator-binary/src/config/mod.rs b/rust/operator-binary/src/config/mod.rs index c4a660ca..f4d98dda 100644 --- a/rust/operator-binary/src/config/mod.rs +++ b/rust/operator-binary/src/config/mod.rs @@ -6,10 +6,6 @@ use std::{ use jvm::build_merged_jvm_config; use product_config::{types::PropertyNameKind, ProductConfigManager}; use snafu::{ResultExt, Snafu}; -use stackable_nifi_crd::{ - NifiCluster, NifiConfig, NifiConfigFragment, NifiRole, NifiSpec, NifiStorageConfig, HTTPS_PORT, - PROTOCOL_PORT, -}; use stackable_operator::{ commons::resources::Resources, memory::MemoryQuantity, @@ -22,6 +18,10 @@ use stackable_operator::{ use strum::{Display, EnumIter}; use crate::{ + crd::{ + NifiCluster, NifiConfig, NifiConfigFragment, NifiRole, NifiSpec, NifiStorageConfig, + HTTPS_PORT, PROTOCOL_PORT, + }, operations::graceful_shutdown::graceful_shutdown_config_properties, security::{ authentication::{ @@ -667,10 +667,9 @@ fn storage_quantity_to_nifi(quantity: MemoryQuantity) -> String { #[cfg(test)] mod tests { use indoc::indoc; - use stackable_nifi_crd::NifiCluster; use super::*; - use crate::config::build_bootstrap_conf; + use crate::{config::build_bootstrap_conf, crd::NifiCluster}; #[test] fn test_build_bootstrap_conf_defaults() { diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index 1443fb0f..c2ff3acb 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -13,12 +13,6 @@ use product_config::{ ProductConfigManager, }; use snafu::{OptionExt, ResultExt, Snafu}; -use stackable_nifi_crd::{ - authentication::AuthenticationClassResolved, Container, CurrentlySupportedListenerClasses, - NifiCluster, NifiConfig, NifiConfigFragment, NifiRole, NifiStatus, APP_NAME, BALANCE_PORT, - BALANCE_PORT_NAME, HTTPS_PORT, HTTPS_PORT_NAME, METRICS_PORT, METRICS_PORT_NAME, PROTOCOL_PORT, - PROTOCOL_PORT_NAME, STACKABLE_LOG_CONFIG_DIR, STACKABLE_LOG_DIR, -}; use stackable_operator::{ builder::{ self, @@ -84,6 +78,12 @@ use crate::{ validated_product_config, NifiRepository, JVM_SECURITY_PROPERTIES_FILE, NIFI_BOOTSTRAP_CONF, NIFI_CONFIG_DIRECTORY, NIFI_PROPERTIES, NIFI_STATE_MANAGEMENT_XML, }, + crd::{ + authentication::AuthenticationClassResolved, Container, CurrentlySupportedListenerClasses, + NifiCluster, NifiConfig, NifiConfigFragment, NifiRole, NifiStatus, APP_NAME, BALANCE_PORT, + BALANCE_PORT_NAME, HTTPS_PORT, HTTPS_PORT_NAME, METRICS_PORT, METRICS_PORT_NAME, + PROTOCOL_PORT, PROTOCOL_PORT_NAME, STACKABLE_LOG_CONFIG_DIR, STACKABLE_LOG_DIR, + }, operations::{graceful_shutdown::add_graceful_shutdown_config, pdb::add_pdbs}, product_logging::{extend_role_group_config_map, resolve_vector_aggregator_address}, reporting_task::{self, build_maybe_reporting_task, build_reporting_task_service_name}, @@ -251,7 +251,7 @@ pub enum Error { }, #[snafu(display("failed to resolve and merge config for role and role group"))] - FailedToResolveConfig { source: stackable_nifi_crd::Error }, + FailedToResolveConfig { source: crate::crd::Error }, #[snafu(display("failed to resolve the Vector aggregator address"))] ResolveVectorAggregatorAddress { @@ -295,7 +295,7 @@ pub enum Error { #[snafu(display("Failed to resolve NiFi Authentication Configuration"))] FailedResolveNifiAuthenticationConfig { - source: stackable_nifi_crd::authentication::Error, + source: crate::crd::authentication::Error, }, #[snafu(display("failed to create PodDisruptionBudget"))] diff --git a/rust/crd/src/affinity.rs b/rust/operator-binary/src/crd/affinity.rs similarity index 98% rename from rust/crd/src/affinity.rs rename to rust/operator-binary/src/crd/affinity.rs index 48c44529..abf58a01 100644 --- a/rust/crd/src/affinity.rs +++ b/rust/operator-binary/src/crd/affinity.rs @@ -3,7 +3,7 @@ use stackable_operator::{ k8s_openapi::api::core::v1::PodAntiAffinity, }; -use crate::{NifiRole, APP_NAME}; +use crate::crd::{NifiRole, APP_NAME}; pub fn get_affinity(cluster_name: &str, role: &NifiRole) -> StackableAffinityFragment { StackableAffinityFragment { 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/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 5e294dc1..8b87660b 100644 --- a/rust/crd/src/lib.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -289,14 +289,14 @@ impl Default for NifiSensitiveKeyAlgorithm { #[serde(rename_all = "camelCase")] pub enum StoreType { #[strum(serialize = "JKS")] - JKS, + Jks, #[strum(serialize = "PKCS12")] - PKCS12, + Pkcs12, } impl Default for StoreType { fn default() -> Self { - Self::JKS + Self::Jks } } diff --git a/rust/crd/src/tls.rs b/rust/operator-binary/src/crd/tls.rs similarity index 100% rename from rust/crd/src/tls.rs rename to rust/operator-binary/src/crd/tls.rs diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index 2592a74d..b8a3f24a 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -1,15 +1,7 @@ -mod config; -mod controller; -mod operations; -mod product_logging; -mod reporting_task; -mod security; - use std::sync::Arc; use clap::{crate_description, crate_version, Parser}; use futures::stream::StreamExt; -use stackable_nifi_crd::NifiCluster; use stackable_operator::{ cli::{Command, ProductOperatorRun}, commons::authentication::AuthenticationClass, @@ -29,7 +21,15 @@ use stackable_operator::{ CustomResourceExt, }; -use crate::controller::NIFI_FULL_CONTROLLER_NAME; +use crate::{controller::NIFI_FULL_CONTROLLER_NAME, crd::NifiCluster}; + +mod config; +mod controller; +mod crd; +mod operations; +mod product_logging; +mod reporting_task; +mod security; const OPERATOR_NAME: &str = "nifi.stackable.tech"; diff --git a/rust/operator-binary/src/operations/graceful_shutdown.rs b/rust/operator-binary/src/operations/graceful_shutdown.rs index 5aa1b448..8e4ae0ac 100644 --- a/rust/operator-binary/src/operations/graceful_shutdown.rs +++ b/rust/operator-binary/src/operations/graceful_shutdown.rs @@ -1,9 +1,10 @@ use std::collections::BTreeMap; use snafu::{ResultExt, Snafu}; -use stackable_nifi_crd::NifiConfig; use stackable_operator::builder::pod::PodBuilder; +use crate::crd::NifiConfig; + #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("Failed to set terminationGracePeriod"))] diff --git a/rust/operator-binary/src/operations/pdb.rs b/rust/operator-binary/src/operations/pdb.rs index 6e9c5f8d..3bfc84b8 100644 --- a/rust/operator-binary/src/operations/pdb.rs +++ b/rust/operator-binary/src/operations/pdb.rs @@ -1,11 +1,14 @@ use snafu::{ResultExt, Snafu}; -use stackable_nifi_crd::{NifiCluster, NifiRole, APP_NAME}; use stackable_operator::{ builder::pdb::PodDisruptionBudgetBuilder, client::Client, cluster_resources::ClusterResources, commons::pdb::PdbConfig, kube::ResourceExt, }; -use crate::{controller::NIFI_CONTROLLER_NAME, OPERATOR_NAME}; +use crate::{ + controller::NIFI_CONTROLLER_NAME, + crd::{NifiCluster, NifiRole, APP_NAME}, + OPERATOR_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 f0641786..814a32e0 100644 --- a/rust/operator-binary/src/product_logging.rs +++ b/rust/operator-binary/src/product_logging.rs @@ -1,5 +1,4 @@ use snafu::{OptionExt, ResultExt, Snafu}; -use stackable_nifi_crd::{Container, NifiCluster, MAX_NIFI_LOG_FILES_SIZE, STACKABLE_LOG_DIR}; use stackable_operator::{ builder::configmap::ConfigMapBuilder, client::Client, @@ -13,6 +12,8 @@ use stackable_operator::{ role_utils::RoleGroupRef, }; +use crate::crd::{Container, NifiCluster, MAX_NIFI_LOG_FILES_SIZE, STACKABLE_LOG_DIR}; + #[derive(Snafu, Debug)] pub enum Error { #[snafu(display("object has no namespace"))] @@ -28,7 +29,7 @@ pub enum Error { cm_name: String, }, #[snafu(display("crd validation failure"))] - CrdValidationFailure { source: stackable_nifi_crd::Error }, + CrdValidationFailure { source: crate::crd::Error }, #[snafu(display("vectorAggregatorConfigMapName must be set"))] MissingVectorAggregatorAddress, } diff --git a/rust/operator-binary/src/reporting_task/mod.rs b/rust/operator-binary/src/reporting_task/mod.rs index 6fff0b4a..615939fc 100644 --- a/rust/operator-binary/src/reporting_task/mod.rs +++ b/rust/operator-binary/src/reporting_task/mod.rs @@ -25,9 +25,6 @@ use std::collections::BTreeMap; use snafu::{OptionExt, ResultExt, Snafu}; -use stackable_nifi_crd::{ - NifiCluster, NifiRole, APP_NAME, HTTPS_PORT, HTTPS_PORT_NAME, METRICS_PORT, -}; use stackable_operator::{ builder::{ self, @@ -51,10 +48,13 @@ use stackable_operator::{ utils::cluster_info::KubernetesClusterInfo, }; -use super::controller::{build_recommended_labels, NIFI_UID}; -use crate::security::{ - authentication::{NifiAuthenticationConfig, STACKABLE_ADMIN_USERNAME}, - build_tls_volume, +use crate::{ + controller::{build_recommended_labels, NIFI_UID}, + crd::{NifiCluster, NifiRole, APP_NAME, HTTPS_PORT, HTTPS_PORT_NAME, METRICS_PORT}, + security::{ + authentication::{NifiAuthenticationConfig, STACKABLE_ADMIN_USERNAME}, + build_tls_volume, + }, }; const REPORTING_TASK_CERT_VOLUME_NAME: &str = "tls"; diff --git a/rust/operator-binary/src/security/authentication.rs b/rust/operator-binary/src/security/authentication.rs index 1048b841..b6c5afc9 100644 --- a/rust/operator-binary/src/security/authentication.rs +++ b/rust/operator-binary/src/security/authentication.rs @@ -1,6 +1,5 @@ use indoc::{formatdoc, indoc}; use snafu::{OptionExt, ResultExt, Snafu}; -use stackable_nifi_crd::{authentication::AuthenticationClassResolved, NifiCluster}; use stackable_operator::{ builder::{ self, @@ -14,7 +13,10 @@ use stackable_operator::{ k8s_openapi::api::core::v1::{KeyToPath, SecretVolumeSource, Volume}, }; -use super::oidc::build_oidc_admin_password_secret_name; +use crate::{ + crd::{authentication::AuthenticationClassResolved, NifiCluster}, + security::oidc::build_oidc_admin_password_secret_name, +}; pub const STACKABLE_ADMIN_USERNAME: &str = "admin"; diff --git a/rust/operator-binary/src/security/mod.rs b/rust/operator-binary/src/security/mod.rs index 34decae3..b3deca81 100644 --- a/rust/operator-binary/src/security/mod.rs +++ b/rust/operator-binary/src/security/mod.rs @@ -1,10 +1,11 @@ use snafu::{ResultExt, Snafu}; -use stackable_nifi_crd::NifiCluster; use stackable_operator::{ builder::pod::volume::SecretFormat, client::Client, k8s_openapi::api::core::v1::Volume, time::Duration, }; +use crate::crd::NifiCluster; + pub mod authentication; pub mod oidc; pub mod sensitive_key; diff --git a/rust/operator-binary/src/security/oidc.rs b/rust/operator-binary/src/security/oidc.rs index b01f100f..f9513e84 100644 --- a/rust/operator-binary/src/security/oidc.rs +++ b/rust/operator-binary/src/security/oidc.rs @@ -2,7 +2,6 @@ use std::collections::BTreeMap; use rand::{distributions::Alphanumeric, Rng}; use snafu::{OptionExt, ResultExt, Snafu}; -use stackable_nifi_crd::NifiCluster; use stackable_operator::{ builder::meta::ObjectMetaBuilder, client::Client, @@ -14,9 +13,7 @@ use stackable_operator::{ kube::{runtime::reflector::ObjectRef, ResourceExt}, }; -use super::authentication::STACKABLE_ADMIN_USERNAME; - -const STACKABLE_OIDC_ADMIN_PASSWORD_KEY: &str = STACKABLE_ADMIN_USERNAME; +use crate::{crd::NifiCluster, security::authentication::STACKABLE_ADMIN_USERNAME}; type Result = std::result::Result; @@ -31,7 +28,7 @@ pub enum Error { }, #[snafu(display( - "found existing admin password secret {secret:?}, but the key {STACKABLE_OIDC_ADMIN_PASSWORD_KEY} is missing", + "found existing admin password secret {secret:?}, but the key {STACKABLE_ADMIN_USERNAME} is missing", ))] MissingAdminPasswordKey { secret: ObjectRef }, @@ -63,7 +60,7 @@ pub(crate) async fn check_or_generate_oidc_admin_password( .data .iter() .flat_map(|data| data.keys()) - .any(|key| key == STACKABLE_OIDC_ADMIN_PASSWORD_KEY); + .any(|key| key == STACKABLE_ADMIN_USERNAME); if admin_password_present { Ok(false) diff --git a/rust/operator-binary/src/security/sensitive_key.rs b/rust/operator-binary/src/security/sensitive_key.rs index 6c79516b..96cd25f5 100644 --- a/rust/operator-binary/src/security/sensitive_key.rs +++ b/rust/operator-binary/src/security/sensitive_key.rs @@ -2,12 +2,13 @@ use std::collections::BTreeMap; use rand::{distributions::Alphanumeric, Rng}; use snafu::{OptionExt, ResultExt, Snafu}; -use stackable_nifi_crd::NifiCluster; use stackable_operator::{ builder::meta::ObjectMetaBuilder, client::Client, k8s_openapi::api::core::v1::Secret, kube::ResourceExt, }; +use crate::crd::NifiCluster; + type Result = std::result::Result; #[derive(Snafu, Debug)] diff --git a/rust/operator-binary/src/security/tls.rs b/rust/operator-binary/src/security/tls.rs index f46860e3..69c80b51 100644 --- a/rust/operator-binary/src/security/tls.rs +++ b/rust/operator-binary/src/security/tls.rs @@ -1,12 +1,11 @@ use snafu::{ResultExt, Snafu}; -use stackable_nifi_crd::NifiCluster; use stackable_operator::{ builder::pod::volume::{SecretFormat, SecretOperatorVolumeSourceBuilder, VolumeBuilder}, k8s_openapi::api::core::v1::Volume, time::Duration, }; -use crate::security::authentication::STACKABLE_TLS_STORE_PASSWORD; +use crate::{crd::NifiCluster, security::authentication::STACKABLE_TLS_STORE_PASSWORD}; pub const KEYSTORE_VOLUME_NAME: &str = "keystore"; pub const KEYSTORE_NIFI_CONTAINER_MOUNT: &str = "/stackable/keystore"; From 80c5c534af8f229fa0d7527db1bcef3b4b0f88a7 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 10 Feb 2025 12:08:41 +0100 Subject: [PATCH 2/6] chore: Remove unused constant --- rust/operator-binary/src/crd/mod.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index 8b87660b..4a53e75d 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -27,7 +27,7 @@ use stackable_operator::{ apimachinery::pkg::api::resource::Quantity, }, kube::{runtime::reflector::ObjectRef, CustomResource, ResourceExt}, - memory::{BinaryMultiple, MemoryQuantity}, + memory::MemoryQuantity, product_config_utils::{self, Configuration}, product_logging::{self, spec::Logging}, role_utils::{GenericRoleConfig, JavaCommonConfig, Role, RoleGroupRef}, @@ -56,14 +56,7 @@ pub const METRICS_PORT: u16 = 8081; pub const STACKABLE_LOG_DIR: &str = "/stackable/log"; pub const STACKABLE_LOG_CONFIG_DIR: &str = "/stackable/log_config"; -pub const MAX_NIFI_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity { - value: 10.0, - unit: BinaryMultiple::Mebi, -}; -pub const MAX_PREPARE_LOG_FILE_SIZE: MemoryQuantity = MemoryQuantity { - value: 1.0, - unit: BinaryMultiple::Mebi, -}; +pub const MAX_NIFI_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity::from_mebi(10.0); const DEFAULT_NODE_GRACEFUL_SHUTDOWN_TIMEOUT: Duration = Duration::from_minutes_unchecked(5); From f359d1bd82d77ad491ed34673dc298eac4cb9f45 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 10 Feb 2025 12:32:40 +0100 Subject: [PATCH 3/6] chore: Version NifiCluster --- Cargo.lock | 298 +++- Cargo.nix | 1340 ++++++++++++++--- Cargo.toml | 6 +- crate-hashes.json | 3 + deploy/helm/nifi-operator/crds/crds.yaml | 2 +- rust/operator-binary/Cargo.toml | 6 +- rust/operator-binary/src/config/mod.rs | 13 +- rust/operator-binary/src/controller.rs | 47 +- rust/operator-binary/src/crd/affinity.rs | 4 +- .../operator-binary/src/crd/authentication.rs | 8 +- rust/operator-binary/src/crd/mod.rs | 76 +- rust/operator-binary/src/main.rs | 13 +- rust/operator-binary/src/operations/pdb.rs | 4 +- rust/operator-binary/src/product_logging.rs | 6 +- .../operator-binary/src/reporting_task/mod.rs | 12 +- .../src/security/authentication.rs | 4 +- rust/operator-binary/src/security/mod.rs | 11 +- rust/operator-binary/src/security/oidc.rs | 6 +- .../src/security/sensitive_key.rs | 4 +- rust/operator-binary/src/security/tls.rs | 4 +- 20 files changed, 1533 insertions(+), 334 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f9a2a9cd..7af358b6 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" @@ -780,7 +804,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", @@ -793,6 +817,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" @@ -1171,7 +1205,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.2", ] [[package]] @@ -1201,6 +1235,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" @@ -1237,18 +1280,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" @@ -1262,6 +1332,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" @@ -1272,6 +1353,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" @@ -1286,17 +1381,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]] @@ -1319,9 +1475,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", @@ -1337,6 +1493,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" @@ -1346,8 +1520,8 @@ dependencies = [ "chrono", "form_urlencoded", "http", - "json-patch", - "k8s-openapi", + "json-patch 3.0.1", + "k8s-openapi 0.24.0", "schemars", "serde", "serde-value", @@ -1355,6 +1529,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" @@ -1368,6 +1555,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" @@ -1381,12 +1596,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", @@ -1856,7 +2071,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags", + "bitflags 2.8.0", ] [[package]] @@ -2102,7 +2317,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", @@ -2115,7 +2330,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", @@ -2350,6 +2565,7 @@ dependencies = [ "serde_yaml", "snafu 0.8.5", "stackable-operator", + "stackable-versioned", "strum", "tokio", "tracing", @@ -2370,9 +2586,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", @@ -2410,13 +2626,37 @@ 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", "snafu 0.8.5", ] +[[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" @@ -2708,7 +2948,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", @@ -2860,6 +3100,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 32104b49..8d82ff6c 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-nifi-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-nifi-crd" = rec { - packageId = "stackable-nifi-crd"; - build = internal.buildRustCrateWithFeatures { - packageId = "stackable-nifi-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-nifi-operator" = rec { packageId = "stackable-nifi-operator"; build = internal.buildRustCrateWithFeatures { @@ -655,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"; @@ -1086,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"; @@ -1767,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"; @@ -2220,7 +2276,7 @@ rec { dependencies = [ { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } { name = "libc"; @@ -2261,7 +2317,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"; @@ -3531,7 +3626,7 @@ rec { } { name = "hashbrown"; - packageId = "hashbrown"; + packageId = "hashbrown 0.15.2"; usesDefaultFeatures = false; } ]; @@ -3605,6 +3700,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"; @@ -3686,7 +3802,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"; @@ -3698,7 +3855,7 @@ rec { dependencies = [ { name = "jsonptr"; - packageId = "jsonptr"; + packageId = "jsonptr 0.6.3"; } { name = "serde"; @@ -3727,7 +3884,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"; @@ -3760,7 +3958,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"; @@ -3794,12 +4029,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 " @@ -3841,62 +4076,149 @@ 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" ]; + "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" ]; @@ -3919,11 +4241,83 @@ rec { }; resolvedDefaultFeatures = [ "client" "config" "derive" "jsonpatch" "kube-client" "kube-derive" "kube-runtime" "runtime" "rustls-tls" ]; }; - "kube-client" = rec { - crateName = "kube-client"; + "kube 0.98.0" = rec { + crateName = "kube"; version = "0.98.0"; edition = "2021"; - sha256 = "1jd06xwhnmzrzqrfwq7jlmmxl7dvaygmchjx363zmlgvrlwasd4x"; + 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 " @@ -4010,17 +4404,17 @@ rec { } { name = "jsonpath-rust"; - packageId = "jsonpath-rust"; + packageId = "jsonpath-rust 0.5.1"; optional = true; } { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; usesDefaultFeatures = false; } { name = "kube-core"; - packageId = "kube-core"; + packageId = "kube-core 0.96.0"; } { name = "pem"; @@ -4058,7 +4452,7 @@ rec { } { name = "thiserror"; - packageId = "thiserror 2.0.11"; + packageId = "thiserror 1.0.69"; } { name = "tokio"; @@ -4098,14 +4492,9 @@ rec { usesDefaultFeatures = false; features = [ "async-await" ]; } - { - name = "hyper"; - packageId = "hyper"; - features = [ "server" ]; - } { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; usesDefaultFeatures = false; features = [ "latest" ]; } @@ -4166,12 +4555,487 @@ rec { }; 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" = rec { - crateName = "kube-core"; - version = "0.98.0"; + "kube-client 0.98.0" = rec { + crateName = "kube-client"; + version = "0.98.0"; + edition = "2021"; + sha256 = "1jd06xwhnmzrzqrfwq7jlmmxl7dvaygmchjx363zmlgvrlwasd4x"; + 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.7.5"; + optional = true; + } + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; + usesDefaultFeatures = false; + } + { + name = "kube-core"; + packageId = "kube-core 0.98.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 2.0.11"; + } + { + 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 = "hyper"; + packageId = "hyper"; + features = [ "server" ]; + } + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.24.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-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 0.98.0" = rec { + crateName = "kube-core"; + version = "0.98.0"; + edition = "2021"; + sha256 = "1wwnsn1wk7bd2jiv9iw8446j0bczagqv1lc4wy88l5wa505q7alp"; + 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 3.0.1"; + optional = true; + } + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.24.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 2.0.11"; + } + ]; + devDependencies = [ + { + name = "k8s-openapi"; + packageId = "k8s-openapi 0.24.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-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"; + sha256 = "0n46p76pvm3plsnbm57c2j76r1i6hwslxsaj345pxdvn8255sx1p"; + 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-runtime 0.96.0" = rec { + crateName = "kube-runtime"; + version = "0.96.0"; edition = "2021"; - sha256 = "1wwnsn1wk7bd2jiv9iw8446j0bczagqv1lc4wy88l5wa505q7alp"; - libName = "kube_core"; + sha256 = "0i5xr5i9xf44fwih1pvypr35sq30pcw979m9sbqnb3m9zzvg3yyk"; + libName = "kube_runtime"; authors = [ "clux " "Natalie Klestrup Röijezon " @@ -4179,42 +5043,71 @@ rec { ]; dependencies = [ { - name = "chrono"; - packageId = "chrono"; + 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 = [ "now" ]; + features = [ "Clone" "Debug" "Hash" "PartialEq" ]; } { - name = "form_urlencoded"; - packageId = "form_urlencoded"; + name = "futures"; + packageId = "futures 0.3.31"; + usesDefaultFeatures = false; + features = [ "async-await" ]; } { - name = "http"; - packageId = "http"; + name = "hashbrown"; + packageId = "hashbrown 0.14.5"; } { name = "json-patch"; - packageId = "json-patch"; - optional = true; + packageId = "json-patch 2.0.0"; + } + { + name = "jsonptr"; + packageId = "jsonptr 0.4.7"; } { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; usesDefaultFeatures = false; } { - name = "schemars"; - packageId = "schemars"; - optional = true; + name = "kube-client"; + packageId = "kube-client 0.96.0"; + usesDefaultFeatures = false; + features = [ "jsonpatch" "client" ]; } { - name = "serde"; - packageId = "serde"; - features = [ "derive" ]; + name = "parking_lot"; + packageId = "parking_lot"; } { - name = "serde-value"; - packageId = "serde-value"; + name = "pin-project"; + packageId = "pin-project"; + } + { + name = "serde"; + packageId = "serde"; } { name = "serde_json"; @@ -4222,65 +5115,45 @@ rec { } { name = "thiserror"; - packageId = "thiserror 2.0.11"; + packageId = "thiserror 1.0.69"; } - ]; - devDependencies = [ { - name = "k8s-openapi"; - packageId = "k8s-openapi"; - usesDefaultFeatures = false; - features = [ "latest" ]; + name = "tokio"; + packageId = "tokio"; + features = [ "time" ]; } - ]; - 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-derive" = rec { - crateName = "kube-derive"; - version = "0.98.0"; - edition = "2021"; - sha256 = "0n46p76pvm3plsnbm57c2j76r1i6hwslxsaj345pxdvn8255sx1p"; - procMacro = true; - libName = "kube_derive"; - authors = [ - "clux " - "Natalie Klestrup Röijezon " - "kazk " - ]; - dependencies = [ { - name = "darling"; - packageId = "darling"; + name = "tokio-util"; + packageId = "tokio-util"; + features = [ "time" ]; } { - name = "proc-macro2"; - packageId = "proc-macro2"; + name = "tracing"; + packageId = "tracing"; } + ]; + devDependencies = [ { - name = "quote"; - packageId = "quote"; + name = "k8s-openapi"; + packageId = "k8s-openapi 0.23.0"; + usesDefaultFeatures = false; + features = [ "latest" ]; } { name = "serde_json"; packageId = "serde_json"; } { - name = "syn"; - packageId = "syn 2.0.96"; - features = [ "extra-traits" ]; + name = "tokio"; + packageId = "tokio"; + features = [ "full" "test-util" ]; } ]; - + features = { + "unstable-runtime" = [ "unstable-runtime-subscribe" "unstable-runtime-stream-control" "unstable-runtime-reconcile-on" ]; + }; }; - "kube-runtime" = rec { + "kube-runtime 0.98.0" = rec { crateName = "kube-runtime"; version = "0.98.0"; edition = "2021"; @@ -4326,7 +5199,7 @@ rec { } { name = "hashbrown"; - packageId = "hashbrown"; + packageId = "hashbrown 0.15.2"; } { name = "hostname"; @@ -4334,20 +5207,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" ]; } @@ -4389,7 +5262,7 @@ rec { devDependencies = [ { name = "k8s-openapi"; - packageId = "k8s-openapi"; + packageId = "k8s-openapi 0.24.0"; usesDefaultFeatures = false; features = [ "latest" ]; } @@ -5766,7 +6639,7 @@ rec { dependencies = [ { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } ]; features = { @@ -6547,7 +7420,7 @@ rec { dependencies = [ { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } { name = "core-foundation"; @@ -6594,7 +7467,7 @@ rec { dependencies = [ { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } { name = "core-foundation"; @@ -7227,59 +8100,6 @@ rec { }; resolvedDefaultFeatures = [ "alloc" ]; }; - "stackable-nifi-crd" = rec { - crateName = "stackable-nifi-crd"; - version = "0.0.0-dev"; - edition = "2021"; - src = lib.cleanSourceWith { filter = sourceFilter; src = ./rust/crd; }; - libName = "stackable_nifi_crd"; - authors = [ - "Stackable GmbH " - ]; - dependencies = [ - { - name = "rand"; - packageId = "rand"; - } - { - 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"; - } - { - name = "xml-rs"; - packageId = "xml-rs"; - } - ]; - devDependencies = [ - { - name = "serde_yaml"; - packageId = "serde_yaml"; - } - ]; - - }; "stackable-nifi-operator" = rec { crateName = "stackable-nifi-operator"; version = "0.0.0-dev"; @@ -7350,14 +8170,15 @@ rec { name = "snafu"; packageId = "snafu 0.8.5"; } - { - name = "stackable-nifi-crd"; - packageId = "stackable-nifi-crd"; - } { name = "stackable-operator"; packageId = "stackable-operator"; } + { + name = "stackable-versioned"; + packageId = "stackable-versioned"; + features = [ "k8s" ]; + } { name = "strum"; packageId = "strum"; @@ -7453,17 +8274,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" ]; } @@ -7608,7 +8429,7 @@ rec { dependencies = [ { name = "kube"; - packageId = "kube"; + packageId = "kube 0.98.0"; usesDefaultFeatures = false; features = [ "client" "jsonpatch" "runtime" "derive" "rustls-tls" ]; } @@ -7632,6 +8453,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"; @@ -8585,7 +9506,7 @@ rec { } { name = "bitflags"; - packageId = "bitflags"; + packageId = "bitflags 2.8.0"; } { name = "bytes"; @@ -9177,6 +10098,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 c21fa087..1fb3685d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,10 @@ edition = "2021" repository = "https://github.com/stackabletech/nifi-operator" [workspace.dependencies] +stackable-versioned = { git = "https://github.com/stackabletech/operator-rs.git", features = ["k8s"], tag = "stackable-versioned-0.5.0" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.85.0" } +product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" } + anyhow = "1.0" built = { version = "0.7", features = ["chrono", "git2"] } clap = "4.5" @@ -18,7 +22,6 @@ fnv = "1.0" futures = { version = "0.3", features = ["compat"] } indoc = "2.0" pin-project = "1.1" -product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" } rand = "0.8" rstest = "0.24" semver = "1.0" @@ -26,7 +29,6 @@ serde = { version = "1.0", features = ["derive"] } 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" } strum = { version = "0.26", features = ["derive"] } tokio = { version = "1.40", features = ["full"] } tracing = "0.1" 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/deploy/helm/nifi-operator/crds/crds.yaml b/deploy/helm/nifi-operator/crds/crds.yaml index 99175501..7511f55a 100644 --- a/deploy/helm/nifi-operator/crds/crds.yaml +++ b/deploy/helm/nifi-operator/crds/crds.yaml @@ -20,7 +20,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: Auto-generated derived type for NifiSpec via `CustomResource` + description: Auto-generated derived type for NifiClusterSpec via `CustomResource` properties: spec: description: A NiFi cluster stacklet. This resource is managed by the Stackable operator for Apache NiFi. Find more information on how to use it and the resources that the operator generates in the [operator documentation](https://docs.stackable.tech/home/nightly/nifi/). diff --git a/rust/operator-binary/Cargo.toml b/rust/operator-binary/Cargo.toml index e7874620..5e86f6c5 100644 --- a/rust/operator-binary/Cargo.toml +++ b/rust/operator-binary/Cargo.toml @@ -9,6 +9,10 @@ repository.workspace = true publish = false [dependencies] +stackable-versioned.workspace = true +stackable-operator.workspace = true +product-config.workspace = true + anyhow.workspace = true clap.workspace = true const_format.workspace = true @@ -21,8 +25,6 @@ semver.workspace = true serde.workspace = true serde_json.workspace = true snafu.workspace = true -stackable-operator.workspace = true -product-config.workspace = true strum.workspace = true tokio.workspace = true tracing.workspace = true diff --git a/rust/operator-binary/src/config/mod.rs b/rust/operator-binary/src/config/mod.rs index f4d98dda..6be7bba3 100644 --- a/rust/operator-binary/src/config/mod.rs +++ b/rust/operator-binary/src/config/mod.rs @@ -19,8 +19,8 @@ use strum::{Display, EnumIter}; use crate::{ crd::{ - NifiCluster, NifiConfig, NifiConfigFragment, NifiRole, NifiSpec, NifiStorageConfig, - HTTPS_PORT, PROTOCOL_PORT, + v1alpha1, NifiConfig, NifiConfigFragment, NifiRole, NifiStorageConfig, HTTPS_PORT, + PROTOCOL_PORT, }, operations::graceful_shutdown::graceful_shutdown_config_properties, security::{ @@ -135,7 +135,7 @@ pub fn build_bootstrap_conf( /// Create the NiFi nifi.properties pub fn build_nifi_properties( - spec: &NifiSpec, + spec: &v1alpha1::NifiClusterSpec, resource_config: &Resources, proxy_hosts: &str, auth_config: &NifiAuthenticationConfig, @@ -616,7 +616,7 @@ pub fn build_state_management_xml() -> String { /// * `product_config` - The product config to validate and complement the user config. /// pub fn validated_product_config( - resource: &NifiCluster, + resource: &v1alpha1::NifiCluster, version: &str, role: &Role, product_config: &ProductConfigManager, @@ -669,7 +669,7 @@ mod tests { use indoc::indoc; use super::*; - use crate::{config::build_bootstrap_conf, crd::NifiCluster}; + use crate::{config::build_bootstrap_conf, crd::v1alpha1}; #[test] fn test_build_bootstrap_conf_defaults() { @@ -791,7 +791,8 @@ mod tests { } fn construct_bootstrap_conf(nifi_cluster: &str) -> String { - let nifi: NifiCluster = serde_yaml::from_str(nifi_cluster).expect("illegal test input"); + let nifi: v1alpha1::NifiCluster = + serde_yaml::from_str(nifi_cluster).expect("illegal test input"); let nifi_role = NifiRole::Node; let role = nifi.spec.nodes.as_ref().unwrap(); diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index c2ff3acb..a10c7d13 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -79,10 +79,11 @@ use crate::{ NIFI_BOOTSTRAP_CONF, NIFI_CONFIG_DIRECTORY, NIFI_PROPERTIES, NIFI_STATE_MANAGEMENT_XML, }, crd::{ - authentication::AuthenticationClassResolved, Container, CurrentlySupportedListenerClasses, - NifiCluster, NifiConfig, NifiConfigFragment, NifiRole, NifiStatus, APP_NAME, BALANCE_PORT, - BALANCE_PORT_NAME, HTTPS_PORT, HTTPS_PORT_NAME, METRICS_PORT, METRICS_PORT_NAME, - PROTOCOL_PORT, PROTOCOL_PORT_NAME, STACKABLE_LOG_CONFIG_DIR, STACKABLE_LOG_DIR, + authentication::AuthenticationClassResolved, v1alpha1, Container, + CurrentlySupportedListenerClasses, NifiConfig, NifiConfigFragment, NifiRole, NifiStatus, + APP_NAME, BALANCE_PORT, BALANCE_PORT_NAME, HTTPS_PORT, HTTPS_PORT_NAME, METRICS_PORT, + METRICS_PORT_NAME, PROTOCOL_PORT, PROTOCOL_PORT_NAME, STACKABLE_LOG_CONFIG_DIR, + STACKABLE_LOG_DIR, }, operations::{graceful_shutdown::add_graceful_shutdown_config, pdb::add_pdbs}, product_logging::{extend_role_group_config_map, resolve_vector_aggregator_address}, @@ -159,13 +160,13 @@ 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("object has no nodes defined"))] @@ -174,13 +175,13 @@ pub enum Error { #[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 create ReportingTask service"))] @@ -210,7 +211,7 @@ pub enum Error { #[snafu(display("Failed to find any nodes in cluster {obj_ref}",))] MissingNodes { source: stackable_operator::client::Error, - obj_ref: ObjectRef, + obj_ref: ObjectRef, }, #[snafu(display("Failed to find service {obj_ref}"))] @@ -235,7 +236,7 @@ pub enum Error { BuildProductConfig { #[snafu(source(from(config::Error, Box::new)))] source: Box, - rolegroup: RoleGroupRef, + rolegroup: RoleGroupRef, }, #[snafu(display("illegal container name: [{container_name}]"))] @@ -247,7 +248,7 @@ pub enum Error { #[snafu(display("failed to validate resources for {rolegroup}"))] ResourceValidation { source: fragment::ValidationError, - rolegroup: RoleGroupRef, + rolegroup: RoleGroupRef, }, #[snafu(display("failed to resolve and merge config for role and role group"))] @@ -365,7 +366,7 @@ pub enum VersionChangeState { } pub async fn reconcile_nifi( - nifi: Arc>, + nifi: Arc>, ctx: Arc, ) -> Result { tracing::info!("Starting reconcile"); @@ -686,7 +687,7 @@ pub async fn reconcile_nifi( /// The node-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_node_role_service( - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, resolved_product_image: &ResolvedProductImage, ) -> Result { let role_name = NifiRole::Node.to_string(); @@ -732,11 +733,11 @@ pub fn build_node_role_service( /// The rolegroup [`ConfigMap`] configures the rolegroup based on the configuration given by the administrator #[allow(clippy::too_many_arguments)] async fn build_node_rolegroup_config_map( - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, resolved_product_image: &ResolvedProductImage, nifi_auth_config: &NifiAuthenticationConfig, role: &Role, - rolegroup: &RoleGroupRef, + rolegroup: &RoleGroupRef, rolegroup_config: &HashMap>, merged_config: &NifiConfig, vector_aggregator_address: Option<&str>, @@ -846,9 +847,9 @@ async fn build_node_rolegroup_config_map( /// /// This is mostly useful for internal communication between peers, or for clients that perform client-side load balancing. fn build_node_rolegroup_service( - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, resolved_product_image: &ResolvedProductImage, - rolegroup: &RoleGroupRef, + rolegroup: &RoleGroupRef, ) -> Result { Ok(Service { metadata: ObjectMetaBuilder::new() @@ -903,10 +904,10 @@ const USERDATA_MOUNTPOINT: &str = "/stackable/userdata"; /// corresponding [`Service`] (from [`build_node_rolegroup_service`]). #[allow(clippy::too_many_arguments)] async fn build_node_rolegroup_statefulset( - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, resolved_product_image: &ResolvedProductImage, cluster_info: &KubernetesClusterInfo, - rolegroup_ref: &RoleGroupRef, + rolegroup_ref: &RoleGroupRef, role: &Role, rolegroup_config: &HashMap>, merged_config: &NifiConfig, @@ -1476,7 +1477,7 @@ fn zookeeper_env_var(name: &str, configmap_name: &str) -> EnvVar { async fn get_proxy_hosts( client: &Client, - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, nifi_service: &Service, ) -> Result { let host_header_check = nifi.spec.cluster_config.host_header_check.clone(); @@ -1541,7 +1542,7 @@ async fn get_proxy_hosts( } pub fn error_policy( - _obj: Arc>, + _obj: Arc>, error: &Error, _ctx: Arc, ) -> Action { @@ -1554,11 +1555,11 @@ pub fn error_policy( } pub fn build_recommended_labels<'a>( - owner: &'a NifiCluster, + owner: &'a v1alpha1::NifiCluster, app_version: &'a str, role: &'a str, role_group: &'a str, -) -> ObjectLabels<'a, NifiCluster> { +) -> ObjectLabels<'a, v1alpha1::NifiCluster> { ObjectLabels { owner, app_name: APP_NAME, diff --git a/rust/operator-binary/src/crd/affinity.rs b/rust/operator-binary/src/crd/affinity.rs index abf58a01..b3a87d37 100644 --- a/rust/operator-binary/src/crd/affinity.rs +++ b/rust/operator-binary/src/crd/affinity.rs @@ -32,7 +32,7 @@ mod tests { }; use super::*; - use crate::NifiCluster; + use crate::crd::v1alpha1; #[test] fn test_affinity_defaults() { @@ -57,7 +57,7 @@ mod tests { replicas: 1 "#; let deserializer = serde_yaml::Deserializer::from_str(input); - let nifi: NifiCluster = + let nifi: v1alpha1::NifiCluster = serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap(); let merged_config = nifi.merged_config(&NifiRole::Node, "default").unwrap(); diff --git a/rust/operator-binary/src/crd/authentication.rs b/rust/operator-binary/src/crd/authentication.rs index b2441fd0..077df5a1 100644 --- a/rust/operator-binary/src/crd/authentication.rs +++ b/rust/operator-binary/src/crd/authentication.rs @@ -10,7 +10,7 @@ use stackable_operator::{ kube::{runtime::reflector::ObjectRef, ResourceExt}, }; -use crate::NifiCluster; +use crate::crd::v1alpha1; #[derive(Snafu, Debug)] pub enum Error { @@ -55,13 +55,13 @@ pub enum AuthenticationClassResolved { Oidc { provider: oidc::AuthenticationProvider, oidc: oidc::ClientAuthenticationOptions<()>, - nifi: NifiCluster, + nifi: v1alpha1::NifiCluster, }, } impl AuthenticationClassResolved { pub async fn from( - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, client: &Client, ) -> Result> { let resolve_auth_class = |auth_details: ClientAuthenticationDetails| async move { @@ -72,7 +72,7 @@ impl AuthenticationClassResolved { /// Retrieve all provided `AuthenticationClass` references. pub async fn resolve( - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, resolve_auth_class: impl Fn(ClientAuthenticationDetails) -> R, ) -> Result> where diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index 4a53e75d..1977f4db 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -39,6 +39,7 @@ use stackable_operator::{ crds::{raw_object_list_schema, raw_object_schema}, }, }; +use stackable_versioned::versioned; use strum::Display; use tls::NifiTls; @@ -75,39 +76,40 @@ pub enum Error { FragmentValidationFailure { source: ValidationError }, } -/// A NiFi cluster stacklet. This resource is managed by the Stackable operator for Apache NiFi. -/// Find more information on how to use it and the resources that the operator generates in the -/// [operator documentation](DOCS_BASE_URL_PLACEHOLDER/nifi/). -#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] -#[kube( - group = "nifi.stackable.tech", - version = "v1alpha1", - kind = "NifiCluster", - shortname = "nifi", - status = "NifiStatus", - namespaced, - crates( - kube_core = "stackable_operator::kube::core", - k8s_openapi = "stackable_operator::k8s_openapi", - schemars = "stackable_operator::schemars" - ) -)] -#[serde(rename_all = "camelCase")] -pub struct NifiSpec { - /// 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: NifiClusterConfig, - - // no doc - docs in Role struct. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub nodes: Option>, - - // no doc - docs in ProductImage struct. - pub image: ProductImage, - - // no doc - docs in ClusterOperation struct. - #[serde(default)] - pub cluster_operation: ClusterOperation, +#[versioned(version(name = "v1alpha1"))] +pub mod versioned { + /// A NiFi cluster stacklet. This resource is managed by the Stackable operator for Apache NiFi. + /// Find more information on how to use it and the resources that the operator generates in the + /// [operator documentation](DOCS_BASE_URL_PLACEHOLDER/nifi/). + #[versioned(k8s( + group = "nifi.stackable.tech", + shortname = "nifi", + status = "NifiStatus", + 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 NifiClusterSpec { + /// 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: NifiClusterConfig, + + // no doc - docs in Role struct. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub nodes: Option>, + + // no doc - docs in ProductImage struct. + pub image: ProductImage, + + // no doc - docs in ClusterOperation struct. + #[serde(default)] + pub cluster_operation: ClusterOperation, + } } #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] @@ -344,7 +346,7 @@ pub struct NifiStatus { pub conditions: Vec, } -impl HasStatusCondition for NifiCluster { +impl HasStatusCondition for v1alpha1::NifiCluster { fn conditions(&self) -> Vec { match &self.status { Some(status) => status.conditions.clone(), @@ -463,7 +465,7 @@ impl NifiConfig { } impl Configuration for NifiConfigFragment { - type Configurable = NifiCluster; + type Configurable = v1alpha1::NifiCluster; fn compute_env( &self, @@ -538,7 +540,7 @@ pub struct NifiStorageConfig { pub state_repo: PvcConfig, } -impl NifiCluster { +impl v1alpha1::NifiCluster { /// The name of the role-level load-balanced Kubernetes `Service` pub fn node_role_service_name(&self) -> String { self.name_any() @@ -555,7 +557,7 @@ impl NifiCluster { } /// Metadata about a metastore rolegroup - pub fn node_rolegroup_ref(&self, group_name: impl Into) -> RoleGroupRef { + pub fn node_rolegroup_ref(&self, group_name: impl Into) -> RoleGroupRef { RoleGroupRef { cluster: ObjectRef::from_obj(self), role: NifiRole::Node.to_string(), diff --git a/rust/operator-binary/src/main.rs b/rust/operator-binary/src/main.rs index b8a3f24a..15661712 100644 --- a/rust/operator-binary/src/main.rs +++ b/rust/operator-binary/src/main.rs @@ -18,10 +18,14 @@ use stackable_operator::{ }, }, logging::controller::report_controller_reconciled, - CustomResourceExt, + shared::yaml::SerializeOptions, + YamlSchema, }; -use crate::{controller::NIFI_FULL_CONTROLLER_NAME, crd::NifiCluster}; +use crate::{ + controller::NIFI_FULL_CONTROLLER_NAME, + crd::{v1alpha1, NifiCluster}, +}; mod config; mod controller; @@ -48,7 +52,8 @@ struct Opts { async fn main() -> anyhow::Result<()> { let opts = Opts::parse(); match opts.cmd { - Command::Crd => NifiCluster::print_yaml_schema(built_info::PKG_VERSION)?, + Command::Crd => NifiCluster::merged_crd(NifiCluster::V1Alpha1)? + .print_yaml_schema(built_info::PKG_VERSION, SerializeOptions::default())?, Command::Run(ProductOperatorRun { product_config, watch_namespace, @@ -89,7 +94,7 @@ async fn main() -> anyhow::Result<()> { )); let nifi_controller = Controller::new( - watch_namespace.get_api::>(&client), + watch_namespace.get_api::>(&client), watcher::Config::default(), ); diff --git a/rust/operator-binary/src/operations/pdb.rs b/rust/operator-binary/src/operations/pdb.rs index 3bfc84b8..44d5c353 100644 --- a/rust/operator-binary/src/operations/pdb.rs +++ b/rust/operator-binary/src/operations/pdb.rs @@ -6,7 +6,7 @@ use stackable_operator::{ use crate::{ controller::NIFI_CONTROLLER_NAME, - crd::{NifiCluster, NifiRole, APP_NAME}, + crd::{v1alpha1, NifiRole, APP_NAME}, OPERATOR_NAME, }; @@ -26,7 +26,7 @@ pub enum Error { pub async fn add_pdbs( pdb: &PdbConfig, - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, role: &NifiRole, 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 814a32e0..40301b17 100644 --- a/rust/operator-binary/src/product_logging.rs +++ b/rust/operator-binary/src/product_logging.rs @@ -12,7 +12,7 @@ use stackable_operator::{ role_utils::RoleGroupRef, }; -use crate::crd::{Container, NifiCluster, MAX_NIFI_LOG_FILES_SIZE, STACKABLE_LOG_DIR}; +use crate::crd::{v1alpha1, Container, MAX_NIFI_LOG_FILES_SIZE, STACKABLE_LOG_DIR}; #[derive(Snafu, Debug)] pub enum Error { @@ -61,7 +61,7 @@ const ADDITONAL_LOGBACK_CONFIG: &str = r#" String { +pub fn build_oidc_admin_password_secret_name(nifi: &v1alpha1::NifiCluster) -> String { format!("{}-oidc-admin-password", nifi.name_any()) } diff --git a/rust/operator-binary/src/security/sensitive_key.rs b/rust/operator-binary/src/security/sensitive_key.rs index 96cd25f5..74e93527 100644 --- a/rust/operator-binary/src/security/sensitive_key.rs +++ b/rust/operator-binary/src/security/sensitive_key.rs @@ -7,7 +7,7 @@ use stackable_operator::{ kube::ResourceExt, }; -use crate::crd::NifiCluster; +use crate::crd::v1alpha1; type Result = std::result::Result; @@ -31,7 +31,7 @@ pub enum Error { pub(crate) async fn check_or_generate_sensitive_key( client: &Client, - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, ) -> Result { let sensitive_config = &nifi.spec.cluster_config.sensitive_properties; let namespace: &str = &nifi.namespace().context(ObjectHasNoNamespaceSnafu)?; diff --git a/rust/operator-binary/src/security/tls.rs b/rust/operator-binary/src/security/tls.rs index 69c80b51..8559a4ef 100644 --- a/rust/operator-binary/src/security/tls.rs +++ b/rust/operator-binary/src/security/tls.rs @@ -5,7 +5,7 @@ use stackable_operator::{ time::Duration, }; -use crate::{crd::NifiCluster, security::authentication::STACKABLE_TLS_STORE_PASSWORD}; +use crate::{crd::v1alpha1, security::authentication::STACKABLE_TLS_STORE_PASSWORD}; pub const KEYSTORE_VOLUME_NAME: &str = "keystore"; pub const KEYSTORE_NIFI_CONTAINER_MOUNT: &str = "/stackable/keystore"; @@ -22,7 +22,7 @@ pub enum Error { } pub(crate) fn build_tls_volume( - nifi: &NifiCluster, + nifi: &v1alpha1::NifiCluster, volume_name: &str, service_scopes: Vec<&str>, secret_format: SecretFormat, From 4f960c32cc797f11254b44aa4d8bfb241d43da96 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 10 Feb 2025 12:43:32 +0100 Subject: [PATCH 4/6] docs: Fix invalid rustdoc reference --- rust/operator-binary/src/controller.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index a10c7d13..648feb1c 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -1,4 +1,5 @@ -//! Ensures that `Pod`s are configured and running for each [`NifiCluster`] +//! Ensures that `Pod`s are configured and running for each [`v1alpha1::NifiCluster`]. + use std::{ borrow::Cow, collections::{BTreeMap, HashMap, HashSet}, From 5fc98e9bd18ad9bdfc1becf3c1553f58e3dd1de0 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 10 Feb 2025 13:25:10 +0100 Subject: [PATCH 5/6] chore: Version NifiClusterConfig --- rust/operator-binary/src/crd/mod.rs | 112 ++++++++++++++-------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index 1977f4db..c8bf5468 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -97,7 +97,7 @@ pub mod versioned { pub struct NifiClusterSpec { /// 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: NifiClusterConfig, + pub cluster_config: v1alpha1::NifiClusterConfig, // no doc - docs in Role struct. #[serde(default, skip_serializing_if = "Option::is_none")] @@ -110,64 +110,64 @@ pub mod versioned { #[serde(default)] pub cluster_operation: ClusterOperation, } -} -#[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct NifiClusterConfig { - /// Authentication options for NiFi (required). - /// Read more about authentication in the [security documentation](DOCS_BASE_URL_PLACEHOLDER/nifi/usage_guide/security). - // We don't add `#[serde(default)]` here, as we require authentication - pub authentication: Vec, - - /// Configuration of allowed proxies e.g. load balancers or Kubernetes Ingress. Using a proxy that is not allowed by NiFi results - /// in a failed host header check. - #[serde(default)] - pub host_header_check: HostHeaderCheckConfig, + #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] + #[serde(rename_all = "camelCase")] + pub struct NifiClusterConfig { + /// Authentication options for NiFi (required). + /// Read more about authentication in the [security documentation](DOCS_BASE_URL_PLACEHOLDER/nifi/usage_guide/security). + // We don't add `#[serde(default)]` here, as we require authentication + pub authentication: Vec, + + /// Configuration of allowed proxies e.g. load balancers or Kubernetes Ingress. Using a proxy that is not allowed by NiFi results + /// in a failed host header check. + #[serde(default)] + pub host_header_check: HostHeaderCheckConfig, - /// TLS configuration options for the server. - #[serde(default)] - pub tls: NifiTls, - - // no doc - docs in NifiSensitivePropertiesConfig struct. - pub sensitive_properties: NifiSensitivePropertiesConfig, - - /// 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, - - /// NiFi requires a ZooKeeper cluster connection to run. - /// Provide the name of the ZooKeeper [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery) - /// here. When using the [Stackable operator for Apache ZooKeeper](DOCS_BASE_URL_PLACEHOLDER/zookeeper/) - /// to deploy a ZooKeeper cluster, this will simply be the name of your ZookeeperCluster resource. - pub zookeeper_config_map_name: String, - - /// Extra volumes similar to `.spec.volumes` on a Pod to mount into every container, this can be useful to for - /// example make client certificates, keytabs or similar things available to processors. These volumes will be - /// mounted into all pods at `/stackable/userdata/{volumename}`. - /// See also the [external files usage guide](DOCS_BASE_URL_PLACEHOLDER/nifi/usage_guide/extra-volumes). - #[serde(default, skip_serializing_if = "Vec::is_empty")] - #[schemars(schema_with = "raw_object_list_schema")] - pub extra_volumes: Vec, - - /// This field controls which type of Service the Operator creates for this NifiCluster: - /// - /// * cluster-internal: Use a ClusterIP service - /// - /// * external-unstable: Use a NodePort 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, + /// TLS configuration options for the server. + #[serde(default)] + pub tls: NifiTls, + + // no doc - docs in NifiSensitivePropertiesConfig struct. + pub sensitive_properties: NifiSensitivePropertiesConfig, + + /// 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, + + /// NiFi requires a ZooKeeper cluster connection to run. + /// Provide the name of the ZooKeeper [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery) + /// here. When using the [Stackable operator for Apache ZooKeeper](DOCS_BASE_URL_PLACEHOLDER/zookeeper/) + /// to deploy a ZooKeeper cluster, this will simply be the name of your ZookeeperCluster resource. + pub zookeeper_config_map_name: String, + + /// Extra volumes similar to `.spec.volumes` on a Pod to mount into every container, this can be useful to for + /// example make client certificates, keytabs or similar things available to processors. These volumes will be + /// mounted into all pods at `/stackable/userdata/{volumename}`. + /// See also the [external files usage guide](DOCS_BASE_URL_PLACEHOLDER/nifi/usage_guide/extra-volumes). + #[serde(default, skip_serializing_if = "Vec::is_empty")] + #[schemars(schema_with = "raw_object_list_schema")] + pub extra_volumes: Vec, + + /// This field controls which type of Service the Operator creates for this NifiCluster: + /// + /// * cluster-internal: Use a ClusterIP service + /// + /// * external-unstable: Use a NodePort 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, - // Docs are on the struct - #[serde(default)] - pub create_reporting_task_job: CreateReportingTaskJob, + // Docs are on the struct + #[serde(default)] + pub create_reporting_task_job: CreateReportingTaskJob, + } } #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] From 93ab2e826030631f67ea6a1f010b315b318ea804 Mon Sep 17 00:00:00 2001 From: Techassi Date: Mon, 10 Feb 2025 13:27:33 +0100 Subject: [PATCH 6/6] chore: Move NifiCluster impl blocks --- rust/operator-binary/src/crd/mod.rs | 204 ++++++++++++++-------------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index c8bf5468..983189a6 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -170,6 +170,108 @@ pub mod versioned { } } +impl HasStatusCondition for v1alpha1::NifiCluster { + fn conditions(&self) -> Vec { + match &self.status { + Some(status) => status.conditions.clone(), + None => vec![], + } + } +} + +impl v1alpha1::NifiCluster { + /// The name of the role-level load-balanced Kubernetes `Service` + pub fn node_role_service_name(&self) -> String { + self.name_any() + } + + /// The fully-qualified domain name of the role-level load-balanced Kubernetes `Service` + pub fn node_role_service_fqdn(&self, cluster_info: &KubernetesClusterInfo) -> Option { + Some(format!( + "{}.{}.svc.{}", + self.node_role_service_name(), + self.metadata.namespace.as_ref()?, + cluster_info.cluster_domain, + )) + } + + /// Metadata about a metastore rolegroup + pub fn node_rolegroup_ref(&self, group_name: impl Into) -> RoleGroupRef { + RoleGroupRef { + cluster: ObjectRef::from_obj(self), + role: NifiRole::Node.to_string(), + role_group: group_name.into(), + } + } + + pub fn role_config(&self, role: &NifiRole) -> Option<&GenericRoleConfig> { + match role { + NifiRole::Node => self.spec.nodes.as_ref().map(|n| &n.role_config), + } + } + + /// Return user provided server TLS settings + pub fn server_tls_secret_class(&self) -> &str { + &self.spec.cluster_config.tls.server_secret_class + } + + /// List all pods expected to form the cluster + /// + /// We try to predict the pods here rather than looking at the current cluster state in order to + /// avoid instance churn. + pub fn pods(&self) -> Result + '_, Error> { + let ns = self.metadata.namespace.clone().context(NoNamespaceSnafu)?; + Ok(self + .spec + .nodes + .iter() + .flat_map(|role| &role.role_groups) + // Order rolegroups consistently, to avoid spurious downstream rewrites + .collect::>() + .into_iter() + .flat_map(move |(rolegroup_name, rolegroup)| { + let rolegroup_ref = self.node_rolegroup_ref(rolegroup_name); + let ns = ns.clone(); + (0..rolegroup.replicas.unwrap_or(0)).map(move |i| PodRef { + namespace: ns.clone(), + role_group_service_name: rolegroup_ref.object_name(), + pod_name: format!("{}-{}", rolegroup_ref.object_name(), i), + }) + })) + } + + /// Retrieve and merge resource configs for role and role groups + pub fn merged_config(&self, role: &NifiRole, role_group: &str) -> Result { + // Initialize the result with all default values as baseline + let conf_defaults = NifiConfig::default_config(&self.name_any(), role); + + let role = self.spec.nodes.as_ref().context(MissingNifiRoleSnafu { + role: role.to_string(), + })?; + + // Retrieve role resource config + let mut conf_role = role.config.config.to_owned(); + + // Retrieve rolegroup specific resource config + let mut conf_rolegroup = role + .role_groups + .get(role_group) + .map(|rg| rg.config.config.clone()) + .unwrap_or_default(); + + // Merge more specific configs into default config + // Hierarchy is: + // 1. RoleGroup + // 2. Role + // 3. Default + conf_role.merge(&conf_defaults); + conf_rolegroup.merge(&conf_role); + + tracing::debug!("Merged config: {:?}", conf_rolegroup); + fragment::validate(conf_rolegroup).context(FragmentValidationFailureSnafu) + } +} + #[derive(Clone, Debug, Deserialize, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] pub struct HostHeaderCheckConfig { @@ -346,15 +448,6 @@ pub struct NifiStatus { pub conditions: Vec, } -impl HasStatusCondition for v1alpha1::NifiCluster { - fn conditions(&self) -> Vec { - match &self.status { - Some(status) => status.conditions.clone(), - None => vec![], - } - } -} - #[derive( Clone, Debug, @@ -540,99 +633,6 @@ pub struct NifiStorageConfig { pub state_repo: PvcConfig, } -impl v1alpha1::NifiCluster { - /// The name of the role-level load-balanced Kubernetes `Service` - pub fn node_role_service_name(&self) -> String { - self.name_any() - } - - /// The fully-qualified domain name of the role-level load-balanced Kubernetes `Service` - pub fn node_role_service_fqdn(&self, cluster_info: &KubernetesClusterInfo) -> Option { - Some(format!( - "{}.{}.svc.{}", - self.node_role_service_name(), - self.metadata.namespace.as_ref()?, - cluster_info.cluster_domain, - )) - } - - /// Metadata about a metastore rolegroup - pub fn node_rolegroup_ref(&self, group_name: impl Into) -> RoleGroupRef { - RoleGroupRef { - cluster: ObjectRef::from_obj(self), - role: NifiRole::Node.to_string(), - role_group: group_name.into(), - } - } - - pub fn role_config(&self, role: &NifiRole) -> Option<&GenericRoleConfig> { - match role { - NifiRole::Node => self.spec.nodes.as_ref().map(|n| &n.role_config), - } - } - - /// Return user provided server TLS settings - pub fn server_tls_secret_class(&self) -> &str { - &self.spec.cluster_config.tls.server_secret_class - } - - /// List all pods expected to form the cluster - /// - /// We try to predict the pods here rather than looking at the current cluster state in order to - /// avoid instance churn. - pub fn pods(&self) -> Result + '_, Error> { - let ns = self.metadata.namespace.clone().context(NoNamespaceSnafu)?; - Ok(self - .spec - .nodes - .iter() - .flat_map(|role| &role.role_groups) - // Order rolegroups consistently, to avoid spurious downstream rewrites - .collect::>() - .into_iter() - .flat_map(move |(rolegroup_name, rolegroup)| { - let rolegroup_ref = self.node_rolegroup_ref(rolegroup_name); - let ns = ns.clone(); - (0..rolegroup.replicas.unwrap_or(0)).map(move |i| PodRef { - namespace: ns.clone(), - role_group_service_name: rolegroup_ref.object_name(), - pod_name: format!("{}-{}", rolegroup_ref.object_name(), i), - }) - })) - } - - /// Retrieve and merge resource configs for role and role groups - pub fn merged_config(&self, role: &NifiRole, role_group: &str) -> Result { - // Initialize the result with all default values as baseline - let conf_defaults = NifiConfig::default_config(&self.name_any(), role); - - let role = self.spec.nodes.as_ref().context(MissingNifiRoleSnafu { - role: role.to_string(), - })?; - - // Retrieve role resource config - let mut conf_role = role.config.config.to_owned(); - - // Retrieve rolegroup specific resource config - let mut conf_rolegroup = role - .role_groups - .get(role_group) - .map(|rg| rg.config.config.clone()) - .unwrap_or_default(); - - // Merge more specific configs into default config - // Hierarchy is: - // 1. RoleGroup - // 2. Role - // 3. Default - conf_role.merge(&conf_defaults); - conf_rolegroup.merge(&conf_role); - - tracing::debug!("Merged config: {:?}", conf_rolegroup); - fragment::validate(conf_rolegroup).context(FragmentValidationFailureSnafu) - } -} - /// Reference to a single `Pod` that is a component of a [`NifiCluster`] /// Used for service discovery. // TODO: this should move to operator-rs