Repository navigation
fix: Keep published secrets on repeated NodePublishVolume - #773
Merged
Merged
Conversation
The kubelet calls NodePublishVolume again for volumes it already published, for example after a kubelet restart. Every call issued a new secret and moved the restarter's expiry annotation to it. A process that loaded its secret at startup kept using the old one, so the restarter acted on the wrong expiry and could restart the Pod only after the secret in use had expired. A completely published volume now contains an empty marker file, written after the secret files, and a repeated publish returns early when it exists.
Member
Author
|
This should not be merged before coordingating with #774 |
Techassi
self-requested a review
November 9, 2026 08:44
Member
Author
|
I'll fix the conflict. |
lfrancke
force-pushed
the
fix/keep-published-secrets
branch
from
November 9, 2026 10:58
4bfbb11 to
64f0ed8
Compare
lfrancke
enabled auto-merge
November 9, 2026 11:01
This was referenced Nov 9, 2026
Techassi
requested changes
Nov 9, 2026
Techassi
left a comment
Member
There was a problem hiding this comment.
The idea itself sounds good, I just have a few remarks on some security related points.
Processes in the Pod can write to the volume, because the kubelet applies the fsGroup with group write permissions. Checking for the marker no longer follows a symlink, and any entry under its name counts as provisioned: returning early writes nothing, while reissuing on a marker that cannot be written would issue a new secret on every kubelet retry. Writing the marker refuses to follow a symlink. The marker is renamed to .stackable-secret-operator-data-provisioned to avoid collisions with files from other tools.
Counting any entry as provisioned hid tampering. Failing the publish instead stops before the backend is called, so a tampered marker still cannot make every kubelet retry issue a new secret, and the error shows up in the Pod's events. Only the Pod that changed its own volume is affected.
Techassi
approved these changes
Nov 10, 2026
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #772.
It was a coincidence that I was working on this at the same time as Razvan in #772.
When the kubelet calls
NodePublishVolumeagain for a volume that is already published (for example after a kubelet restart), secret-operator issued a new secret and moved therestarter.stackable.tech/expires-at.*annotation to it.The running process keeps the secret it loaded at startup, so the restarter acted on the wrong expiry and could evict the Pod only after the secret in use had expired.
A completely published volume now contains an empty
.secret-operator-publishedmarker, written after the secret files.A repeated publish returns early when it exists: no backend call, no Pod patch, no mount.
Tested on k3d (k3s v1.37.2) by enabling
requiresRepublishfor 20 s:expires-atannotationIndependent of #770 but "related".
Author
Reviewer
Acceptance