fix: Ensure watcher reacts to atomic file updates in Kubernetes mounts#2928
Merged
fix: Ensure watcher reacts to atomic file updates in Kubernetes mounts#2928
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release #2928 +/- ##
===========================================
- Coverage 91.29% 91.14% -0.16%
===========================================
Files 283 283
Lines 10672 10705 +33
===========================================
+ Hits 9743 9757 +14
- Misses 677 689 +12
- Partials 252 259 +7 ☔ View full report in Codecov by Sentry. |
2 tasks
Contributor
|
I can confirm this is working for me in Kubernetes. I rotated it twice to ensure that the second file was being watched correctly, too. for i in 1 2 3; do
openssl ecparam -name secp384r1 -genkey -noout -out heimdall-key.pem
openssl req -new -x509 \
-subj /CN=heimdall \
-addext keyUsage=digitalSignature \
-days 365 \
-key heimdall-key.pem -out heimdall-cert.pem
key_id="heimdall-$(date +%Y%m%d)-00${i}"
(sed -E "s/^(-----BEGIN.*)$/\1\nX-Key-ID: $key_id\n/" heimdall-key.pem; cat heimdall-cert.pem) > heimdall-chain-${i}.pem
rm heimdall-key.pem heimdall-cert.pem
done
kubectl create secret generic heimdall-certs-ad-hoc -n lfx --from-literal="signer.pem=$(cat heimdall-chain-1.pem)" --save-config
# [ ... restart pods on PR version]
kubectl exec -n lfx lfx-platform-heimdall-789665794b-q8lsc -- /opt/heimdall/heimdall --version
# => heimdall version 4fc48483
curl -s http://lfx-platform-heimdall.lfx.svc.cluster.local:4457/.well-known/jwks | jq '.keys[0].kid'
# => "heimdall-20251211-001"
kubectl get -n lfx secret/heimdall-certs-ad-hoc -o yaml | yq ".data[\"signer.pem\"]=\"$(cat heimdall-chain-2.pem | base64)\"" | k apply -f -
# [... small delay]
curl -s http://lfx-platform-heimdall.lfx.svc.cluster.local:4457/.well-known/jwks | jq '.keys[0].kid'
# => "heimdall-20251211-002"
kubectl get -n lfx secret/heimdall-certs-ad-hoc -o yaml | yq ".data[\"signer.pem\"]=\"$(cat heimdall-chain-3.pem | base64)\"" | k apply -f -
# [... small delay]
curl -s http://lfx-platform-heimdall.lfx.svc.cluster.local:4457/.well-known/jwks | jq '.keys[0].kid'
# => "heimdall-20251211-003"Logs: |
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.
Related issue(s)
closes #2926
Checklist
Description
The watcher implementation did not account for “atomic” file or directory updates, typically performed via symlink replacement (as used by Kubernetes for secret and config map mounts). This PR adds proper handling for such atomic updates.