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 {