Package reference page maintained from the source documentation in src/HealthChecks.Harbor.

Harbor Health Check

This health check verifies a Harbor instance through the Harbor /api/v2.0/health endpoint.

Defaults

By default, the Harbor health endpoint is checked and every component returned by Harbor must report healthy.

void ConfigureServices(IServiceCollection services)
{
    services
        .AddHealthChecks()
        .AddHarbor(new Uri("https://harbor.example.com"));
}

Required components

Use RequiredComponents when your deployment must expose specific Harbor services, such as registry, database, job service, or portal.

using HealthChecks.Harbor;

void ConfigureServices(IServiceCollection services)
{
    services
        .AddHealthChecks()
        .AddHarbor(new Uri("https://harbor.example.com"), options =>
        {
            options.RequiredComponents.Add("registry");
            options.RequiredComponents.Add("database");
            options.RequiredComponents.Add("jobservice");
            options.RequiredComponents.Add("portal");
        });
}

Custom endpoint or request

If Harbor is exposed through a reverse proxy path, configure HealthEndpointPath. For authenticated or proxied setups, use ConfigureRequest or configure the named HTTP client.

using HealthChecks.Harbor;
using System.Net.Http.Headers;

void ConfigureServices(IServiceCollection services)
{
    services
        .AddHealthChecks()
        .AddHarbor(new Uri("https://harbor.example.com"), options =>
        {
            options.HealthEndpointPath = "/harbor/api/v2.0/health";
            options.ConfigureRequest = request =>
            {
                request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "token");
            };
        });
}

Customization

You can additionally add the following parameters: