From fb081bd437678e629baaa7eb058292eef07cb094 Mon Sep 17 00:00:00 2001 From: wangcanfeng Date: Wed, 16 Sep 2020 15:08:48 +0800 Subject: [PATCH] fix(status): fix ready condition in status. refactor GetHealth method, using in-cluster service to get health. --- controllers/harbor/health.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/controllers/harbor/health.go b/controllers/harbor/health.go index 4b1f0e3e4..ef9a6a857 100644 --- a/controllers/harbor/health.go +++ b/controllers/harbor/health.go @@ -59,12 +59,11 @@ func (h *APIHealth) GetUnhealthyComponents() []string { } func (r *Reconciler) GetHealth(ctx context.Context, harbor *goharborv1alpha1.Harbor) (*APIHealth, error) { - span, ctx := opentracing.StartSpanFromContext(ctx, "check") + span, _ := opentracing.StartSpanFromContext(ctx, "check") defer span.Finish() // access in-cluster service - url := fmt.Sprintf("http://%s.%s%s", harbor.NormalizeComponentName(goharborv1alpha1.CoreName), harbor.GetNamespace(), HarborHealthEndpoint) - resp, err := http.Get(url) + resp, err := http.Get(fmt.Sprintf("http://%s.%s%s", harbor.NormalizeComponentName(goharborv1alpha1.CoreName), harbor.GetNamespace(), HarborHealthEndpoint)) if err != nil { return nil, errors.Wrap(err, "cannot get health response") }