Skip to content

Commit 2c22e42

Browse files
authored
Merge branch 'main' into chore/bump-kube-update-status-option-type
2 parents 12849a4 + 5b417a5 commit 2c22e42

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackable-operator/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [0.87.3] - 2025-03-14
8+
9+
### Added
10+
11+
- Add a `Region::is_default_config` function to determine if a region sticks to the default config ([#983]).
12+
13+
[#983]: https://github.com/stackabletech/operator-rs/pull/983
14+
715
## [0.87.2] - 2025-03-10
816

917
### Changed

crates/stackable-operator/Cargo.toml

Lines changed: 1 addition & 1 deletion
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.2"
4+
version = "0.87.3"
55
authors.workspace = true
66
license.workspace = true
77
edition.workspace = true

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

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,32 @@ pub enum S3AccessStyle {
9898
#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
9999
#[serde(rename_all = "camelCase")]
100100
pub struct Region {
101-
#[serde(default = "default_region_name")]
101+
#[serde(default = "Region::default_region_name")]
102102
pub name: String,
103103
}
104104

105+
impl Region {
106+
/// Having it as `const &str` as well, so we don't always allocate a [`String`] just for comparisons
107+
pub const DEFAULT_REGION_NAME: &str = "us-east-1";
108+
109+
fn default_region_name() -> String {
110+
Self::DEFAULT_REGION_NAME.to_string()
111+
}
112+
113+
/// Returns if the region sticks to the Stackable defaults.
114+
///
115+
/// Some products don't really support configuring the region.
116+
/// This function can be used to determine if a warning or error should be raised to inform the
117+
/// user of this situation.
118+
pub fn is_default_config(&self) -> bool {
119+
self.name == Self::DEFAULT_REGION_NAME
120+
}
121+
}
122+
105123
impl Default for Region {
106124
fn default() -> Self {
107125
Self {
108-
name: default_region_name(),
126+
name: Self::default_region_name(),
109127
}
110128
}
111129
}
112-
113-
fn default_region_name() -> String {
114-
"us-east-1".into()
115-
}

0 commit comments

Comments
 (0)