append / to healthcheck url

This commit is contained in:
Prashanth Balasubramanian 2016-05-31 19:47:37 -07:00
parent 22c6e5ddd7
commit 9abd4e0ea6
2 changed files with 5 additions and 1 deletions

View file

@ -425,6 +425,10 @@ func (t *GCETranslator) HealthCheck(port int64) (*compute.HttpHealthCheck, error
break break
} }
healthPath := rp.Handler.HTTPGet.Path 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 host := rp.Handler.HTTPGet.Host
glog.Infof("Found custom health check for Service %v nodeport %v: %v%v", s.Name, port, host, healthPath) glog.Infof("Found custom health check for Service %v nodeport %v: %v%v", s.Name, port, host, healthPath)
return &compute.HttpHealthCheck{ return &compute.HttpHealthCheck{

View file

@ -86,7 +86,7 @@ func (f *FakeHealthChecks) UpdateHttpHealthCheck(hc *compute.HttpHealthCheck) er
healthChecks := []*compute.HttpHealthCheck{} healthChecks := []*compute.HttpHealthCheck{}
found := false found := false
for _, h := range f.hc { for _, h := range f.hc {
if h.Name == name { if h.Name == hc.Name {
healthChecks = append(healthChecks, hc) healthChecks = append(healthChecks, hc)
found = true found = true
} else { } else {