Skip to content

Commit 3986eeb

Browse files
feat: Enable restart controller (#930)
* feat: Enable restart controller * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Malte Sander <contact@maltesander.com> * Improve assertion --------- Co-authored-by: Malte Sander <contact@maltesander.com>
1 parent a10ae5f commit 3986eeb

8 files changed

Lines changed: 41 additions & 31 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
99
- Support objectOverrides using `.spec.objectOverrides`.
1010
See [objectOverrides concepts page](https://docs.stackable.tech/home/nightly/concepts/overrides/#object-overrides) for details ([#927]).
1111
- Added experimental support for `4.1.1` ([#929])
12+
- Enable the [restart-controller](https://docs.stackable.tech/home/nightly/commons-operator/restarter/), so that the Pods are automatically restarted on config changes ([#930]).
1213

1314
### Changed
1415

@@ -27,6 +28,7 @@ All notable changes to this project will be documented in this file.
2728
[#925]: https://github.com/stackabletech/kafka-operator/pull/925
2829
[#927]: https://github.com/stackabletech/kafka-operator/pull/927
2930
[#929]: https://github.com/stackabletech/kafka-operator/pull/929
31+
[#930]: https://github.com/stackabletech/kafka-operator/pull/930
3032

3133
## [25.11.0] - 2025-11-07
3234

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 15 additions & 15 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/kafka-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.101.2", features = ["telemetry", "versioned"] }
14+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.102.0", features = ["telemetry", "versioned"] }
1515

1616
anyhow = "1.0"
1717
built = { version = "0.8", features = ["chrono", "git2"] }

crate-hashes.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/operator-binary/src/kafka_controller.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ pub async fn reconcile_kafka(
463463
rolegroup: rolegroup_ref.clone(),
464464
})?;
465465

466+
// Note: The StatefulSet needs to be applied after all ConfigMaps and Secrets it mounts
467+
// to prevent unnecessary Pod restarts.
468+
// See https://github.com/stackabletech/commons-operator/issues/111 for details.
466469
ss_cond_builder.add(
467470
cluster_resources
468471
.add(client, rg_statefulset)

rust/operator-binary/src/resource/statefulset.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use stackable_operator::{
1717
},
1818
},
1919
commons::product_image_selection::ResolvedProductImage,
20+
constants::RESTART_CONTROLLER_ENABLED_LABEL,
2021
k8s_openapi::{
2122
DeepMerge,
2223
api::{
@@ -426,6 +427,7 @@ pub fn build_broker_rolegroup_statefulset(
426427
let metadata = ObjectMetaBuilder::new()
427428
.with_recommended_labels(recommended_object_labels)
428429
.context(MetadataBuildSnafu)?
430+
.with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned())
429431
.build();
430432

431433
if let Some(listener_class) = merged_config.listener_class() {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ apiVersion: apps/v1
77
kind: StatefulSet
88
metadata:
99
name: test-kafka-broker-default
10+
generation: 1 # There should be no unneeded Pod restarts
11+
labels:
12+
restarter.stackable.tech/enabled: "true"
1013
spec:
1114
template:
1215
spec:

0 commit comments

Comments
 (0)