From 2b1c50b23611c9c6ea25dae4e1b91ead57d92d84 Mon Sep 17 00:00:00 2001 From: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> Date: Thu, 20 Aug 2026 16:09:46 +0200 Subject: [PATCH] feat: Enable restarter-controller for history and connect server StatefulSets Add the restarter.stackable.tech/enabled=true label to the SparkHistoryServer and SparkConnectServer StatefulSets, opting them into the external restarter-controller so their Pods are rolled automatically when a mounted ConfigMap or Secret changes. Part of the operator-wide restart-controller rollout tracked in stackabletech/issues#816. Co-Authored-By: Claude Sonnet 5 --- CHANGELOG.md | 7 +++++++ .../operator-binary/src/connect/controller/build/server.rs | 4 ++++ .../src/history/controller/build/resource/statefulset.rs | 4 ++++ .../templates/kuttl/spark-connect-kerberos/12-assert.yaml | 3 +++ tests/templates/kuttl/spark-connect/12-assert.yaml | 3 +++ tests/templates/kuttl/spark-history-server/06-assert.yaml | 4 ++++ 6 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 577678ef..57e66ae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- The history server and Spark Connect server StatefulSets now carry the + `restarter.stackable.tech/enabled: "true"` label, opting them into the restarter-controller so + that their Pods are automatically rolled when a mounted ConfigMap or Secret changes ([#754]). + ### Changed - Internal operator refactoring: introduce a build() step in the history and connect @@ -46,6 +52,7 @@ All notable changes to this project will be documented in this file. [#745]: https://github.com/stackabletech/spark-k8s-operator/pull/745 [#746]: https://github.com/stackabletech/spark-k8s-operator/pull/746 [#753]: https://github.com/stackabletech/spark-k8s-operator/pull/753 +[#754]: https://github.com/stackabletech/spark-k8s-operator/pull/754 ## [26.7.0] - 2026-07-21 diff --git a/rust/operator-binary/src/connect/controller/build/server.rs b/rust/operator-binary/src/connect/controller/build/server.rs index 419bfefc..28f1839b 100644 --- a/rust/operator-binary/src/connect/controller/build/server.rs +++ b/rust/operator-binary/src/connect/controller/build/server.rs @@ -16,6 +16,7 @@ use stackable_operator::{ }, }, }, + constants::RESTART_CONTROLLER_ENABLED_LABEL, crd::listener, k8s_openapi::{ DeepMerge, @@ -324,6 +325,9 @@ pub(crate) fn build_stateful_set( object_name(&validated.name_any(), SparkConnectRole::Server), SparkConnectRole::Server, ) + // Opt into the restarter-controller: it rolls the StatefulSet's Pods when a mounted + // ConfigMap or Secret changes. See stackabletech/issues#816. + .with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned()) .build(), spec: Some(StatefulSetSpec { template: pod_template, diff --git a/rust/operator-binary/src/history/controller/build/resource/statefulset.rs b/rust/operator-binary/src/history/controller/build/resource/statefulset.rs index 5cad8c51..47b97f40 100644 --- a/rust/operator-binary/src/history/controller/build/resource/statefulset.rs +++ b/rust/operator-binary/src/history/controller/build/resource/statefulset.rs @@ -7,6 +7,7 @@ use stackable_operator::{ pod::{PodBuilder, security::PodSecurityContextBuilder, volume::VolumeBuilder}, }, constant, + constants::RESTART_CONTROLLER_ENABLED_LABEL, k8s_openapi::{ DeepMerge, api::apps::v1::{StatefulSet, StatefulSetSpec}, @@ -247,6 +248,9 @@ pub(crate) fn build_stateful_set( resource_names.stateful_set_name().to_string(), role_group_name, ) + // Opt into the restarter-controller: it rolls the StatefulSet's Pods when a mounted + // ConfigMap or Secret changes. See stackabletech/issues#816. + .with_label(RESTART_CONTROLLER_ENABLED_LABEL.to_owned()) .build(); Ok(StatefulSet { diff --git a/tests/templates/kuttl/spark-connect-kerberos/12-assert.yaml b/tests/templates/kuttl/spark-connect-kerberos/12-assert.yaml index 0e3a98f9..83387dab 100644 --- a/tests/templates/kuttl/spark-connect-kerberos/12-assert.yaml +++ b/tests/templates/kuttl/spark-connect-kerberos/12-assert.yaml @@ -7,11 +7,14 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: spark-connect-server + # generation stays at 1: the restarter-controller label must not itself trigger a rollout. + generation: 1 labels: app.kubernetes.io/component: server app.kubernetes.io/instance: spark-connect app.kubernetes.io/managed-by: spark.stackable.tech_connect app.kubernetes.io/name: spark-connect + restarter.stackable.tech/enabled: "true" stackable.tech/vendor: Stackable ownerReferences: - apiVersion: spark.stackable.tech/v1alpha1 diff --git a/tests/templates/kuttl/spark-connect/12-assert.yaml b/tests/templates/kuttl/spark-connect/12-assert.yaml index 0e3a98f9..83387dab 100644 --- a/tests/templates/kuttl/spark-connect/12-assert.yaml +++ b/tests/templates/kuttl/spark-connect/12-assert.yaml @@ -7,11 +7,14 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: spark-connect-server + # generation stays at 1: the restarter-controller label must not itself trigger a rollout. + generation: 1 labels: app.kubernetes.io/component: server app.kubernetes.io/instance: spark-connect app.kubernetes.io/managed-by: spark.stackable.tech_connect app.kubernetes.io/name: spark-connect + restarter.stackable.tech/enabled: "true" stackable.tech/vendor: Stackable ownerReferences: - apiVersion: spark.stackable.tech/v1alpha1 diff --git a/tests/templates/kuttl/spark-history-server/06-assert.yaml b/tests/templates/kuttl/spark-history-server/06-assert.yaml index 1381497c..9c0cb839 100644 --- a/tests/templates/kuttl/spark-history-server/06-assert.yaml +++ b/tests/templates/kuttl/spark-history-server/06-assert.yaml @@ -7,6 +7,10 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: spark-history-node-default + # generation stays at 1: the restarter-controller label must not itself trigger a rollout. + generation: 1 + labels: + restarter.stackable.tech/enabled: "true" status: readyReplicas: 1 ---