Skip to content

Commit 5bf58c0

Browse files
Techassisbernauer
andauthored
feat: Support dynamic image repositories (#884)
* feat: Support dynamic image repositories * test: Add placeholder values to satify roundtrip tests * chore: Add changelog entry * test: Add CRD roundtrip test data * chore: Apply suggestion Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.de> --------- Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.tech> Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.de>
1 parent 550d926 commit 5bf58c0

10 files changed

Lines changed: 230 additions & 48 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
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` ([#884]).
910
- Added support for the [PostgreSQL connector](https://trino.io/docs/current/connector/postgresql.html) using the new generic database connection mechanism.
1011
Previously, users had to use the `generic` connector ([#883]).
1112

@@ -17,7 +18,7 @@ All notable changes to this project will be documented in this file.
1718
`spooling-manager.properties`). Previously arbitrary keys were silently accepted
1819
but ignored ([#878]).
1920
- Document Helm deployed RBAC permissions and remove unnecessary permissions ([#869]).
20-
- Bump `stackable-operator` to 0.110.0 and `kube` to 3.1.0 ([#878]).
21+
- Bump `stackable-operator` to 0.111.0 and `kube` to 3.1.0 ([#878], [#884]).
2122

2223
### Fixed
2324

@@ -32,6 +33,7 @@ All notable changes to this project will be documented in this file.
3233
[#876]: https://github.com/stackabletech/trino-operator/pull/876
3334
[#878]: https://github.com/stackabletech/trino-operator/pull/878
3435
[#883]: https://github.com/stackabletech/trino-operator/pull/883
36+
[#884]: https://github.com/stackabletech/trino-operator/pull/884
3537

3638
## [26.3.0] - 2026-03-16
3739

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/trino-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 = ["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
async-trait = "0.1"

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
@@ -2195,8 +2195,9 @@ spec:
21952195
properties:
21962196
custom:
21972197
description: |-
2198-
Overwrite the docker image.
2199-
Specify the full docker image name, e.g. `oci.stackable.tech/sdp/superset:1.4.1-stackable2.1.0`
2198+
Provide a custom container image.
2199+
2200+
Specify the full container image name, e.g. `oci.example.tech/namespace/superset:1.4.1-my-tag`
22002201
type: string
22012202
productVersion:
22022203
description: Version of the product, e.g. `1.4.1`.
@@ -2223,14 +2224,20 @@ spec:
22232224
nullable: true
22242225
type: array
22252226
repo:
2226-
description: Name of the docker repo, e.g. `oci.stackable.tech/sdp`
2227+
description: |-
2228+
The repository on the container image registry where the container image is located, e.g.
2229+
`oci.example.com/namespace`.
2230+
2231+
If not specified, the operator will use the image registry provided via the operator
2232+
environment options.
22272233
nullable: true
22282234
type: string
22292235
stackableVersion:
22302236
description: |-
22312237
Stackable version of the product, e.g. `23.4`, `23.4.1` or `0.0.0-dev`.
2232-
If not specified, the operator will use its own version, e.g. `23.4.1`.
2233-
When using a nightly operator or a pr version, it will use the nightly `0.0.0-dev` image.
2238+
2239+
If not specified, the operator will use its own version, e.g. `23.4.1`. When using a nightly
2240+
operator or a PR version, it will use the nightly `0.0.0-dev` image.
22342241
nullable: true
22352242
type: string
22362243
type: object

rust/operator-binary/src/controller.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use stackable_operator::{
2727
volume::{SecretFormat, SecretOperatorVolumeSourceBuilder, VolumeBuilder},
2828
},
2929
},
30+
cli::OperatorEnvironmentOptions,
3031
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
3132
commons::{
3233
product_image_selection::{self, ResolvedProductImage},
@@ -110,6 +111,7 @@ use crate::{
110111
pub struct Ctx {
111112
pub client: stackable_operator::client::Client,
112113
pub product_config: ProductConfigManager,
114+
pub operator_environment: OperatorEnvironmentOptions,
113115
}
114116

115117
pub const OPERATOR_NAME: &str = "trino.stackable.tech";
@@ -124,7 +126,7 @@ pub const MAX_PREPARE_LOG_FILE_SIZE: MemoryQuantity = MemoryQuantity {
124126
unit: BinaryMultiple::Mebi,
125127
};
126128

127-
const DOCKER_IMAGE_BASE_NAME: &str = "trino";
129+
const CONTAINER_IMAGE_BASE_NAME: &str = "trino";
128130

129131
#[derive(Snafu, Debug, EnumDiscriminants)]
130132
#[strum_discriminants(derive(IntoStaticStr))]
@@ -416,7 +418,11 @@ pub async fn reconcile_trino(
416418
let resolved_product_image = trino
417419
.spec
418420
.image
419-
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::PKG_VERSION)
421+
.resolve(
422+
CONTAINER_IMAGE_BASE_NAME,
423+
&ctx.operator_environment.image_repository,
424+
crate::built_info::PKG_VERSION,
425+
)
420426
.context(ResolveProductImageSnafu)?;
421427

422428
let resolved_authentication_classes =
@@ -1975,7 +1981,7 @@ mod tests {
19751981
let resolved_product_image = trino
19761982
.spec
19771983
.image
1978-
.resolve(DOCKER_IMAGE_BASE_NAME, "0.0.0-dev")
1984+
.resolve(CONTAINER_IMAGE_BASE_NAME, "oci.example.org", "0.0.0-dev")
19791985
.expect("test resolved product image is always valid");
19801986

19811987
let config_files = vec![

0 commit comments

Comments
 (0)