Health Check Handler (HTTP health checking)

HealthCheckHandler is an HTTP handler that is used for health checks. e.g. liveness probe.

Overview

HealthCheckHandler is an handler that can be used for health checks.

It works as:

  • HTTP Handler

Config yaml format becomes like below. And the resource specific spec is defined in in the proto format shown in the Resource Definition.

apiVersion: core/v1
kind: HealthCheckHandler
metadata:
  name: "default"
  namespace: "default"
spec: {}

Features

1. Return health status

The HealthCheckHandler returns a 200 OK status to the health check request.

Resource Definition

HealthCheckHandler is defined in the proto/app/v1/handler/healthcheck.proto

syntax = "proto3";
package app.v1;

import "buf/validate/validate.proto";
import "core/v1/http.proto";
import "kernel/resource.proto";

option go_package = "github.com/aileron-gateway/aileron-gateway/apis/app/v1";

// HealthCheckHandler resource definition.
// apiVersion="app/v1", kind="HealthCheckHandler".
message HealthCheckHandler {
    string                 APIVersion = 1 [json_name = "apiVersion"];
    string                 Kind       = 2 [json_name = "kind"];
    kernel.Metadata        Metadata   = 3 [json_name = "metadata"];
    HealthCheckHandlerSpec Spec       = 4 [json_name = "spec"];
}

// HealthCheckHandlerSpec is the specifications for the HealthCheckHandler object.
message HealthCheckHandlerSpec {
    // [OPTIONAL]
    // ErrorHandler is the reference to a ErrorHandler object.
    // Referred object must implement ErrorHandler interface.
    // Default error handler is used when not set.
    kernel.Reference ErrorHandler = 1 [json_name = "errorHandler"];

    // [OPTIONAL]
    // Patterns is path patterns that this handler
    // is registered to a server.
    // Default is not set, or empty string ["/"].
    repeated string Patterns = 2 [json_name = "patterns"];

    // [OPTIONA]
    // Methods is the list of HTTP method this handler can handle.
    // Note that it depends on the multiplexer, or HTTP router,
    // that the server uses if this field is used or not.
    // Default multiplexer does not use this field.
    // Default is not set.
    repeated core.v1.HTTPMethod Methods = 3 [json_name = "methods"];

    // [OPTIONAL]
    // Timeout is timeout duration in seconds.
    // Unhealthy status will be returned when health checking excceeded this duration.
    // Default is [30].
    int32 Timeout = 4 [json_name = "timeout", (buf.validate.field).int32 = {gte : 0}];

    // [OPTIONAL]
    // ExternalProbes is the list of references to HealthChecker objects.
    // Referred object must implement HealthChecker interface.
    // No values by default.
    repeated kernel.Reference ExternalProbes = 5 [json_name = "externalProbes"];
}

Last modified June 2, 2025: update docs (df954a4)