Skip to content

Commit 1edd66b

Browse files
committed
chore: Merge branch 'main' into chore/opentelemetry-bumps
2 parents 230118b + bc176bf commit 1edd66b

File tree

21 files changed

+78
-97
lines changed

21 files changed

+78
-97
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ where
380380
key_certificate: &str,
381381
key_private_key: &str,
382382
) -> Result<Self, SecretError<S::Error>> {
383-
if !secret.type_.as_ref().is_some_and(|s| s == TLS_SECRET_TYPE) {
383+
if secret.type_.as_ref().is_none_or(|s| s != TLS_SECRET_TYPE) {
384384
return InvalidSecretTypeSnafu.fail();
385385
}
386386

crates/stackable-operator/CHANGELOG.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ All notable changes to this project will be documented in this file.
2121

2222
[#977]: https://github.com/stackabletech/operator-rs/pull/977
2323

24+
## [0.87.2] - 2025-03-10
25+
26+
### Changed
27+
28+
- Make `region.name` field in in S3ConnectionSpec public ([#980]).
29+
30+
[#980]: https://github.com/stackabletech/operator-rs/pull/980
31+
32+
## [0.87.1] - 2025-03-10
33+
34+
### Changed
35+
36+
- Refactor `region` field in S3ConnectionSpec ([#976]).
37+
38+
[#976]: https://github.com/stackabletech/operator-rs/pull/976
39+
2440
## [0.87.0] - 2025-02-28
2541

2642
### Changed
@@ -41,7 +57,7 @@ All notable changes to this project will be documented in this file.
4157

4258
### Added
4359

44-
- Add `region` field to S3ConnectionSpec ([#959]).
60+
- BREAKING: Add `region` field to S3ConnectionSpec (defaults to `us-east-1`) ([#959]).
4561

4662
[#959]: https://github.com/stackabletech/operator-rs/pull/959
4763

crates/stackable-operator/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "stackable-operator"
33
description = "Stackable Operator Framework"
4-
version = "0.87.0"
4+
version = "0.87.2"
55
authors.workspace = true
66
license.workspace = true
77
edition.workspace = true

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

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ pub enum Error {
3030
/// Build RBAC objects for the product workloads.
3131
/// The `product_name` is meant to be the product name, for example: zookeeper, airflow, etc.
3232
/// and it is a assumed that a ClusterRole named `{product_name}-clusterrole` exists.
33-
3433
pub fn build_rbac_resources<T: Clone + Resource<DynamicType = ()>>(
3534
resource: &T,
3635
// 'product_name' is not used to build the names of the serviceAccount and roleBinding objects,

crates/stackable-operator/src/commons/s3/crd.rs

+14-57
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,13 @@ pub struct S3ConnectionSpec {
5656
#[serde(default, skip_serializing_if = "Option::is_none")]
5757
pub port: Option<u16>,
5858

59-
/// AWS service API region used by the AWS SDK when using AWS S3 buckets.
59+
/// Bucket region used for signing headers (sigv4).
6060
///
61-
/// This defaults to `us-east-1` and can be ignored if not using AWS S3
62-
/// buckets.
61+
/// This defaults to `us-east-1` which is compatible with other implementations such as Minio.
6362
///
64-
/// NOTE: This is not the bucket region, and is used by the AWS SDK to
65-
/// construct endpoints for various AWS service APIs. It is only useful when
66-
/// using AWS S3 buckets.
67-
///
68-
/// When using AWS S3 buckets, you can configure optimal AWS service API
69-
/// connections in the following ways:
70-
/// - From **inside** AWS: Use an auto-discovery source (eg: AWS IMDS).
71-
/// - From **outside** AWS, or when IMDS is disabled, explicity set the
72-
/// region name nearest to where the client application is running from.
63+
/// WARNING: Some products use the Hadoop S3 implementation which falls back to us-east-2.
7364
#[serde(default)]
74-
pub region: AwsRegion,
65+
pub region: Region,
7566

7667
/// Which access style to use.
7768
/// Defaults to virtual hosted-style as most of the data products out there.
@@ -103,56 +94,22 @@ pub enum S3AccessStyle {
10394
VirtualHosted,
10495
}
10596

106-
/// Set a named AWS region, or defer to an auto-discovery mechanism.
97+
/// Set a named S3 Bucket region.
10798
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
10899
#[serde(rename_all = "camelCase")]
109-
pub enum AwsRegion {
110-
/// Defer region detection to an auto-discovery mechanism.
111-
Source(AwsRegionAutoDiscovery),
112-
113-
/// An explicit region, eg: eu-central-1
114-
Name(String),
115-
}
116-
117-
impl AwsRegion {
118-
/// Get the AWS region name.
119-
///
120-
/// Returns `None` if an auto-discovery source has been selected. Otherwise,
121-
/// it returns the configured region name.
122-
///
123-
/// Example usage:
124-
///
125-
/// ```
126-
/// # use stackable_operator::commons::s3::AwsRegion;
127-
/// # fn set_property(key: &str, value: &str) {}
128-
/// # fn example(aws_region: AwsRegion) {
129-
/// if let Some(region_name) = aws_region.name() {
130-
/// // set some property if the region is set, or is the default.
131-
/// set_property("aws.region", region_name);
132-
/// };
133-
/// # }
134-
/// ```
135-
pub fn name(&self) -> Option<&str> {
136-
match self {
137-
AwsRegion::Name(name) => Some(name),
138-
AwsRegion::Source(_) => None,
139-
}
140-
}
100+
pub struct Region {
101+
#[serde(default = "default_region_name")]
102+
pub name: String,
141103
}
142104

143-
impl Default for AwsRegion {
105+
impl Default for Region {
144106
fn default() -> Self {
145-
Self::Name("us-east-1".to_owned())
107+
Self {
108+
name: default_region_name(),
109+
}
146110
}
147111
}
148112

149-
/// AWS region auto-discovery mechanism.
150-
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
151-
#[serde(rename_all = "PascalCase")]
152-
pub enum AwsRegionAutoDiscovery {
153-
/// AWS Instance Meta Data Service.
154-
///
155-
/// This variant should result in no region being given to the AWS SDK,
156-
/// which should, in turn, query the AWS IMDS.
157-
AwsImds,
113+
fn default_region_name() -> String {
114+
"us-east-1".into()
158115
}

crates/stackable-operator/src/config/fragment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct Validator<'a> {
2626
parent: Option<&'a Validator<'a>>,
2727
}
2828

29-
impl<'a> Validator<'a> {
29+
impl Validator<'_> {
3030
/// Creates a `Validator` for a subfield of the current object
3131
pub fn field<'b>(&'b self, ident: &'b dyn Display) -> Validator<'b> {
3232
Validator {

crates/stackable-operator/src/config/merge.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl Atomic for bool {}
146146
impl Atomic for String {}
147147
impl Atomic for Quantity {}
148148
impl Atomic for Duration {}
149-
impl<'a> Atomic for &'a str {}
149+
impl Atomic for &str {}
150150
impl Atomic for LabelSelector {}
151151
impl Atomic for PodAffinity {}
152152
impl Atomic for PodAntiAffinity {}

crates/stackable-operator/src/cpu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'de> Deserialize<'de> for CpuQuantity {
7070
{
7171
struct CpuQuantityVisitor;
7272

73-
impl<'de> Visitor<'de> for CpuQuantityVisitor {
73+
impl Visitor<'_> for CpuQuantityVisitor {
7474
type Value = CpuQuantity;
7575

7676
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {

crates/stackable-operator/src/memory.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl<'de> Deserialize<'de> for MemoryQuantity {
347347
{
348348
struct MemoryQuantityVisitor;
349349

350-
impl<'de> Visitor<'de> for MemoryQuantityVisitor {
350+
impl Visitor<'_> for MemoryQuantityVisitor {
351351
type Value = MemoryQuantity;
352352

353353
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {

crates/stackable-operator/src/status/condition/operations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct ClusterOperationsConditionBuilder<'a> {
1313
cluster_operation: &'a ClusterOperation,
1414
}
1515

16-
impl<'a> ConditionBuilder for ClusterOperationsConditionBuilder<'a> {
16+
impl ConditionBuilder for ClusterOperationsConditionBuilder<'_> {
1717
fn build_conditions(&self) -> ClusterConditionSet {
1818
vec![self.reconciliation_paused(), self.cluster_stopped()].into()
1919
}

crates/stackable-operator/src/time/serde_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::time::Duration;
44

55
struct DurationVisitor;
66

7-
impl<'de> Visitor<'de> for DurationVisitor {
7+
impl Visitor<'_> for DurationVisitor {
88
type Value = Duration;
99

1010
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {

crates/stackable-telemetry/src/instrumentation/axum/extractor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use opentelemetry::{propagation::Extractor, Context};
1818
/// [4]: https://docs.rs/opentelemetry-http/latest/opentelemetry_http/struct.HeaderExtractor.html
1919
pub struct HeaderExtractor<'a>(pub(crate) &'a HeaderMap);
2020

21-
impl<'a> Extractor for HeaderExtractor<'a> {
21+
impl Extractor for HeaderExtractor<'_> {
2222
fn get(&self, key: &str) -> Option<&str> {
2323
self.0
2424
.get(key)

crates/stackable-telemetry/src/instrumentation/axum/injector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use opentelemetry::{propagation::Injector, Context};
2020
/// [5]: https://docs.rs/opentelemetry-http/latest/opentelemetry_http/struct.HeaderInjector.html
2121
pub struct HeaderInjector<'a>(pub(crate) &'a mut HeaderMap);
2222

23-
impl<'a> Injector for HeaderInjector<'a> {
23+
impl Injector for HeaderInjector<'_> {
2424
fn set(&mut self, key: &str, value: String) {
2525
if let Ok(header_name) = HeaderName::from_bytes(key.as_bytes()) {
2626
if let Ok(header_value) = HeaderValue::from_str(&value) {

crates/stackable-versioned-macros/src/codegen/changes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ where
6666
where
6767
F: Fn(&V) -> bool,
6868
{
69-
self.get(key).map_or(false, f)
69+
self.get(key).is_some_and(f)
7070
}
7171

7272
fn lo_bound(&self, bound: Bound<&K>) -> Option<(&K, &V)> {

crates/stackable-versioned-macros/src/codegen/container/enum.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Container {
3434
.common
3535
.options
3636
.skip
37-
.map_or(false, |s| s.from.is_present()),
37+
.is_some_and(|s| s.from.is_present()),
3838
};
3939

4040
let idents = ContainerIdents::from(item_enum.ident, None);
@@ -68,10 +68,7 @@ impl Container {
6868

6969
let options = ContainerOptions {
7070
kubernetes_options: None,
71-
skip_from: attributes
72-
.options
73-
.skip
74-
.map_or(false, |s| s.from.is_present()),
71+
skip_from: attributes.options.skip.is_some_and(|s| s.from.is_present()),
7572
};
7673

7774
let idents = ContainerIdents::from(item_enum.ident, None);
@@ -209,7 +206,7 @@ impl Enum {
209206
// cannot be deprecated). Then we retrieve the status of the variant and
210207
// ensure it is deprecated.
211208
self.variants.iter().any(|f| {
212-
f.changes.as_ref().map_or(false, |c| {
209+
f.changes.as_ref().is_some_and(|c| {
213210
c.value_is(&version.inner, |a| {
214211
matches!(
215212
a,

crates/stackable-versioned-macros/src/codegen/container/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ impl From<KubernetesArguments> for KubernetesOptions {
302302
.map_or_else(KubernetesCrateOptions::default, |crates| crates.into()),
303303
status: args.status,
304304
shortnames: args.shortnames,
305-
skip_merged_crd: args.skip.map_or(false, |s| s.merged_crd.is_present()),
305+
skip_merged_crd: args.skip.is_some_and(|s| s.merged_crd.is_present()),
306306
}
307307
}
308308
}

crates/stackable-versioned-macros/src/codegen/container/struct.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl Container {
4747
.common
4848
.options
4949
.skip
50-
.map_or(false, |s| s.from.is_present()),
50+
.is_some_and(|s| s.from.is_present()),
5151
kubernetes_options,
5252
};
5353

@@ -90,10 +90,7 @@ impl Container {
9090
}
9191

9292
let options = ContainerOptions {
93-
skip_from: attributes
94-
.options
95-
.skip
96-
.map_or(false, |s| s.from.is_present()),
93+
skip_from: attributes.options.skip.is_some_and(|s| s.from.is_present()),
9794
kubernetes_options,
9895
};
9996

@@ -245,7 +242,7 @@ impl Struct {
245242
// cannot be deprecated). Then we retrieve the status of the field and
246243
// ensure it is deprecated.
247244
self.fields.iter().any(|f| {
248-
f.changes.as_ref().map_or(false, |c| {
245+
f.changes.as_ref().is_some_and(|c| {
249246
c.value_is(&version.inner, |a| {
250247
matches!(
251248
a,

crates/stackable-versioned-macros/src/codegen/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl From<&StandaloneContainerAttributes> for Vec<VersionDefinition> {
3636
.versions
3737
.iter()
3838
.map(|v| VersionDefinition {
39-
skip_from: v.skip.as_ref().map_or(false, |s| s.from.is_present()),
39+
skip_from: v.skip.as_ref().is_some_and(|s| s.from.is_present()),
4040
ident: format_ident!("{version}", version = v.name.to_string()).into(),
4141
deprecated: v.deprecated.as_ref().map(|r#override| {
4242
r#override
@@ -57,7 +57,7 @@ impl From<&ModuleAttributes> for Vec<VersionDefinition> {
5757
.versions
5858
.iter()
5959
.map(|v| VersionDefinition {
60-
skip_from: v.skip.as_ref().map_or(false, |s| s.from.is_present()),
60+
skip_from: v.skip.as_ref().is_some_and(|s| s.from.is_present()),
6161
ident: format_ident!("{version}", version = v.name.to_string()).into(),
6262
deprecated: v.deprecated.as_ref().map(|r#override| {
6363
r#override

crates/stackable-versioned-macros/src/codegen/module.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Module {
5353
.options
5454
.skip
5555
.as_ref()
56-
.map_or(false, |opts| opts.from.is_present());
56+
.is_some_and(|opts| opts.from.is_present());
5757

5858
let mut errors = Error::accumulator();
5959
let mut submodules = HashMap::new();

0 commit comments

Comments
 (0)