diff --git a/crates/stackable-operator/CHANGELOG.md b/crates/stackable-operator/CHANGELOG.md index 3b5f063de..10f327dbc 100644 --- a/crates/stackable-operator/CHANGELOG.md +++ b/crates/stackable-operator/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. - [kube#1494](https://github.com/kube-rs/kube/pull/1494) - [kube#1504](https://github.com/kube-rs/kube/pull/1504) - Upgrade opentelemetry crates ([#811]). +- Added `ProductImage.product_version()` utility function ([#817]) ### Fixed @@ -21,6 +22,7 @@ All notable changes to this project will be documented in this file. [#804]: https://github.com/stackabletech/operator-rs/pull/804 [#811]: https://github.com/stackabletech/operator-rs/pull/811 [#812]: https://github.com/stackabletech/operator-rs/pull/812 +[#817]: https://github.com/stackabletech/operator-rs/pull/817 ## [0.69.3] - 2024-06-12 diff --git a/crates/stackable-operator/src/commons/product_image_selection.rs b/crates/stackable-operator/src/commons/product_image_selection.rs index acec797c9..a166805dc 100644 --- a/crates/stackable-operator/src/commons/product_image_selection.rs +++ b/crates/stackable-operator/src/commons/product_image_selection.rs @@ -161,6 +161,20 @@ impl ProductImage { } } } + + /// The product version is always known without having to resolve the image. + pub fn product_version(&self) -> &str { + match &self.image_selection { + ProductImageSelection::Custom(ProductImageCustom { + product_version: pv, + .. + }) => pv, + ProductImageSelection::StackableVersion(ProductImageStackableVersion { + product_version: pv, + .. + }) => pv, + } + } } #[cfg(test)]