Skip to content

Commit

Permalink
fix(status): fix ready condition in status.
Browse files Browse the repository at this point in the history
refactor GetHealth method, using in-cluster service to get health.
  • Loading branch information
wangcanfeng committed Sep 16, 2020
1 parent 8656fc5 commit fb081bd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions controllers/harbor/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit fb081bd

Please sign in to comment.