Skip to content

feat: restart statefulsets based on ConfigMap/Secret content - #481

Merged
sweb merged 10 commits into
mainfrom
feat/keyed-hash-for-restart-v2
Dec 2, 2026
Merged

sweb merged 10 commits into
mainfrom
feat/keyed-hash-for-restart-v2

Conversation

@sweb

@sweb sweb commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Description

Adds a keyed digest of the configmap / secret's content to use for detecting required restarts instead of using
resourceVersion which gets bumped by e.g. metadata changes. This should bring down the number of unnecessary restarts.

To create a digest that cannot be reversed into its actual content by brute force, a key is used. It is stored in a secret that is created by the operator. This requires us to extend the permissions to allow for secret creation and retrieving. This is done via a Role, but it requires this change first: stackabletech/stackable-utils#137

The alternative is to go with a ClusterRole, which was discarded to keep the privileges narrow.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added
  • Links to generated (nightly) docs added
  • Release note snippet added
  • Add type/deprecation label & add to the deprecation schedule
  • Add type/experimental label & add to the experimental features tracker

Release Note:

The restart controller now adds a keyed digest as an annotation to detect changes. This avoids restarts based on metadata changes on config maps or secrets, e.g. through CD tools. The key is stored in a secret, managed by the operator.

@sweb
sweb force-pushed the feat/keyed-hash-for-restart-v2 branch 2 times, most recently from bf49a84 to 9efe76a Compare November 25, 2026 12:54
@sbernauer

Copy link
Copy Markdown
Member

A small feature idea:
The restarter could also write the uid/resourceVersion it last checked for each referenced ConfigMap/Secret into an observed.{configmap,secret}.restarter.stackable.tech/<name> annotation on the StatefulSet itself (not its Pod template). That would make "is my Pod up to date?" checkable again: If the observed annotation matches the object's current uid/resourceVersion and the Pod's annotation matches the template's, the Pod has the latest content. Yes, one can also shell into the Pod to check, but it's nice to get this info from k8s alone.

@sbernauer sbernauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically LGTM, I only recommend to remove the UID prefix

@sweb
sweb force-pushed the feat/keyed-hash-for-restart-v2 branch from 9efe76a to f2db3a4 Compare November 30, 2026 09:21
sweb and others added 4 commits November 30, 2026 10:23
@sweb
sweb marked this pull request as ready for review November 30, 2026 12:48
@sweb sweb moved this to Development: In Review in Stackable Engineering Nov 30, 2026

@sbernauer sbernauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behavior, docs and tests LGTM now (I only didn't look at the code so far) 👍

Comment thread CHANGELOG.md Resolved
sbernauer
sbernauer previously approved these changes Dec 1, 2026

@sbernauer sbernauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, many thanks! Clever solution that we can release straight and doesn't cause any unnecessary restarts.

However, I think you were originally right to use a Role (instead of ClusterRole). We shouldn't worsen helm security just because of olm. I raised stackabletech/stackable-utils#137, so we hopefully can switch the PR back to a Role

@sbernauer sbernauer changed the title feat: simplified content digest for restart controller feat: restart statefulsets based on ConfigMap/Secret content Dec 1, 2026
@sbernauer sbernauer added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Dec 2, 2026

@sbernauer sbernauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sweb
sweb added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit b764670 Dec 2, 2026
12 checks passed
@sweb
sweb deleted the feat/keyed-hash-for-restart-v2 branch December 2, 2026 13:01
@lfrancke lfrancke moved this from Development: In Review to Development: Done in Stackable Engineering Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/27.3.0 release-note Denotes a PR that will be considered when it comes time to generate release notes.

Projects

Status: Development: Done

Development

Successfully merging this pull request may close these issues.

2 participants