Skip to content

Commit a112c5c

Browse files
Techassisbernauer
andauthored
feat: Support dynamic image repositories (#1028)
* feat: Support dynamic image repositories * test: Add placeholder values to satify roundtrip tests * chore: Add changelog entry * test: Add CRD roundtrip test data --------- Co-authored-by: Sebastian Bernauer <sebastian.bernauer@stackable.tech>
1 parent 9d0b22c commit a112c5c

10 files changed

Lines changed: 140 additions & 46 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Added
8+
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` ([#1028]).
10+
711
### Changed
812

913
- Document Helm deployed RBAC permissions and remove unnecessary permissions ([#1020]).
1014
- BREAKING: `configOverrides` now only accepts the known config files (`zoo.cfg` and
1115
`security.properties`).
1216
Previously, arbitrary file names were silently accepted and ignored ([#1027]).
13-
- Bump `stackable-operator` to 0.110.1 ([#1027]).
17+
- Bump `stackable-operator` to 0.111.1 ([#1027], [#1028]).
1418

1519
[#1020]: https://github.com/stackabletech/zookeeper-operator/pull/1020
1620
[#1027]: https://github.com/stackabletech/zookeeper-operator/pull/1027
21+
[#1028]: https://github.com/stackabletech/zookeeper-operator/pull/1028
1722

1823
## [26.3.0] - 2026-03-16
1924

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/zookeeper-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.1", 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
@@ -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/crd/mod.rs

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub const MAX_PREPARE_LOG_FILE_SIZE: MemoryQuantity = MemoryQuantity {
8585
unit: BinaryMultiple::Mebi,
8686
};
8787

88-
pub const DOCKER_IMAGE_BASE_NAME: &str = "zookeeper";
88+
pub const CONTAINER_IMAGE_BASE_NAME: &str = "zookeeper";
8989

9090
const DEFAULT_SERVER_GRACEFUL_SHUTDOWN_TIMEOUT: Duration = Duration::from_minutes_unchecked(2);
9191
pub const DEFAULT_LISTENER_CLASS: &str = "cluster-internal";
@@ -750,6 +750,8 @@ impl v1alpha1::ZookeeperCluster {
750750

751751
#[cfg(test)]
752752
mod tests {
753+
use stackable_operator::versioned::test_utils::RoundtripTestData;
754+
753755
use super::*;
754756

755757
fn get_server_secret_class(zk: &v1alpha1::ZookeeperCluster) -> Option<&str> {
@@ -929,4 +931,63 @@ mod tests {
929931
tls::quorum_tls_default().as_str()
930932
);
931933
}
934+
935+
impl RoundtripTestData for v1alpha1::ZookeeperClusterSpec {
936+
fn roundtrip_test_data() -> Vec<Self> {
937+
stackable_operator::utils::yaml_from_str_singleton_map(indoc::indoc! {r#"
938+
- image:
939+
productVersion: 1.2.3
940+
pullPolicy: IfNotPresent
941+
clusterOperation:
942+
reconciliationPaused: false
943+
stopped: true
944+
clusterConfig:
945+
authentication:
946+
- authenticationClass: my-auth-class
947+
tls:
948+
quorumSecretClass: null
949+
serverSecretClass: tls
950+
vectorAggregatorConfigMapName: vector-aggregator-discovery
951+
servers:
952+
envOverrides:
953+
COMMON_VAR: role-value
954+
ROLE_VAR: role-value
955+
config:
956+
logging:
957+
enableVectorAgent: true
958+
requestedSecretLifetime: 7d
959+
gracefulShutdownTimeout: 30s
960+
initLimit: 5
961+
syncLimit: 2
962+
tickTime: 2000
963+
myidOffset: 1
964+
configOverrides:
965+
zoo.cfg:
966+
maxClientCnxns: "60"
967+
roleConfig:
968+
listenerClass: cluster-internal
969+
roleGroups:
970+
default:
971+
replicas: 1
972+
configOverrides:
973+
zoo.cfg:
974+
maxClientCnxns: "120"
975+
envOverrides:
976+
COMMON_VAR: group-value
977+
GROUP_VAR: group-value
978+
"#})
979+
.expect("Failed to parse ZookeeperClusterSpec YAML")
980+
}
981+
}
982+
983+
impl RoundtripTestData for v1alpha1::ZookeeperZnodeSpec {
984+
fn roundtrip_test_data() -> Vec<Self> {
985+
stackable_operator::utils::yaml_from_str_singleton_map(indoc::indoc! {"
986+
- clusterRef:
987+
name: test-zk
988+
namespace: default
989+
"})
990+
.expect("Failed to parse ZookeeperZnodeSpec YAML")
991+
}
992+
}
932993
}

rust/operator-binary/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ async fn main() -> anyhow::Result<()> {
158158
zk_controller::reconcile_zk,
159159
zk_controller::error_policy,
160160
Arc::new(zk_controller::Ctx {
161+
operator_environment: operator_environment.clone(),
161162
client: client.clone(),
162163
product_config,
163164
}),
@@ -224,6 +225,7 @@ async fn main() -> anyhow::Result<()> {
224225
znode_controller::error_policy,
225226
Arc::new(znode_controller::Ctx {
226227
client: client.clone(),
228+
operator_environment,
227229
}),
228230
)
229231
// We can let the reporting happen in the background

0 commit comments

Comments
 (0)