Skip to content

Commit 23cae86

Browse files
Techassisbernauersiegfriedweber
authored
feat: Support dynamic image repositories (#141)
* feat: Support dynamic image repositories * test: Add placeholder values to satify roundtrip tests * chore: Add changelog entry * test: Add some roundtrip test data * chore: Update Cargo.nix * chore: Rename stackable_operators -> stackable-operators * chore: Remove dependency to indoc --------- Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.tech> Co-authored-by: Siegfried Weber <mail@siegfriedweber.net>
1 parent 5382bb1 commit 23cae86

11 files changed

Lines changed: 255 additions & 59 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` ([#141]).
910
- Support hot-reloading of security configuration files ([#130]).
1011

1112
### Changed
@@ -18,6 +19,7 @@ All notable changes to this project will be documented in this file.
1819
[#129]: https://github.com/stackabletech/opensearch-operator/pull/129
1920
[#130]: https://github.com/stackabletech/opensearch-operator/pull/130
2021
[#137]: https://github.com/stackabletech/opensearch-operator/pull/137
22+
[#141]: https://github.com/stackabletech/opensearch-operator/pull/141
2123

2224
## [26.3.0] - 2026-03-16
2325

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: 27 additions & 21 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
@@ -10,7 +10,7 @@ edition = "2024"
1010
repository = "https://github.com/stackabletech/opensearch-operator"
1111

1212
[workspace.dependencies]
13-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.110.1", features = ["webhook"] }
13+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.111.1", features = ["webhook"] }
1414

1515
built = { version = "0.8.0", features = ["chrono", "git2"] }
1616
clap = "4.5"

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
@@ -1207,8 +1207,9 @@ spec:
12071207
properties:
12081208
custom:
12091209
description: |-
1210-
Overwrite the docker image.
1211-
Specify the full docker image name, e.g. `oci.stackable.tech/sdp/superset:1.4.1-stackable2.1.0`
1210+
Provide a custom container image.
1211+
1212+
Specify the full container image name, e.g. `oci.example.tech/namespace/superset:1.4.1-my-tag`
12121213
type: string
12131214
productVersion:
12141215
description: Version of the product, e.g. `1.4.1`.
@@ -1235,14 +1236,20 @@ spec:
12351236
nullable: true
12361237
type: array
12371238
repo:
1238-
description: Name of the docker repo, e.g. `oci.stackable.tech/sdp`
1239+
description: |-
1240+
The repository on the container image registry where the container image is located, e.g.
1241+
`oci.example.com/namespace`.
1242+
1243+
If not specified, the operator will use the image registry provided via the operator
1244+
environment options.
12391245
nullable: true
12401246
type: string
12411247
stackableVersion:
12421248
description: |-
12431249
Stackable version of the product, e.g. `23.4`, `23.4.1` or `0.0.0-dev`.
1244-
If not specified, the operator will use its own version, e.g. `23.4.1`.
1245-
When using a nightly operator or a pr version, it will use the nightly `0.0.0-dev` image.
1250+
1251+
If not specified, the operator will use its own version, e.g. `23.4.1`. When using a nightly
1252+
operator or a PR version, it will use the nightly `0.0.0-dev` image.
12461253
nullable: true
12471254
type: string
12481255
type: object

rust/operator-binary/src/controller.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use build::build;
1515
use dereference::dereference;
1616
use snafu::{ResultExt, Snafu};
1717
use stackable_operator::{
18+
cli::OperatorEnvironmentOptions,
1819
cluster_resources::ClusterResourceApplyStrategy,
1920
commons::{
2021
affinity::StackableAffinity, networking::DomainName,
@@ -80,16 +81,22 @@ pub struct ContextNames {
8081

8182
/// The controller context
8283
pub struct Context {
84+
operator_environment: OperatorEnvironmentOptions,
8385
client: stackable_operator::client::Client,
8486
names: ContextNames,
8587
}
8688

8789
impl Context {
88-
pub fn new(client: stackable_operator::client::Client, operator_name: OperatorName) -> Self {
90+
pub fn new(
91+
client: stackable_operator::client::Client,
92+
operator_environment: OperatorEnvironmentOptions,
93+
operator_name: OperatorName,
94+
) -> Self {
8995
let cluster_domain_name = client.kubernetes_cluster_info.cluster_domain.clone();
9096

9197
Context {
9298
client,
99+
operator_environment,
93100
names: Self::context_names(operator_name, cluster_domain_name),
94101
}
95102
}
@@ -454,8 +461,13 @@ pub async fn reconcile(
454461
let preprocessed_cluster = preprocess(cluster);
455462

456463
// validate (no client required)
457-
let validated_cluster = validate(&context.names, &preprocessed_cluster, &dereferenced_objects)
458-
.context(ValidateClusterSnafu)?;
464+
let validated_cluster = validate(
465+
&context.names,
466+
&context.operator_environment,
467+
&preprocessed_cluster,
468+
&dereferenced_objects,
469+
)
470+
.context(ValidateClusterSnafu)?;
459471

460472
// build (no client required; infallible)
461473
let prepared_resources = build(&context.names, validated_cluster.clone());

0 commit comments

Comments
 (0)