Skip to content

feat(controller): restart services when dynamicConfig changes#135

Merged
bmorton merged 4 commits into
mainfrom
feat/restart-on-dynamicconfig-change
Jul 24, 2026
Merged

feat(controller): restart services when dynamicConfig changes#135
bmorton merged 4 commits into
mainfrom
feat/restart-on-dynamicconfig-change

Conversation

@bmorton

@bmorton bmorton commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Problem

Changing spec.dynamicConfig on a TemporalCluster updated the rendered dynamic-config ConfigMap but 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-hash pod annotation computed from the rendered dynamic config via the existing resources.ConfigHash helper, threaded through the pure plan.ServicesInput path (Approach A from the design — a separate annotation, mirroring cert-hash, so kubectl describe pod shows which input caused a roll).

End-to-end flow:

spec.dynamicConfig → RenderDynamicConfig → ConfigHash → DynamicConfigHash
  → plan.ServicesInput → BuildDeployment → pod annotation
  → pod template mutates → rolling restart

Both the controller reconcile path (internal/controller/temporalcluster_services.go) and the preview/plan path (internal/plan/plan.go) compute the hash from the identical RenderDynamicConfig output, 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 — new DynamicConfigHashAnnotation constant.
  • internal/resources/deployment.goBuildDeployment takes dynamicConfigHash, stamps the annotation.
  • internal/plan/services.go / plan.go — new ServicesInput.DynamicConfigHash, populated and passed through.
  • internal/controller/temporalcluster_services.go — populate the hash in reconcileServices.
  • Tests added at the resources, plan layers; existing controller envtest suite passes.
  • Design/plan docs under docs/superpowers/.

No CRD/API type change → no manifest/Helm/API-doc regeneration.

Verification

  • make build, make lint (0 issues), make test (all packages ok)
  • No generated-file drift.

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-hash behaved when it was introduced, and the intended mechanism.

bmorton and others added 4 commits July 24, 2026 03:15
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>
@bmorton
bmorton merged commit b42edb4 into main Jul 24, 2026
15 checks passed
@bmorton
bmorton deleted the feat/restart-on-dynamicconfig-change branch July 24, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant