Skip to content

feat!: Re-export stackable-certs and stackable-webhook crates #1074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/stackable-certs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ default = []
rustls = ["dep:tokio-rustls"]

[dependencies]
stackable-operator = { path = "../stackable-operator" }
stackable-shared = { path = "../stackable-shared" }

const-oid.workspace = true
ecdsa.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-certs/src/ca/consts.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use stackable_operator::time::Duration;
use stackable_shared::time::Duration;

/// The default CA validity time span of one hour (3600 seconds).
pub const DEFAULT_CA_VALIDITY: Duration = Duration::from_hours_unchecked(1);
Expand Down
10 changes: 5 additions & 5 deletions crates/stackable-certs/src/ca/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::{fmt::Debug, str::FromStr};

use const_oid::db::rfc5280::{ID_KP_CLIENT_AUTH, ID_KP_SERVER_AUTH};
use k8s_openapi::api::core::v1::Secret;
use kube::runtime::reflector::ObjectRef;
use kube::{Api, Client, runtime::reflector::ObjectRef};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_operator::{client::Client, commons::secret::SecretReference, time::Duration};
use stackable_shared::{commons::secret::SecretReference, time::Duration};
use tracing::{debug, instrument};
use x509_cert::{
Certificate,
Expand Down Expand Up @@ -454,15 +454,15 @@ where
/// Create a [`CertificateAuthority`] from a Kubernetes [`SecretReference`].
#[instrument(
name = "create_certificate_authority_from_k8s_secret_ref",
skip(secret_ref, client)
skip(client)
)]
pub async fn from_secret_ref(
secret_ref: &SecretReference,
key_certificate: &str,
key_private_key: &str,
client: &Client,
client: Client,
) -> Result<Self, SecretError<S::Error>> {
let secret_api = client.get_api::<Secret>(&secret_ref.namespace);
let secret_api = Api::namespaced(client, &secret_ref.namespace);
let secret = secret_api
.get(&secret_ref.name)
.await
Expand Down
13 changes: 13 additions & 0 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

- Re-export `stackable-certs` and `stackable-webhook` crates ([#1074]).

### Changed

- BREAKING: Some modules have been moved into the `stackable-shared` crate, so that they can also be
used in `stackable-certs` and `stackable-webhook` ([#1074]):
- The module `stackable_operator::time` has moved to `stackable_operator::shared::time`
- The module `stackable_operator::commons::secret` has moved to `stackable_operator::shared::commons::secret`

[#1074]: https://github.com/stackabletech/operator-rs/pull/1074

## [0.94.0] - 2025-07-10

### Added
Expand Down
17 changes: 11 additions & 6 deletions crates/stackable-operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@ edition.workspace = true
repository.workspace = true

[features]
full = ["time", "telemetry", "versioned"]
default = ["telemetry", "versioned"]
full = ["certs", "telemetry", "time", "versioned", "webhook"]
default = ["telemetry", "time", "versioned"]

certs = ["dep:stackable-certs"]
telemetry = ["dep:stackable-telemetry"]
time = ["dep:time"]
telemetry = []
versioned = []
versioned = ["dep:stackable-versioned"]
webhook = ["dep:stackable-webhook"]

[dependencies]
stackable-certs = { path = "../stackable-certs", optional = true }
stackable-operator-derive = { path = "../stackable-operator-derive" }
stackable-shared = { path = "../stackable-shared" }
stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"] }
stackable-versioned = { path = "../stackable-versioned" }
stackable-telemetry = { path = "../stackable-telemetry", optional = true, features = ["clap"] }
stackable-versioned = { path = "../stackable-versioned", optional = true }
stackable-webhook = { path = "../stackable-webhook", optional = true }

chrono.workspace = true
clap.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/src/builder/pod/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use k8s_openapi::{
apimachinery::pkg::{api::resource::Quantity, apis::meta::v1::ObjectMeta},
};
use snafu::{OptionExt, ResultExt, Snafu};
use stackable_shared::time::Duration;

use crate::{
builder::{
Expand All @@ -25,7 +26,6 @@ use crate::{
},
},
kvp::Labels,
time::Duration,
};

pub mod container;
Expand Down
2 changes: 1 addition & 1 deletion crates/stackable-operator/src/builder/pod/volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use k8s_openapi::{
apimachinery::pkg::api::resource::Quantity,
};
use snafu::{ResultExt, Snafu};
use stackable_shared::time::Duration;
use tracing::warn;

use crate::{
builder::meta::ObjectMetaBuilder,
kvp::{Annotation, AnnotationError, Annotations, LabelError, Labels},
time::Duration,
};

/// A builder to build [`Volume`] objects. May only contain one `volume_source`
Expand Down
3 changes: 1 addition & 2 deletions crates/stackable-operator/src/commons/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use std::marker::PhantomData;
use educe::Educe;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::time::Duration;
use stackable_shared::time::Duration;

/// [`TtlCache`] with sensible defaults for a user information cache
pub type UserInformationCache = TtlCache<UserInformationCacheDefaults>;
Expand Down
1 change: 0 additions & 1 deletion crates/stackable-operator/src/commons/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ pub mod pdb;
pub mod product_image_selection;
pub mod rbac;
pub mod resources;
pub mod secret;
pub mod secret_class;
pub mod tls_verification;
3 changes: 1 addition & 2 deletions crates/stackable-operator/src/config/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ use k8s_openapi::{
apimachinery::pkg::{api::resource::Quantity, apis::meta::v1::LabelSelector},
};
pub use stackable_operator_derive::Merge;

use crate::time::Duration;
use stackable_shared::time::Duration;

/// A type that can be merged with itself
///
Expand Down
3 changes: 2 additions & 1 deletion crates/stackable-operator/src/crd/git_sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ use std::{collections::BTreeMap, path::PathBuf};

use schemars::{self, JsonSchema};
use serde::{Deserialize, Serialize};
use stackable_shared::time::Duration;
use url::Url;

use crate::{time::Duration, versioned::versioned};
use crate::versioned::versioned;

mod v1alpha1_impl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use k8s_openapi::api::core::v1::{
Container, EmptyDirVolumeSource, EnvVar, EnvVarSource, SecretKeySelector, Volume, VolumeMount,
};
use snafu::{ResultExt, Snafu};
use stackable_shared::time::Duration;
use strum::{EnumDiscriminants, IntoStaticStr};

use crate::{
Expand All @@ -17,7 +18,6 @@ use crate::{
framework::capture_shell_output,
spec::{ContainerLogConfig, ContainerLogConfigChoice},
},
time::Duration,
utils::COMMON_BASH_TRAP_FUNCTIONS,
};

Expand Down
5 changes: 4 additions & 1 deletion crates/stackable-operator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub mod product_config_utils;
pub mod product_logging;
pub mod role_utils;
pub mod status;
pub mod time;
pub mod utils;
pub mod validation;

Expand All @@ -37,9 +36,13 @@ pub use schemars;
// Internal re-exports
// TODO (@Techassi): Ideally we would want webhook and certs exported here as
// well, but that would require some restructuring of crates.
#[cfg(feature = "certs")]
pub use stackable_certs as certs;
pub use stackable_shared as shared;
pub use stackable_shared::{crd::CustomResourceExt, yaml::YamlSchema};
#[cfg(feature = "telemetry")]
pub use stackable_telemetry as telemetry;
#[cfg(feature = "versioned")]
pub use stackable_versioned as versioned;
#[cfg(feature = "webhook")]
pub use stackable_webhook as webhook;
5 changes: 5 additions & 0 deletions crates/stackable-shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ edition.workspace = true
repository.workspace = true

[dependencies]
k8s-openapi.workspace = true
kube.workspace = true
schemars.workspace = true
semver.workspace = true
serde.workspace = true
serde_yaml.workspace = true
snafu.workspace = true
strum.workspace = true
time.workspace = true

[dev-dependencies]
k8s-openapi.workspace = true
rstest.workspace = true
1 change: 1 addition & 0 deletions crates/stackable-shared/src/commons/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod secret;
2 changes: 2 additions & 0 deletions crates/stackable-shared/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! This crate contains various shared helpers and utilities used across other crates in this
//! workspace.

pub mod commons;
pub mod crd;
pub mod time;
pub mod yaml;
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod duration;
mod serde_impl;

#[cfg(feature = "time")]
mod time_impl;

pub use duration::*;
1 change: 0 additions & 1 deletion crates/stackable-webhook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ repository.workspace = true
[dependencies]
stackable-certs = { path = "../stackable-certs", features = ["rustls"] }
stackable-telemetry = { path = "../stackable-telemetry" }
stackable-operator = { path = "../stackable-operator" }

axum.workspace = true
futures-util.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/xtask/src/crd/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use stackable_operator::{
config::fragment::Fragment,
kube::CustomResource,
role_utils::Role,
schemars::{self, JsonSchema},
schemars::JsonSchema,
status::condition::ClusterCondition,
versioned::versioned,
};
Expand Down Expand Up @@ -44,7 +44,7 @@ pub mod versioned {
pdb_config: stackable_operator::commons::pdb::PdbConfig,
product_image: stackable_operator::commons::product_image_selection::ProductImage,
secret_class_volume: stackable_operator::commons::secret_class::SecretClassVolume,
secret_reference: stackable_operator::commons::secret::SecretReference,
secret_reference: stackable_operator::shared::commons::secret::SecretReference,
tls_client_details: stackable_operator::commons::tls_verification::TlsClientDetails,

// Already versioned
Expand Down