Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
319 changes: 273 additions & 46 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["rust/crd", "rust/operator-binary"]
members = ["rust/operator-binary"]
resolver = "2"

[workspace.package]
Expand All @@ -10,6 +10,12 @@ edition = "2021"
repository = "https://github.com/stackabletech/druid-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"
Expand All @@ -18,15 +24,13 @@ fnv = "1.0"
futures = { version = "0.3", features = ["compat"] }
indoc = "2.0"
openssl = "0.10"
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
pin-project = "1.1"
rstest = "0.24"
semver = "1.0"
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"
Expand Down
25 changes: 0 additions & 25 deletions rust/crd/Cargo.toml

This file was deleted.

6 changes: 3 additions & 3 deletions rust/operator-binary/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ repository.workspace = true
publish = false

[dependencies]
stackable-druid-crd = { path = "../crd" }
stackable-versioned.workspace = true
stackable-operator.workspace = true
product-config.workspace = true

anyhow.workspace = true
clap.workspace = true
Expand All @@ -23,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
Expand Down
10 changes: 5 additions & 5 deletions rust/operator-binary/src/authentication/ldap.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use std::collections::BTreeMap;

use snafu::ResultExt;
use stackable_druid_crd::security::{
add_cert_to_trust_store_cmd, STACKABLE_TLS_DIR, TLS_STORE_PASSWORD,
};
use stackable_operator::{
builder::pod::{container::ContainerBuilder, PodBuilder},
commons::authentication::ldap::AuthenticationProvider,
};

use crate::authentication::{
AddLdapVolumesSnafu, ConstructLdapEndpointUrlSnafu, Error, MissingLdapBindCredentialsSnafu,
use crate::{
authentication::{
AddLdapVolumesSnafu, ConstructLdapEndpointUrlSnafu, Error, MissingLdapBindCredentialsSnafu,
},
crd::security::{add_cert_to_trust_store_cmd, STACKABLE_TLS_DIR, TLS_STORE_PASSWORD},
};

fn add_authenticator_config(
Expand Down
22 changes: 14 additions & 8 deletions rust/operator-binary/src/authentication/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
use std::collections::BTreeMap;

use snafu::Snafu;
use stackable_druid_crd::{
authentication::{AuthenticationClassResolved, AuthenticationClassesResolved},
security::{ESCALATOR_INTERNAL_CLIENT_PASSWORD_ENV, INTERNAL_INITIAL_CLIENT_PASSWORD_ENV},
DruidCluster, DruidRole,
};
use stackable_operator::{
builder::pod::{container::ContainerBuilder, PodBuilder},
commons::{
Expand All @@ -20,11 +15,18 @@ use stackable_operator::{
k8s_openapi::api::core::v1::EnvVar,
};

use crate::{
crd::{
authentication::{AuthenticationClassResolved, AuthenticationClassesResolved},
security::{ESCALATOR_INTERNAL_CLIENT_PASSWORD_ENV, INTERNAL_INITIAL_CLIENT_PASSWORD_ENV},
v1alpha1, DruidRole,
},
internal_secret::{build_shared_internal_secret_name, env_var_from_secret},
};

pub mod ldap;
pub mod oidc;

use crate::internal_secret::{build_shared_internal_secret_name, env_var_from_secret};

type Result<T, E = Error> = std::result::Result<T, E>;

#[derive(Snafu, Debug)]
Expand Down Expand Up @@ -159,7 +161,11 @@ impl DruidAuthenticationConfig {
command
}

pub fn get_env_var_mounts(&self, druid: &DruidCluster, role: &DruidRole) -> Vec<EnvVar> {
pub fn get_env_var_mounts(
&self,
druid: &v1alpha1::DruidCluster,
role: &DruidRole,
) -> Vec<EnvVar> {
let mut envs = vec![];
let internal_secret_name = build_shared_internal_secret_name(druid);
envs.push(env_var_from_secret(
Expand Down
4 changes: 1 addition & 3 deletions rust/operator-binary/src/authentication/oidc.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use std::collections::BTreeMap;

use snafu::ResultExt;
use stackable_druid_crd::{
security::add_cert_to_jvm_trust_store_cmd, DruidRole, COOKIE_PASSPHRASE_ENV,
};
use stackable_operator::{
builder::pod::{container::ContainerBuilder, PodBuilder},
commons::authentication::oidc::{AuthenticationProvider, ClientAuthenticationOptions},
Expand All @@ -12,6 +9,7 @@ use stackable_operator::{

use crate::{
authentication::{AddOidcVolumesSnafu, ConstructOidcWellKnownUrlSnafu, Error},
crd::{security::add_cert_to_jvm_trust_store_cmd, DruidRole, COOKIE_PASSPHRASE_ENV},
internal_secret::env_var_from_secret,
};

Expand Down
5 changes: 3 additions & 2 deletions rust/operator-binary/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use indoc::formatdoc;
use snafu::{ResultExt, Snafu};
use stackable_druid_crd::{
use stackable_operator::memory::MemoryQuantity;

use crate::crd::{
DruidRole, JVM_SECURITY_PROPERTIES_FILE, LOG4J2_CONFIG, RW_CONFIG_DIRECTORY,
STACKABLE_TRUST_STORE, STACKABLE_TRUST_STORE_PASSWORD,
};
use stackable_operator::memory::MemoryQuantity;

#[derive(Snafu, Debug)]
pub enum Error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use stackable_operator::{
k8s_openapi::api::core::v1::{PodAffinity, PodAntiAffinity},
};

use crate::{DeepStorageSpec, DruidRole, HdfsDeepStorageSpec, APP_NAME};
use crate::crd::{DeepStorageSpec, DruidRole, HdfsDeepStorageSpec, APP_NAME};

/// Please have a look at the architecture diagram in <https://druid.apache.org/assets/images/druid-architecture-7db1cd79d2d70b2e5ccc73b6bebfcaa4.svg>
/// to understand which roles do communicate with each other.
Expand Down Expand Up @@ -32,7 +32,7 @@ pub fn get_affinity(
DruidRole::Historical |
// Ingests data
DruidRole::MiddleManager => {
if let DeepStorageSpec::HDFS(HdfsDeepStorageSpec {
if let DeepStorageSpec::Hdfs(HdfsDeepStorageSpec {
config_map_name: hdfs_discovery_cm_name,
..
}) = deep_storage
Expand Down Expand Up @@ -90,7 +90,7 @@ mod tests {
};

use super::*;
use crate::DruidCluster;
use crate::crd::v1alpha1;

#[rstest]
#[case(DruidRole::Coordinator)]
Expand Down Expand Up @@ -141,7 +141,7 @@ mod tests {
replicas: 1
"#;
let deserializer = serde_yaml::Deserializer::from_str(input);
let druid: DruidCluster =
let druid: v1alpha1::DruidCluster =
serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap();
let merged_config = druid
.merged_config()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use stackable_operator::{
};
use tracing::info;

use crate::DruidClusterConfig;
use crate::crd::v1alpha1::DruidClusterConfig;

type Result<T, E = Error> = std::result::Result<T, E>;

Expand Down Expand Up @@ -219,15 +219,6 @@ impl AuthenticationClassesResolved {
}
false
}

pub fn oidc_authentication_enabled(&self) -> bool {
if !self.auth_classes.is_empty() {
if let Some(AuthenticationClassResolved::Oidc { .. }) = self.auth_classes.first() {
return true;
}
}
false
}
}

#[cfg(test)]
Expand All @@ -239,7 +230,7 @@ mod tests {
use stackable_operator::kube;

use super::*;
use crate::{authentication::AuthenticationClassesResolved, DruidClusterConfig};
use crate::crd::{authentication::AuthenticationClassesResolved, v1alpha1::DruidClusterConfig};

const BASE_CLUSTER_CONFIG: &str = r#"
deepStorage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use stackable_operator::{
memory::{BinaryMultiple, MemoryQuantity},
};

use crate::{
use crate::crd::{
storage::HistoricalStorage, PROCESSING_BUFFER_SIZE_BYTES, PROCESSING_NUM_MERGE_BUFFERS,
PROCESSING_NUM_THREADS,
};
Expand Down
Loading