mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Allow /healthz check from localhost
This commit is contained in:
parent
7df01300ea
commit
43b4f41202
@ -165,11 +165,13 @@ func (s *Server) handleHealthz(w http.ResponseWriter, req *http.Request) {
|
|||||||
|
|
||||||
// Check that the hostname known by the master matches the hostname
|
// Check that the hostname known by the master matches the hostname
|
||||||
// the kubelet knows
|
// the kubelet knows
|
||||||
hostname := s.host.GetHostname()
|
/*
|
||||||
if masterHostname != hostname {
|
hostname := s.host.GetHostname()
|
||||||
s.error(w, errors.New("Kubelet hostname \""+hostname+"\" does not match the hostname expected by the master \""+masterHostname+"\""))
|
if masterHostname != hostname {
|
||||||
return
|
s.error(w, errors.New("Kubelet hostname \""+hostname+"\" does not match the hostname expected by the master \""+masterHostname+"\""))
|
||||||
}
|
return
|
||||||
|
}
|
||||||
|
*/
|
||||||
w.Write([]byte("ok"))
|
w.Write([]byte("ok"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,8 +483,8 @@ func TestHealthCheck(t *testing.T) {
|
|||||||
t.Fatalf("Got error GETing: %v", err)
|
t.Fatalf("Got error GETing: %v", err)
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
if resp.StatusCode != http.StatusInternalServerError {
|
if resp.StatusCode != http.StatusOK {
|
||||||
t.Errorf("expected status code %d, got %d", http.StatusInternalServerError, resp.StatusCode)
|
t.Errorf("expected status code %d, got %d", http.StatusOK, resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Test with old docker version
|
//Test with old docker version
|
||||||
@ -498,7 +498,7 @@ func TestHealthCheck(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
if resp.StatusCode != http.StatusInternalServerError {
|
if resp.StatusCode != http.StatusInternalServerError {
|
||||||
t.Errorf("expected status code %d, got %d", http.StatusOK, resp.StatusCode)
|
t.Errorf("expected status code %d, got %d", http.StatusInternalServerError, resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user