Skip to content

feat(health): add /healthz and /readyz endpoints#2559

Open
fseldow wants to merge 8 commits into
notaryproject:mainfrom
fseldow:xinhl/alpha2-health-endpoints
Open

feat(health): add /healthz and /readyz endpoints#2559
fseldow wants to merge 8 commits into
notaryproject:mainfrom
fseldow:xinhl/alpha2-health-endpoints

Conversation

@fseldow

@fseldow fseldow commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add unauthenticated /healthz and /readyz probe handlers
  • track server liveness/readiness and mark readiness once an executor is available
  • add focused unit coverage for health endpoint responses

Testing

  • go test ./internal/httpserver

Unified health probe

  • add a dedicated plain HTTP health probe server on :9090 for /healthz and /readyz
  • register readiness checks for both the controller-runtime manager and the Ratify HTTP server executor
  • wire the --health-port flag and Helm chart values to use the unified probe port

Addresses #2562

Copilot AI review requested due to automatic review settings June 1, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/httpserver/server.go Outdated
Comment thread internal/httpserver/health.go Outdated
Comment thread internal/httpserver/server.go Outdated
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.04983% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.16%. Comparing base (c6a515a) to head (48e03b5).

Files with missing lines Patch % Lines
internal/manager/manager.go 0.00% 16 Missing ⚠️
internal/httpserver/server.go 37.50% 11 Missing and 4 partials ⚠️
cmd/ratify-gatekeeper-provider/main.go 42.85% 7 Missing and 5 partials ⚠️
internal/manager/ready.go 92.85% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

fseldow and others added 6 commits June 2, 2026 00:21
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>
@fseldow fseldow force-pushed the xinhl/alpha2-health-endpoints branch 2 times, most recently from 37e7b20 to 199008a Compare June 1, 2026 14:53
- 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>
@fseldow fseldow force-pushed the xinhl/alpha2-health-endpoints branch from 199008a to 9da7727 Compare June 1, 2026 14:58
@fseldow fseldow marked this pull request as ready for review June 1, 2026 17:28
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>
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.

2 participants