You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(cozystack-api): Implement hot reload for ApplicationDefinition changes #1960
Currently, when ApplicationDefinition resources change, cozystack-controller triggers a full restart of the cozystack-api pod by patching the pod template annotation. This causes:
Race condition at startup — if CRD doesn't exist yet, apiserver waits up to 30 minutes
Downtime — full process restart on every CRD change
External dependency — relies on controller to manage apiserver lifecycle
Proposal
Implement hot reload inside apiserver following the pattern from apiextensions-apiserver:
apiserver watches ApplicationDefinition directly via controller-runtime informer
On changes, atomically updates REST handlers using atomic.Value
Updates OpenAPI schema dynamically via OpenAPIVersionedService.UpdateSpec()
No process restart required
Implementation outline
Create DynamicResourceHandler with atomic storage for REST handlers
Create HotReloadController that watches CRD and computes diffs
Remove blocking retry loop in Complete() — start with empty config
Remove restart logic from cozystackresource_controller.go
Benefits
Zero downtime on CRD changes
Faster startup (no waiting for CRD)
Simpler architecture (no external restart trigger)
Activity
github-actions commentedon May 2, 2026
This issue has had no activity for 60 days and was marked
lifecycle/stale.It will be closed in 14 days unless commented or labelled
lifecycle/frozen.dosubot commentedon Aug 1, 2026
Hi, Andrei Kvapil (@kvaps). I'm Dosu, and I'm helping the cozystack team manage their backlog and am marking this issue as stale.
Issue Summary
cozystack-apisoApplicationDefinitionchanges can update REST handlers and OpenAPI specs dynamically.cozystack-controllerfor managing the API server lifecycle.github-actionsstale notice after 60 days of inactivity.Next Steps
Thanks for your understanding and contribution.