From 9abd4e0ea6bb615938153c1ce8b451a5198a64e6 Mon Sep 17 00:00:00 2001 From: Prashanth Balasubramanian Date: Tue, 31 May 2016 19:47:37 -0700 Subject: [PATCH] append / to healthcheck url --- controllers/gce/controller/utils.go | 4 ++++ controllers/gce/healthchecks/fakes.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/gce/controller/utils.go b/controllers/gce/controller/utils.go index 68f158429..9eb52a3ad 100644 --- a/controllers/gce/controller/utils.go +++ b/controllers/gce/controller/utils.go @@ -425,6 +425,10 @@ func (t *GCETranslator) HealthCheck(port int64) (*compute.HttpHealthCheck, error break } healthPath := rp.Handler.HTTPGet.Path + // GCE requires a leading "/" for health check urls. + if string(healthPath[0]) != "/" { + healthPath = fmt.Sprintf("/%v", healthPath) + } host := rp.Handler.HTTPGet.Host glog.Infof("Found custom health check for Service %v nodeport %v: %v%v", s.Name, port, host, healthPath) return &compute.HttpHealthCheck{ diff --git a/controllers/gce/healthchecks/fakes.go b/controllers/gce/healthchecks/fakes.go index 83083b048..10a8c8791 100644 --- a/controllers/gce/healthchecks/fakes.go +++ b/controllers/gce/healthchecks/fakes.go @@ -86,7 +86,7 @@ func (f *FakeHealthChecks) UpdateHttpHealthCheck(hc *compute.HttpHealthCheck) er healthChecks := []*compute.HttpHealthCheck{} found := false for _, h := range f.hc { - if h.Name == name { + if h.Name == hc.Name { healthChecks = append(healthChecks, hc) found = true } else {