Skip to content

Commit f8353ce

Browse files
authored
feat/misc utils (#817)
* Add product_version() * Update changelog * fix formatting
1 parent 4a29c04 commit f8353ce

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

crates/stackable-operator/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
1313
- [kube#1494](https://github.com/kube-rs/kube/pull/1494)
1414
- [kube#1504](https://github.com/kube-rs/kube/pull/1504)
1515
- Upgrade opentelemetry crates ([#811]).
16+
- Added `ProductImage.product_version()` utility function ([#817])
1617

1718
### Fixed
1819

@@ -21,6 +22,7 @@ All notable changes to this project will be documented in this file.
2122
[#804]: https://github.com/stackabletech/operator-rs/pull/804
2223
[#811]: https://github.com/stackabletech/operator-rs/pull/811
2324
[#812]: https://github.com/stackabletech/operator-rs/pull/812
25+
[#817]: https://github.com/stackabletech/operator-rs/pull/817
2426

2527
## [0.69.3] - 2024-06-12
2628

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,20 @@ impl ProductImage {
161161
}
162162
}
163163
}
164+
165+
/// The product version is always known without having to resolve the image.
166+
pub fn product_version(&self) -> &str {
167+
match &self.image_selection {
168+
ProductImageSelection::Custom(ProductImageCustom {
169+
product_version: pv,
170+
..
171+
}) => pv,
172+
ProductImageSelection::StackableVersion(ProductImageStackableVersion {
173+
product_version: pv,
174+
..
175+
}) => pv,
176+
}
177+
}
164178
}
165179

166180
#[cfg(test)]

0 commit comments

Comments
 (0)