Skip to content

Commit 80c396d

Browse files
Techassisbernauer
andauthored
feat: Support dynamic image repositories (#702)
* feat: Support dynamic image repositories * test: Add placeholder values to satify roundtrip tests * test: Add CRD roundtrip test data * chore: Add changelog entry --------- Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.tech>
1 parent 329d366 commit 80c396d

9 files changed

Lines changed: 173 additions & 45 deletions

File tree

CHANGELOG.md

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

55
## [Unreleased]
66

7+
### Added
8+
9+
- BREAKING: Add required CLI argument and env var to set the image repository used to construct final product image names: `IMAGE_REPOSITORY` (`--image-repository`), eg. `oci.example.org/my/namespace` ([#702]).
10+
711
### Changed
812

913
- BREAKING: `configOverrides` now only accepts the supported config file names `hive-site.xml` and `security.properties`. Previously arbitrary keys were silently accepted but ignored ([#695]).
@@ -17,6 +21,7 @@ All notable changes to this project will be documented in this file.
1721
[#674]: https://github.com/stackabletech/hive-operator/pull/674
1822
[#693]: https://github.com/stackabletech/hive-operator/pull/693
1923
[#695]: https://github.com/stackabletech/hive-operator/pull/695
24+
[#702]: https://github.com/stackabletech/hive-operator/pull/702
2025

2126
## [26.3.0] - 2026-03-16
2227

Cargo.lock

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

Cargo.nix

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repository = "https://github.com/stackabletech/hive-operator"
1111

1212
[workspace.dependencies]
1313
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.8.0" }
14-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.110.0", features = ["crds", "webhook"] }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.111.0", features = ["crds", "webhook"] }
1515

1616
anyhow = "1.0"
1717
built = { version = "0.8", features = ["chrono", "git2"] }

crate-hashes.json

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

extra/crds.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,9 @@ spec:
402402
properties:
403403
custom:
404404
description: |-
405-
Overwrite the docker image.
406-
Specify the full docker image name, e.g. `oci.stackable.tech/sdp/superset:1.4.1-stackable2.1.0`
405+
Provide a custom container image.
406+
407+
Specify the full container image name, e.g. `oci.example.tech/namespace/superset:1.4.1-my-tag`
407408
type: string
408409
productVersion:
409410
description: Version of the product, e.g. `1.4.1`.
@@ -430,14 +431,20 @@ spec:
430431
nullable: true
431432
type: array
432433
repo:
433-
description: Name of the docker repo, e.g. `oci.stackable.tech/sdp`
434+
description: |-
435+
The repository on the container image registry where the container image is located, e.g.
436+
`oci.example.com/namespace`.
437+
438+
If not specified, the operator will use the image registry provided via the operator
439+
environment options.
434440
nullable: true
435441
type: string
436442
stackableVersion:
437443
description: |-
438444
Stackable version of the product, e.g. `23.4`, `23.4.1` or `0.0.0-dev`.
439-
If not specified, the operator will use its own version, e.g. `23.4.1`.
440-
When using a nightly operator or a pr version, it will use the nightly `0.0.0-dev` image.
445+
446+
If not specified, the operator will use its own version, e.g. `23.4.1`. When using a nightly
447+
operator or a PR version, it will use the nightly `0.0.0-dev` image.
441448
nullable: true
442449
type: string
443450
type: object

rust/operator-binary/src/controller.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use stackable_operator::{
3232
},
3333
},
3434
},
35+
cli::OperatorEnvironmentOptions,
3536
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
3637
commons::{
3738
product_image_selection::{self, ResolvedProductImage},
@@ -115,7 +116,7 @@ use crate::{
115116
pub const HIVE_CONTROLLER_NAME: &str = "hivecluster";
116117
pub const HIVE_FULL_CONTROLLER_NAME: &str = concatcp!(HIVE_CONTROLLER_NAME, '.', OPERATOR_NAME);
117118

118-
const DOCKER_IMAGE_BASE_NAME: &str = "hive";
119+
const CONTAINER_IMAGE_BASE_NAME: &str = "hive";
119120

120121
pub const MAX_HIVE_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity {
121122
value: 10.0,
@@ -125,6 +126,7 @@ pub const MAX_HIVE_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity {
125126
pub struct Ctx {
126127
pub client: stackable_operator::client::Client,
127128
pub product_config: ProductConfigManager,
129+
pub operator_environment: OperatorEnvironmentOptions,
128130
}
129131

130132
#[derive(Snafu, Debug, EnumDiscriminants)]
@@ -362,7 +364,11 @@ pub async fn reconcile_hive(
362364
let resolved_product_image = hive
363365
.spec
364366
.image
365-
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::PKG_VERSION)
367+
.resolve(
368+
CONTAINER_IMAGE_BASE_NAME,
369+
&ctx.operator_environment.image_repository,
370+
crate::built_info::PKG_VERSION,
371+
)
366372
.context(ResolveProductImageSnafu)?;
367373
let role = hive.spec.metastore.as_ref().context(NoMetaStoreRoleSnafu)?;
368374
let hive_role = HiveRole::MetaStore;

0 commit comments

Comments
 (0)