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:
clientFactory: A factory method to provide anHttpClientinstance.optionsFactory: A factory method to provide aHarborHealthCheckOptionsinstance.name: The health check name. The default isharbor.failureStatus: TheHealthStatusthat should be reported when the health check fails. Default isHealthStatus.Unhealthy.tags: A list of tags that can be used to filter sets of health checks.timeout: ASystem.TimeSpanrepresenting the timeout of the check.configureClient: A callback to configure the named Harbor health checkHttpClient.configurePrimaryHttpMessageHandler: A callback to configure the named Harbor health check HTTP message handler.