diff --git a/src/common/const.go b/src/common/const.go index 62a577eff..3a7f6b9bf 100755 --- a/src/common/const.go +++ b/src/common/const.go @@ -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. diff --git a/src/core/api/health.go b/src/core/api/health.go index 0d4ef2cac..aa6ba9cc1 100644 --- a/src/core/api/health.go +++ b/src/core/api/health.go @@ -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() } diff --git a/src/core/config/config.go b/src/core/config/config.go index 97f786cd2..b0954c498 100755 --- a/src/core/config/config.go +++ b/src/core/config/config.go @@ -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) {