Skip to content

Commit c00b9c5

Browse files
authored
feat!: Re-export stackable-certs and stackable-webhook crates (#1074)
* feat!: Re-export stackable-certs and stackable-webhook crates * changelog * fix tests * fix rustdoc * Remove commons mod. Add time feature * Add time feature to stackable-operator as well * Silence cargo udeps * Fix rustdocs
1 parent e5d6dc1 commit c00b9c5

File tree

26 files changed

+73
-35
lines changed

26 files changed

+73
-35
lines changed

Cargo.lock

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackable-certs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ default = []
1111
rustls = ["dep:tokio-rustls"]
1212

1313
[dependencies]
14-
stackable-operator = { path = "../stackable-operator" }
14+
stackable-shared = { path = "../stackable-shared" }
1515

1616
const-oid.workspace = true
1717
ecdsa.workspace = true

crates/stackable-certs/src/ca/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use stackable_operator::time::Duration;
1+
use stackable_shared::time::Duration;
22

33
/// The default CA validity time span
44
pub const DEFAULT_CA_VALIDITY: Duration = Duration::from_hours_unchecked(1);

crates/stackable-certs/src/ca/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use std::{fmt::Debug, str::FromStr};
44

55
use const_oid::db::rfc5280::{ID_KP_CLIENT_AUTH, ID_KP_SERVER_AUTH};
66
use k8s_openapi::api::core::v1::Secret;
7-
use kube::runtime::reflector::ObjectRef;
7+
use kube::{Api, Client, runtime::reflector::ObjectRef};
88
use snafu::{OptionExt, ResultExt, Snafu};
9-
use stackable_operator::{client::Client, commons::secret::SecretReference, time::Duration};
9+
use stackable_shared::{secret::SecretReference, time::Duration};
1010
use tracing::{debug, instrument};
1111
use x509_cert::{
1212
Certificate,
@@ -454,15 +454,15 @@ where
454454
/// Create a [`CertificateAuthority`] from a Kubernetes [`SecretReference`].
455455
#[instrument(
456456
name = "create_certificate_authority_from_k8s_secret_ref",
457-
skip(secret_ref, client)
457+
skip(client)
458458
)]
459459
pub async fn from_secret_ref(
460460
secret_ref: &SecretReference,
461461
key_certificate: &str,
462462
key_private_key: &str,
463-
client: &Client,
463+
client: Client,
464464
) -> Result<Self, SecretError<S::Error>> {
465-
let secret_api = client.get_api::<Secret>(&secret_ref.namespace);
465+
let secret_api = Api::namespaced(client, &secret_ref.namespace);
466466
let secret = secret_api
467467
.get(&secret_ref.name)
468468
.await

crates/stackable-operator/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,29 @@ All notable changes to this project will be documented in this file.
77
### Added
88

99
- Add `ProbeBuilder` to build Kubernetes container probes ([#1078]).
10+
- Re-export `stackable-certs` and `stackable-webhook` crates ([#1074]).
1011
- BREAKING: Add two new required CLI arguments: `--operator-namespace` and `--operator-service-name`.
1112
These two values are used to construct the service name in the CRD conversion webhook ([#1066]).
13+
- Re-export `stackable-certs` and `stackable-webhook` crates ([#1074]).
1214

1315
### Changed
1416

1517
- BREAKING: The `ResolvedProductImage` field `app_version_label` was renamed to `app_version_label_value` to match changes to its type ([#1076]).
1618
- BREAKING: Rename two fields of the `ProductOperatorRun` struct for consistency and clarity ([#1066]):
1719
- `telemetry_arguments` -> `telemetry`
1820
- `cluster_info_opts` -> `cluster_info`
21+
- BREAKING: Some modules have been moved into the `stackable-shared` crate, so that they can also be
22+
used in `stackable-certs` and `stackable-webhook` ([#1074]):
23+
- The module `stackable_operator::time` has moved to `stackable_operator::shared::time`
24+
- The module `stackable_operator::commons::secret` has moved to `stackable_operator::shared::secret`
1925

2026
### Fixed
2127

2228
- BREAKING: Fix bug where `ResolvedProductImage::app_version_label` could not be used as a label value because it can contain invalid characters.
2329
This is the case when referencing custom images via a `@sha256:...` hash. As such, the `product_image_selection::resolve` function is now fallible ([#1076]).
2430

2531
[#1066]: https://github.com/stackabletech/operator-rs/pull/1066
32+
[#1074]: https://github.com/stackabletech/operator-rs/pull/1074
2633
[#1076]: https://github.com/stackabletech/operator-rs/pull/1076
2734
[#1078]: https://github.com/stackabletech/operator-rs/pull/1078
2835

crates/stackable-operator/Cargo.toml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@ edition.workspace = true
88
repository.workspace = true
99

1010
[features]
11-
full = ["time", "telemetry", "versioned"]
11+
full = ["certs", "telemetry", "versioned", "time", "webhook"]
1212
default = ["telemetry", "versioned"]
13-
time = ["dep:time"]
14-
telemetry = []
15-
versioned = []
13+
14+
certs = ["dep:stackable-certs"]
15+
telemetry = ["dep:stackable-telemetry"]
16+
time = ["stackable-shared/time"]
17+
versioned = ["dep:stackable-versioned"]
18+
webhook = ["dep:stackable-webhook"]
1619

1720
[dependencies]
21+
stackable-certs = { path = "../stackable-certs", optional = true }
1822
stackable-operator-derive = { path = "../stackable-operator-derive" }
1923
stackable-shared = { path = "../stackable-shared" }
20-
stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"] }
21-
stackable-versioned = { path = "../stackable-versioned" }
24+
stackable-telemetry = { path = "../stackable-telemetry", optional = true, features = ["clap"] }
25+
stackable-versioned = { path = "../stackable-versioned", optional = true }
26+
stackable-webhook = { path = "../stackable-webhook", optional = true }
2227

2328
chrono.workspace = true
2429
clap.workspace = true
@@ -42,7 +47,6 @@ serde_yaml.workspace = true
4247
serde.workspace = true
4348
snafu.workspace = true
4449
strum.workspace = true
45-
time = { workspace = true, optional = true }
4650
tokio.workspace = true
4751
tracing.workspace = true
4852
tracing-appender.workspace = true

crates/stackable-operator/src/builder/pod/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use k8s_openapi::{
1010
apimachinery::pkg::{api::resource::Quantity, apis::meta::v1::ObjectMeta},
1111
};
1212
use snafu::{OptionExt, ResultExt, Snafu};
13+
use stackable_shared::time::Duration;
1314

1415
use crate::{
1516
builder::{
@@ -25,7 +26,6 @@ use crate::{
2526
},
2627
},
2728
kvp::Labels,
28-
time::Duration,
2929
};
3030

3131
pub mod container;

crates/stackable-operator/src/builder/pod/probe.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! ```
1010
//! use stackable_operator::{
1111
//! builder::pod::probe::ProbeBuilder,
12-
//! time::Duration,
12+
//! shared::time::Duration,
1313
//! };
1414
//! # use k8s_openapi::api::core::v1::HTTPGetAction;
1515
//! # use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
@@ -36,8 +36,7 @@ use k8s_openapi::{
3636
apimachinery::pkg::util::intstr::IntOrString,
3737
};
3838
use snafu::{ResultExt, Snafu, ensure};
39-
40-
use crate::time::Duration;
39+
use stackable_shared::time::Duration;
4140

4241
#[derive(Debug, Snafu)]
4342
pub enum Error {

crates/stackable-operator/src/builder/pod/volume.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ use k8s_openapi::{
99
apimachinery::pkg::api::resource::Quantity,
1010
};
1111
use snafu::{ResultExt, Snafu};
12+
use stackable_shared::time::Duration;
1213
use tracing::warn;
1314

1415
use crate::{
1516
builder::meta::ObjectMetaBuilder,
1617
kvp::{Annotation, AnnotationError, Annotations, LabelError, Labels},
17-
time::Duration,
1818
};
1919

2020
/// A builder to build [`Volume`] objects. May only contain one `volume_source`

crates/stackable-operator/src/commons/cache.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ use std::marker::PhantomData;
33
use educe::Educe;
44
use schemars::JsonSchema;
55
use serde::{Deserialize, Serialize};
6-
7-
use crate::time::Duration;
6+
use stackable_shared::time::Duration;
87

98
/// [`TtlCache`] with sensible defaults for a user information cache
109
pub type UserInformationCache = TtlCache<UserInformationCacheDefaults>;

0 commit comments

Comments
 (0)