Skip to content

Commit faec901

Browse files
committed
feat: Support dynamic image repositories
1 parent 352806e commit faec901

7 files changed

Lines changed: 63 additions & 42 deletions

File tree

Cargo.lock

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

Cargo.nix

Lines changed: 18 additions & 12 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/kafka-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 = ["crds", "webhook"] }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.111.1", 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
@@ -2334,8 +2334,9 @@ spec:
23342334
properties:
23352335
custom:
23362336
description: |-
2337-
Overwrite the docker image.
2338-
Specify the full docker image name, e.g. `oci.stackable.tech/sdp/superset:1.4.1-stackable2.1.0`
2337+
Provide a custom container image.
2338+
2339+
Specify the full container image name, e.g. `oci.example.tech/namespace/superset:1.4.1-my-tag`
23392340
type: string
23402341
productVersion:
23412342
description: Version of the product, e.g. `1.4.1`.
@@ -2362,14 +2363,20 @@ spec:
23622363
nullable: true
23632364
type: array
23642365
repo:
2365-
description: Name of the docker repo, e.g. `oci.stackable.tech/sdp`
2366+
description: |-
2367+
The repository on the container image registry where the container image is located, e.g.
2368+
`oci.example.com/namespace`.
2369+
2370+
If not specified, the operator will use the image registry provided via the operator
2371+
environment options.
23662372
nullable: true
23672373
type: string
23682374
stackableVersion:
23692375
description: |-
23702376
Stackable version of the product, e.g. `23.4`, `23.4.1` or `0.0.0-dev`.
2371-
If not specified, the operator will use its own version, e.g. `23.4.1`.
2372-
When using a nightly operator or a pr version, it will use the nightly `0.0.0-dev` image.
2377+
2378+
If not specified, the operator will use its own version, e.g. `23.4.1`. When using a nightly
2379+
operator or a PR version, it will use the nightly `0.0.0-dev` image.
23732380
nullable: true
23742381
type: string
23752382
type: object

rust/operator-binary/src/kafka_controller.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use const_format::concatcp;
66
use product_config::{ProductConfigManager, types::PropertyNameKind};
77
use snafu::{ResultExt, Snafu};
88
use stackable_operator::{
9+
cli::OperatorEnvironmentOptions,
910
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
1011
commons::{
1112
product_image_selection::{self},
@@ -34,8 +35,8 @@ use strum::{EnumDiscriminants, IntoStaticStr};
3435

3536
use crate::{
3637
crd::{
37-
self, APP_NAME, DOCKER_IMAGE_BASE_NAME, JVM_SECURITY_PROPERTIES_FILE, KafkaClusterStatus,
38-
OPERATOR_NAME, authorization,
38+
self, APP_NAME, CONTAINER_IMAGE_BASE_NAME, JVM_SECURITY_PROPERTIES_FILE,
39+
KafkaClusterStatus, OPERATOR_NAME, authorization,
3940
listener::get_kafka_listener_config,
4041
role::{
4142
AnyConfig, KafkaRole, broker::BROKER_PROPERTIES_FILE,
@@ -60,6 +61,7 @@ pub const KAFKA_FULL_CONTROLLER_NAME: &str = concatcp!(KAFKA_CONTROLLER_NAME, '.
6061
pub struct Ctx {
6162
pub client: stackable_operator::client::Client,
6263
pub product_config: ProductConfigManager,
64+
pub operator_environment: OperatorEnvironmentOptions,
6365
}
6466

6567
#[derive(Snafu, Debug, EnumDiscriminants)]
@@ -271,7 +273,11 @@ pub async fn reconcile_kafka(
271273
let resolved_product_image = kafka
272274
.spec
273275
.image
274-
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::PKG_VERSION)
276+
.resolve(
277+
CONTAINER_IMAGE_BASE_NAME,
278+
&ctx.operator_environment.image_repository,
279+
crate::built_info::PKG_VERSION,
280+
)
275281
.context(ResolveProductImageSnafu)?;
276282

277283
let mut cluster_resources = ClusterResources::new(

rust/operator-binary/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ async fn main() -> anyhow::Result<()> {
187187
kafka_controller::error_policy,
188188
Arc::new(kafka_controller::Ctx {
189189
client: client.clone(),
190+
operator_environment,
190191
product_config,
191192
}),
192193
)

0 commit comments

Comments
 (0)