feat(cli): add SIGHUP config hot-reload#68
Open
abhinav-1504 wants to merge 3 commits into
Open
Conversation
|
🚀 First PR — welcome aboard! A few things to expect:
If you get stuck, reply here or jump to Discussions. We want this PR to land. |
7 tasks
- Add signal.Notify(SIGHUP) handler in internal/cli/start.go - Add Config.ReloadFrom() with diff in internal/config/reload.go - Add Engine.UpdateThresholds() for live threshold swap in internal/doctor/engine.go - Add ExecReload=/bin/kill -HUP in deploy/systemd/kerno.service - Add SIGHUP daemon phase test in scripts/verify.sh Closes optiqor#34 Signed-off-by: Abhinav <abhinavsinghc@gmail.com> Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
Signed-off-by: Abhinav <abhinavsinghc@gmail.com> Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
d662590 to
0b0ff62
Compare
btwshivam
requested changes
May 14, 2026
Member
btwshivam
left a comment
There was a problem hiding this comment.
good shape overall, but the CI workflows (Build / Test / Lint / Docker) never actually ran on this branch — only label and conventional-title show up. that hides several real issues: a global cfg data race, healthz reporting 0/0 after a rebind, and an any→interface{} revert of PR #54. flag them, push a fix, and let CI verify.
- use atomic.Pointer[config.Config] to eliminate cfg data race
- pass real loadedCount/totalLoaders to rebindPrometheus (fixes 0/0 healthz)
- use map[string]any instead of map[string]interface{} (PR optiqor#54 idiom)
- drive threshold update from result.Applied, not re-diffing struct
- add reload_test.go: 19 table-driven cases covering all diff() branches
Signed-off-by: Abhinav Singh Chauhan <abhinavsinghc48@gmail.com>
Author
|
@btwshivam, all issues fixed. |
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.
What
Adds SIGHUP-based config hot-reload to the kerno daemon. Operators can now change config without restarting — no BPF programs are dropped.
Why
Fixes #34
How
start.go— goroutine listens onsighupCh, callshandleSIGHUP()on every signalconfig/reload.go—ReloadFrom()re-reads config via same Viper pipeline, diffs old vs new, classifies changes as "applied" or "restart-required"doctor/engine.go—UpdateThresholds()withsync.RWMutexfor goroutine-safe hot-swapkerno.service—ExecReload=/bin/kill -HUP $MAINPIDsosystemctl reload kernoworksTesting
go build ./...passesgo test ./...passesgo vet ./...passesgolangci-lint run ./...passessudo ./bin/kerno start+sudo kill -HUP $(pidof kerno)Verified on WSL2 Ubuntu 24.04, kernel 5.15:
{"msg":"SIGHUP received — reloading config"}
{"msg":"applying hot-reload change","change":"log_level: "debug" → "info""}
{"msg":"config reloaded; 3 changes applied; 0 changes require restart"}
{"msg":"HTTP server restarted","addr":":9090"}
sudo ./bin/bpf-verify --read 5sconfirms 6/6 programs still load./scripts/verify.shdaemon phase updated for SIGHUP testChecklist
feat(scope): subject)git commit -s)