Skip to content

Commit bc99c4e

Browse files
committed
feat: Support dynamic image repositories
1 parent 8ff2b48 commit bc99c4e

7 files changed

Lines changed: 62 additions & 41 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/hbase-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
@@ -145,8 +145,9 @@ spec:
145145
properties:
146146
custom:
147147
description: |-
148-
Overwrite the docker image.
149-
Specify the full docker image name, e.g. `oci.stackable.tech/sdp/superset:1.4.1-stackable2.1.0`
148+
Provide a custom container image.
149+
150+
Specify the full container image name, e.g. `oci.example.tech/namespace/superset:1.4.1-my-tag`
150151
type: string
151152
productVersion:
152153
description: Version of the product, e.g. `1.4.1`.
@@ -173,14 +174,20 @@ spec:
173174
nullable: true
174175
type: array
175176
repo:
176-
description: Name of the docker repo, e.g. `oci.stackable.tech/sdp`
177+
description: |-
178+
The repository on the container image registry where the container image is located, e.g.
179+
`oci.example.com/namespace`.
180+
181+
If not specified, the operator will use the image registry provided via the operator
182+
environment options.
177183
nullable: true
178184
type: string
179185
stackableVersion:
180186
description: |-
181187
Stackable version of the product, e.g. `23.4`, `23.4.1` or `0.0.0-dev`.
182-
If not specified, the operator will use its own version, e.g. `23.4.1`.
183-
When using a nightly operator or a pr version, it will use the nightly `0.0.0-dev` image.
188+
189+
If not specified, the operator will use its own version, e.g. `23.4.1`. When using a nightly
190+
operator or a PR version, it will use the nightly `0.0.0-dev` image.
184191
nullable: true
185192
type: string
186193
type: object

rust/operator-binary/src/hbase_controller.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use stackable_operator::{
2525
security::PodSecurityContextBuilder,
2626
},
2727
},
28+
cli::OperatorEnvironmentOptions,
2829
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
2930
commons::{
3031
product_image_selection::{self, ResolvedProductImage},
@@ -106,11 +107,12 @@ const HDFS_DISCOVERY_TMP_DIR: &str = "/stackable/tmp/hdfs";
106107
const HBASE_CONFIG_TMP_DIR: &str = "/stackable/tmp/hbase";
107108
const HBASE_LOG_CONFIG_TMP_DIR: &str = "/stackable/tmp/log_config";
108109

109-
const DOCKER_IMAGE_BASE_NAME: &str = "hbase";
110+
const CONTAINER_IMAGE_BASE_NAME: &str = "hbase";
110111

111112
pub struct Ctx {
112113
pub client: stackable_operator::client::Client,
113114
pub product_config: ProductConfigManager,
115+
pub operator_environment: OperatorEnvironmentOptions,
114116
}
115117

116118
#[derive(Snafu, Debug, EnumDiscriminants)]
@@ -326,7 +328,11 @@ pub async fn reconcile_hbase(
326328
let resolved_product_image = hbase
327329
.spec
328330
.image
329-
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::PKG_VERSION)
331+
.resolve(
332+
CONTAINER_IMAGE_BASE_NAME,
333+
&ctx.operator_environment.image_repository,
334+
crate::built_info::PKG_VERSION,
335+
)
330336
.context(ResolveProductImageSnafu)?;
331337
let zookeeper_connection_information = ZookeeperConnectionInformation::retrieve(hbase, client)
332338
.await

rust/operator-binary/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ async fn main() -> anyhow::Result<()> {
163163
hbase_controller::error_policy,
164164
Arc::new(hbase_controller::Ctx {
165165
client: client.clone(),
166+
operator_environment,
166167
product_config,
167168
}),
168169
)

0 commit comments

Comments
 (0)