Skip to content

feat: add dedicated health check endpoints for flightdeck#77

Merged
ian-flores merged 3 commits intomainfrom
add-flightdeck-health-endpoints
Feb 10, 2026
Merged

feat: add dedicated health check endpoints for flightdeck#77
ian-flores merged 3 commits intomainfrom
add-flightdeck-health-endpoints

Conversation

@ian-flores
Copy link
Collaborator

Summary

  • Adds /healthz endpoint for liveness probe - lightweight check that only verifies the process is alive
  • Adds /readyz endpoint for readiness probe - checks k8s API connectivity by attempting to fetch Site CR
  • Updates controller to use new probe paths instead of the homepage

Context

Currently, flightdeck uses the homepage (/) for both liveness and readiness probes. This is problematic because the homepage fetches Site CRs from the Kubernetes API on every request. This means probe failures could be caused by k8s API issues rather than flightdeck itself being unhealthy.

What Changed

  • Added Health() handler for /healthz endpoint in flightdeck/http/server.go
  • Added Ready() handler for /readyz endpoint in flightdeck/http/server.go
  • Updated flightdeck_controller.go to use /healthz and /readyz for probes
  • Added unit tests for both health endpoints
  • Updated controller tests to verify new probe paths

Testing

  • Unit tests added for both endpoints
  • Existing controller tests updated and passing
  • Flightdeck module tests passing

Fixes #40

- Add /healthz endpoint for liveness probe (lightweight, no external calls)
- Add /readyz endpoint for readiness probe (checks k8s API connectivity)
- Update controller to use new probe paths instead of homepage
- Add unit tests for health check endpoints
- Update controller tests to verify new probe paths

This prevents probe failures due to k8s API issues from being misinterpreted as flightdeck being unhealthy.
@claude
Copy link

claude bot commented Feb 9, 2026

Claude finished @ian-flores's task —— View job


Reviewing PR

  • Read review guidelines
  • Start pending review
  • Analyze PR diff and code changes
  • Add inline review comments (included in review body due to permissions)
  • Submit review

Review submitted with suggestions for:

  • Reducing log verbosity for health check endpoints
  • Missing trailing newline in test file

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Overall

Good implementation separating liveness from readiness probes. The approach correctly uses /healthz as a lightweight liveness check and /readyz to verify k8s API connectivity.


Controller Changes Checklist

  • Reconciliation remains idempotent
  • Error handling unchanged (N/A for probe paths)
  • Unit tests updated to verify new probe paths

Flightdeck Checklist

  • New endpoints render correctly (plain text responses)
  • Unit tests cover success and failure cases

Suggestions

flightdeck/http/server.go:37-38 - Probe Logging

Health check endpoints will be called frequently by Kubernetes (every 3-10 seconds per the probe config). The requestLoggingMiddleware logs these at Info level for non-static paths, which could flood logs in production.

Consider adding /healthz and /readyz to the debug-only logging path (similar to how static assets are handled at line 71):

// In requestLoggingMiddleware
if len(r.URL.Path) > 7 && r.URL.Path[:8] == "/static/" ||
   r.URL.Path == "/healthz" || r.URL.Path == "/readyz" {
    slog.Debug(...)
} else {
    slog.Info(...)
}

flightdeck/http/server_test.go:94 - Missing Newline

File is missing a trailing newline.


Minor Notes

  • The w.Write([]byte(...)) return values are intentionally ignored, which is fine for these simple responses
  • Tests provide good coverage of the happy path and k8s API failure scenarios

- Reduce log verbosity for /healthz and /readyz endpoints to debug level
- Add missing trailing newline to server_test.go
- Regenerate manifests to sync Helm chart with kustomize CRDs
@ian-flores
Copy link
Collaborator Author

Confirmed this is working on ganso01-staging

@ian-flores ian-flores marked this pull request as ready for review February 10, 2026 15:01
Copy link
Collaborator

@stevenolen stevenolen left a comment

Choose a reason for hiding this comment

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

🎉

@ian-flores ian-flores merged commit 484b78a into main Feb 10, 2026
6 checks passed
@ian-flores ian-flores deleted the add-flightdeck-health-endpoints branch February 10, 2026 21:26
ian-flores pushed a commit that referenced this pull request Feb 10, 2026
# [1.8.0](v1.7.0...v1.8.0) (2026-02-10)

### Features

* add dedicated health check endpoints for flightdeck ([#77](#77)) ([484b78a](484b78a))
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.

Ensure that flightdeck has proper health checks set up

2 participants