Skip to content

Commit 2845c21

Browse files
committed
feat: Enable restart controller
1 parent e3f51ea commit 2845c21

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ All notable changes to this project will be documented in this file.
99
- Add `ZOOCFGDIR` env var to `/stackable/rwconfig` to improve shell script usage like `zkCleanup.sh` ([#988]).
1010
- Support objectOverrides using `.spec.objectOverrides`.
1111
See [objectOverrides concepts page](https://docs.stackable.tech/home/nightly/concepts/overrides/#object-overrides) for details ([#987]).
12+
- Enable the [restart-controller](https://docs.stackable.tech/home/nightly/commons-operator/restarter/), so that the Pods are automatically restarted on config changes ([#XXX]).
1213

1314
[#987]: https://github.com/stackabletech/zookeeper-operator/pull/987
1415
[#988]: https://github.com/stackabletech/zookeeper-operator/pull/988
16+
[#XXX]: https://github.com/stackabletech/zookeeper-operator/pull/XXX
1517

1618
## [25.11.0] - 2025-11-07
1719

rust/operator-binary/src/zk_controller.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use stackable_operator::{
5151
core::{DeserializeGuard, error_boundary},
5252
runtime::controller,
5353
},
54-
kvp::{LabelError, Labels},
54+
kvp::{Label, LabelError, Labels},
5555
logging::controller::ReconcilerError,
5656
product_config_utils::{transform_all_roles_to_config, validate_all_roles_and_groups_config},
5757
product_logging::{
@@ -486,6 +486,9 @@ pub async fn reconcile_zk(
486486
rolegroup: rolegroup.clone(),
487487
})?;
488488

489+
// Note: The StatefulSet needs to be applied after all ConfigMaps and Secrets it mounts
490+
// to prevent unnecessary Pod restarts.
491+
// See https://github.com/stackabletech/commons-operator/issues/111 for details.
489492
ss_cond_builder.add(
490493
cluster_resources
491494
.add(client, rg_statefulset)
@@ -1019,10 +1022,11 @@ fn build_server_rolegroup_statefulset(
10191022
&rolegroup_ref.role,
10201023
&rolegroup_ref.role_group,
10211024
))
1022-
// The initial restart muddles up the integration tests. This can be re-enabled as soon
1023-
// as https://github.com/stackabletech/commons-operator/issues/111 is implemented.
1024-
// .with_label("restarter.stackable.tech/enabled", "true")
10251025
.context(ObjectMetaSnafu)?
1026+
.with_label(
1027+
Label::try_from(("restarter.stackable.tech/enabled", "true"))
1028+
.expect("static label is always valid"),
1029+
)
10261030
.build();
10271031

10281032
let statefulset_match_labels =

tests/templates/kuttl/smoke/10-assert.yaml.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ apiVersion: apps/v1
99
kind: StatefulSet
1010
metadata:
1111
name: test-zk-server-primary
12+
generation: 1 # There should be no unneeded Pod restarts
1213
spec:
1314
template:
1415
spec:

0 commit comments

Comments
 (0)