From 98b40f85fb354fe4a1f1fba171ee27e7a7bf82a0 Mon Sep 17 00:00:00 2001 From: wangcanfeng Date: Wed, 16 Sep 2020 15:31:18 +0800 Subject: [PATCH] fix(status): fix ready condition in status. refactor GetHealth method, using in-cluster service to get health. --- controllers/harbor/health.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/harbor/health.go b/controllers/harbor/health.go index 504c25934..0daa951a1 100644 --- a/controllers/harbor/health.go +++ b/controllers/harbor/health.go @@ -64,11 +64,13 @@ func (r *Reconciler) GetHealth(ctx context.Context, harbor *goharborv1alpha1.Har // access in-cluster service 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") } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) + if err != nil { return nil, errors.Wrap(err, "cannot get health response body.") }