Merge pull request #9520 from ywk253100/191022_health_check

Remove the health checker for Clair in health check API
This commit is contained in:
Wang Yan 2019-10-24 14:50:01 +08:00 committed by GitHub
commit 4baa35bc17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 26 deletions

View File

@ -137,7 +137,6 @@ const (
DefaultChartRepoURL = "http://chartmuseum:9999"
DefaultPortalURL = "http://portal:8080"
DefaultRegistryCtlURL = "http://registryctl:8080"
DefaultClairHealthCheckServerURL = "http://clair:6061"
// Use this prefix to distinguish harbor user, the prefix contains a special character($), so it cannot be registered as a harbor user.
RobotPrefix = "robot$"
// Use this prefix to index user who tries to login with web hook token.

View File

@ -22,14 +22,12 @@ import (
"sync"
"time"
"github.com/goharbor/harbor/src/common/utils"
"github.com/docker/distribution/health"
"github.com/goharbor/harbor/src/common/dao"
httputil "github.com/goharbor/harbor/src/common/http"
"github.com/goharbor/harbor/src/common/utils"
"github.com/goharbor/harbor/src/common/utils/log"
"github.com/goharbor/harbor/src/core/config"
"github.com/docker/distribution/health"
"github.com/gomodule/redigo/redis"
)
@ -240,14 +238,6 @@ func chartmuseumHealthChecker() health.Checker {
return PeriodicHealthChecker(checker, period)
}
func clairHealthChecker() health.Checker {
url := config.GetClairHealthCheckServerURL() + "/health"
timeout := 60 * time.Second
period := 10 * time.Second
checker := HTTPStatusCodeHealthChecker(http.MethodGet, url, nil, timeout, http.StatusOK)
return PeriodicHealthChecker(checker, period)
}
func notaryHealthChecker() health.Checker {
url := config.InternalNotaryEndpoint() + "/_notary_server/health"
timeout := 60 * time.Second
@ -301,9 +291,6 @@ func registerHealthCheckers() {
if config.WithChartMuseum() {
HealthCheckerRegistry["chartmuseum"] = chartmuseumHealthChecker()
}
if config.WithClair() {
HealthCheckerRegistry["clair"] = clairHealthChecker()
}
if config.WithNotary() {
HealthCheckerRegistry["notary"] = notaryHealthChecker()
}

View File

@ -461,16 +461,6 @@ func GetRegistryCtlURL() string {
return url
}
// GetClairHealthCheckServerURL returns the URL of
// the health check server of Clair
func GetClairHealthCheckServerURL() string {
url := os.Getenv("CLAIR_HEALTH_CHECK_SERVER_URL")
if len(url) == 0 {
return common.DefaultClairHealthCheckServerURL
}
return url
}
// HTTPAuthProxySetting returns the setting of HTTP Auth proxy. the settings are only meaningful when the auth_mode is
// set to http_auth
func HTTPAuthProxySetting() (*models.HTTPAuthProxy, error) {