feat(health): add /healthz and /readyz endpoints#2559
Open
fseldow wants to merge 8 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Kubernetes-style liveness/readiness endpoints to the internal HTTP server and verifies their behavior with unit tests.
Changes:
- Introduces
/healthz(liveness) and/readyz(readiness) handlers and routes. - Adds a background readiness probe that marks the server ready once an executor is available.
- Adds unit tests covering health and readiness handler responses.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/httpserver/server.go | Adds health state to the server, registers health routes, and starts readiness polling. |
| internal/httpserver/health.go | Implements JSON health/readiness handlers backed by atomic state. |
| internal/httpserver/health_test.go | Adds unit tests for /healthz and /readyz responses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2559 +/- ##
==========================================
+ Coverage 77.62% 78.16% +0.54%
==========================================
Files 105 109 +4
Lines 4657 4956 +299
==========================================
+ Hits 3615 3874 +259
- Misses 893 923 +30
- Partials 149 159 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5cfce60 to
83e5c2e
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: xinhl <xinhl@microsoft.com> Signed-off-by: xinhl <lixin.he@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: xinhl <xinhl@microsoft.com> Signed-off-by: xinhl <lixin.he@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: xinhl <xinhl@microsoft.com> Signed-off-by: xinhl <lixin.he@microsoft.com>
- Add internal/healthprobe package with checker registry and standalone HTTP server - Add manager readiness signal (internal/manager/ready.go) - Move health routes from main TLS router to dedicated plain HTTP port (:9090) - Wire --health-port flag to start health probe server - Update Helm chart to use separate health port Addresses notaryproject#2562 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: xinhl <lixin.he@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: xinhl <lixin.he@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: xinhl <lixin.he@microsoft.com>
37e7b20 to
199008a
Compare
- Add constants for repeated string literals (goconst) - Use errors.Is instead of == for error comparison (errorlint) - Remove unused test parameter (revive) Signed-off-by: xinhl <lixin.he@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: xinhl <lixin.he@microsoft.com>
199008a to
9da7727
Compare
Cover all uncovered lines in internal/httpserver/health.go including nil-receiver paths for MarkAlive, MarkReady, IsAlive, IsReady, AliveChecker, ExecutorChecker, and the nil-getExecutor handler path. Signed-off-by: xinhl <lixin.he@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: xinhl <lixin.he@microsoft.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.
Summary
/healthzand/readyzprobe handlersTesting
Unified health probe
:9090for/healthzand/readyz--health-portflag and Helm chart values to use the unified probe portAddresses #2562