Skip to content

Commit 8a5354b

Browse files
authored
fix: Set restarter label on StatefulSets, not on Pods (#932)
* fix: Set restarter label on StatefulSets, not on Pods * changelog
1 parent 3986eeb commit 8a5354b

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +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]).
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], [#932]).
1313

1414
### Changed
1515

@@ -29,6 +29,7 @@ All notable changes to this project will be documented in this file.
2929
[#927]: https://github.com/stackabletech/kafka-operator/pull/927
3030
[#929]: https://github.com/stackabletech/kafka-operator/pull/929
3131
[#930]: https://github.com/stackabletech/kafka-operator/pull/930
32+
[#932]: https://github.com/stackabletech/kafka-operator/pull/932
3233

3334
## [25.11.0] - 2025-11-07
3435

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ pub fn build_broker_rolegroup_statefulset(
427427
let metadata = ObjectMetaBuilder::new()
428428
.with_recommended_labels(recommended_object_labels)
429429
.context(MetadataBuildSnafu)?
430-
.with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned())
431430
.build();
432431

433432
if let Some(listener_class) = merged_config.listener_class() {
@@ -525,6 +524,7 @@ pub fn build_broker_rolegroup_statefulset(
525524
&rolegroup_ref.role_group,
526525
))
527526
.context(MetadataBuildSnafu)?
527+
.with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned())
528528
.build(),
529529
spec: Some(StatefulSetSpec {
530530
pod_management_policy: Some("Parallel".to_string()),
@@ -836,6 +836,7 @@ pub fn build_controller_rolegroup_statefulset(
836836
&rolegroup_ref.role_group,
837837
))
838838
.context(MetadataBuildSnafu)?
839+
.with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned())
839840
.build(),
840841
spec: Some(StatefulSetSpec {
841842
pod_management_policy: Some("Parallel".to_string()),

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

Lines changed: 15 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
status:
1114
readyReplicas: 1
1215
replicas: 1
@@ -15,6 +18,9 @@ apiVersion: apps/v1
1518
kind: StatefulSet
1619
metadata:
1720
name: test-kafka-broker-automatic-log-config
21+
generation: 1 # There should be no unneeded Pod restarts
22+
labels:
23+
restarter.stackable.tech/enabled: "true"
1824
status:
1925
readyReplicas: 1
2026
replicas: 1
@@ -23,6 +29,9 @@ apiVersion: apps/v1
2329
kind: StatefulSet
2430
metadata:
2531
name: test-kafka-broker-custom-log-config
32+
generation: 1 # There should be no unneeded Pod restarts
33+
labels:
34+
restarter.stackable.tech/enabled: "true"
2635
status:
2736
readyReplicas: 1
2837
replicas: 1
@@ -31,6 +40,9 @@ apiVersion: apps/v1
3140
kind: StatefulSet
3241
metadata:
3342
name: test-kafka-controller-automatic-log-config
43+
generation: 1 # There should be no unneeded Pod restarts
44+
labels:
45+
restarter.stackable.tech/enabled: "true"
3446
status:
3547
readyReplicas: 1
3648
replicas: 1
@@ -39,6 +51,9 @@ apiVersion: apps/v1
3951
kind: StatefulSet
4052
metadata:
4153
name: test-kafka-controller-custom-log-config
54+
generation: 1 # There should be no unneeded Pod restarts
55+
labels:
56+
restarter.stackable.tech/enabled: "true"
4257
status:
4358
readyReplicas: 1
4459
replicas: 1

0 commit comments

Comments
 (0)