feat(controller): restart services when dynamicConfig changes#135
Merged
Conversation
Design doc for stamping a dynamicconfig-hash annotation on service pods so dynamicConfig changes trigger a rolling restart, mirroring the existing config-hash and cert-hash patterns. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 86e9f3de-efd7-4bbd-ad90-e0f91579ee25 Signed-off-by: Brian Morton <brian@mmmhm.com>
Task-by-task plan to stamp a dynamicconfig-hash annotation on service pods so dynamicConfig changes trigger a rolling restart. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 86e9f3de-efd7-4bbd-ad90-e0f91579ee25 Signed-off-by: Brian Morton <brian@mmmhm.com>
Signed-off-by: Brian Morton <brian@mmmhm.com>
Signed-off-by: Brian Morton <brian@mmmhm.com>
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.
Problem
Changing
spec.dynamicConfigon aTemporalClusterupdated the rendered dynamic-configConfigMapbut did not restart the running service pods, so new values only took effect after a manual rollout.The operator already solves this for static config (
config-hash) and mTLS certs (cert-hash) by stamping a content hash onto the pod template — any hash change mutates the template and triggers a rolling update. The dynamic-config content was simply never included in any pod annotation.Fix
Add a
temporal.bmor10.com/dynamicconfig-hashpod annotation computed from the rendered dynamic config via the existingresources.ConfigHashhelper, threaded through the pureplan.ServicesInputpath (Approach A from the design — a separate annotation, mirroringcert-hash, sokubectl describe podshows which input caused a roll).End-to-end flow:
Both the controller reconcile path (
internal/controller/temporalcluster_services.go) and the preview/plan path (internal/plan/plan.go) compute the hash from the identicalRenderDynamicConfigoutput, keeping them in lockstep. Empty dynamicConfig hashes to a stable constant, so the annotation is always present and deterministic (no spurious rolls).Changes
internal/resources/labels.go— newDynamicConfigHashAnnotationconstant.internal/resources/deployment.go—BuildDeploymenttakesdynamicConfigHash, stamps the annotation.internal/plan/services.go/plan.go— newServicesInput.DynamicConfigHash, populated and passed through.internal/controller/temporalcluster_services.go— populate the hash inreconcileServices.docs/superpowers/.No CRD/API type change → no manifest/Helm/API-doc regeneration.
Verification
make build,make lint(0 issues),make test(all packagesok)Note
On first reconcile after upgrading to this version, existing clusters get the new annotation added to their pod templates, causing a one-time rollout — identical to how
config-hashbehaved when it was introduced, and the intended mechanism.