Skip to content

Commit f0b66a4

Browse files
Techassisbernauer
andauthored
feat: Support dynamic image repositories (#928)
* 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 12050d4 commit f0b66a4

9 files changed

Lines changed: 169 additions & 45 deletions

File tree

CHANGELOG.md

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

77
### Added
88

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` ([#928]).
910
- Support for passing CAs to GitSync ([#903]).
1011
- Added support for NiFi `2.9.0` ([#922]).
1112

@@ -25,6 +26,7 @@ All notable changes to this project will be documented in this file.
2526
[#921]: https://github.com/stackabletech/nifi-operator/pull/921
2627
[#922]: https://github.com/stackabletech/nifi-operator/pull/922
2728
[#924]: https://github.com/stackabletech/nifi-operator/pull/924
29+
[#928]: https://github.com/stackabletech/nifi-operator/pull/928
2830

2931
## [26.3.0] - 2026-03-16
3032

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/nifi-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.1", features = ["webhook"] }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.111.0", features = ["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
@@ -465,8 +465,9 @@ spec:
465465
properties:
466466
custom:
467467
description: |-
468-
Overwrite the docker image.
469-
Specify the full docker image name, e.g. `oci.stackable.tech/sdp/superset:1.4.1-stackable2.1.0`
468+
Provide a custom container image.
469+
470+
Specify the full container image name, e.g. `oci.example.tech/namespace/superset:1.4.1-my-tag`
470471
type: string
471472
productVersion:
472473
description: Version of the product, e.g. `1.4.1`.
@@ -493,14 +494,20 @@ spec:
493494
nullable: true
494495
type: array
495496
repo:
496-
description: Name of the docker repo, e.g. `oci.stackable.tech/sdp`
497+
description: |-
498+
The repository on the container image registry where the container image is located, e.g.
499+
`oci.example.com/namespace`.
500+
501+
If not specified, the operator will use the image registry provided via the operator
502+
environment options.
497503
nullable: true
498504
type: string
499505
stackableVersion:
500506
description: |-
501507
Stackable version of the product, e.g. `23.4`, `23.4.1` or `0.0.0-dev`.
502-
If not specified, the operator will use its own version, e.g. `23.4.1`.
503-
When using a nightly operator or a pr version, it will use the nightly `0.0.0-dev` image.
508+
509+
If not specified, the operator will use its own version, e.g. `23.4.1`. When using a nightly
510+
operator or a PR version, it will use the nightly `0.0.0-dev` image.
504511
nullable: true
505512
type: string
506513
type: object

rust/operator-binary/src/controller.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use stackable_operator::{
2424
security::PodSecurityContextBuilder, volume::SecretFormat,
2525
},
2626
},
27+
cli::OperatorEnvironmentOptions,
2728
client::Client,
2829
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
2930
commons::{
@@ -115,12 +116,13 @@ use crate::{
115116
pub const NIFI_CONTROLLER_NAME: &str = "nificluster";
116117
pub const NIFI_FULL_CONTROLLER_NAME: &str = concatcp!(NIFI_CONTROLLER_NAME, '.', OPERATOR_NAME);
117118

118-
const DOCKER_IMAGE_BASE_NAME: &str = "nifi";
119+
const CONTAINER_IMAGE_BASE_NAME: &str = "nifi";
119120
const LOG_VOLUME_NAME: &str = "log";
120121

121122
pub struct Ctx {
122123
pub client: Client,
123124
pub product_config: ProductConfigManager,
125+
pub operator_environment: OperatorEnvironmentOptions,
124126
}
125127

126128
#[derive(Snafu, Debug, EnumDiscriminants)]
@@ -377,7 +379,11 @@ pub async fn reconcile_nifi(
377379
let resolved_product_image = nifi
378380
.spec
379381
.image
380-
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::PKG_VERSION)
382+
.resolve(
383+
CONTAINER_IMAGE_BASE_NAME,
384+
&ctx.operator_environment.image_repository,
385+
crate::built_info::PKG_VERSION,
386+
)
381387
.context(ResolveProductImageSnafu)?;
382388

383389
tracing::info!("Checking for sensitive key configuration");

0 commit comments

Comments
 (0)