fix: StatefulSet checksums #83
Open
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.
Summary
Replaces runtime lookup-based checksum generation with template-based checksums for ConfigMaps and Secrets, ensuring consistent checksums during helm template and avoiding issues with cluster lookups (i.e. random checksums causing unnecessary pod restarts on every helm upgrade, even when config/secrets haven't changed).
Details
_helpers.tpl:graylog.configChecksum: computes sha256sum of the Graylog ConfigMap templategraylog.datanode.configChecksum: computes sha256sum of the Datanode ConfigMap templategraylog.secretsChecksum: computes sha256sum of the Secrets template with cachinggraylog.yamlanddatanode.yamlStatefulSets:lookupfunction calls andrandAlphaNumfallback logicchecksum/configandchecksum/secretannotationsThe secrets checksum helper caches its result in the template context (
$.__secretsChecksum) to prevent regeneration on each call, ensuring both StatefulSets get the same checksum value.Linked issues
N/A
PR Checklist
Please check the items that apply to your change.
Testing Checklist
Static Validation
helm lint ./charts/grayloghelm template graylog ./charts/graylog --validateInstallation
helm install graylog ./charts/graylogkubectl rollout status statefulset/grayloghelm test graylogFunctional (if applicable)
Upgrade (if applicable)
Specific to this PR
For all the following, watch pods using
kubectl get pods -w:graylog-npods are restarted when graylog-specific configurations options are set: `helm upgrade graylog ./charts/graylog --reuse-values --set graylog.config.timezone="Europe/Madrid"graylog-datanode-npods are restarted when datanode-specific options are set: `helm upgrade graylog ./charts/graylog --reuse-values --set datanode.config.opensearchHeap="3g"Notes for reviewers