From 223fb6e610ceed243ef5449e22ea4e33f12231cf Mon Sep 17 00:00:00 2001 From: Dawn Chen Date: Thu, 28 Aug 2014 15:34:39 -0700 Subject: [PATCH] Fixed kubelet /healthz by using healthz package Fixed #1094 --- cluster/validate-cluster.sh | 2 +- pkg/kubelet/server.go | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cluster/validate-cluster.sh b/cluster/validate-cluster.sh index b3fc9ccd356..e585e1b3c21 100755 --- a/cluster/validate-cluster.sh +++ b/cluster/validate-cluster.sh @@ -49,7 +49,7 @@ for (( i=0; i<${#MINION_NAMES[@]}; i++)); do fi # Make sure the kubelet is healthy - if [ "$(curl --insecure -sw '%{http_code}' --user ${user}:${passwd} https://${KUBE_MASTER_IP}/proxy/minion/${MINION_NAMES[$i]}/healthz)" != "200" ]; then + if [ "$(curl --insecure --user ${user}:${passwd} https://${KUBE_MASTER_IP}/proxy/minion/${MINION_NAMES[$i]}/healthz)" != "ok" ]; then echo "Kubelet failed to install on ${MINION_NAMES[$i]}. Your cluster is unlikely to work correctly." echo "Please run ./cluster/kube-down.sh and re-create the cluster. (sorry!)" exit 1 diff --git a/pkg/kubelet/server.go b/pkg/kubelet/server.go index b1920e1cec6..1e578cfa02b 100644 --- a/pkg/kubelet/server.go +++ b/pkg/kubelet/server.go @@ -31,6 +31,7 @@ import ( "time" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" + "github.com/GoogleCloudPlatform/kubernetes/pkg/healthz" "github.com/GoogleCloudPlatform/kubernetes/pkg/httplog" "github.com/golang/glog" "github.com/google/cadvisor/info" @@ -82,7 +83,7 @@ func NewServer(host HostInterface, updates chan<- interface{}) Server { // InstallDefaultHandlers registers the set of supported HTTP request patterns with the mux func (s *Server) InstallDefaultHandlers() { - s.mux.HandleFunc("/healthz", s.handleHealth) + healthz.InstallHandler(s.mux) s.mux.HandleFunc("/container", s.handleContainer) s.mux.HandleFunc("/containers", s.handleContainers) s.mux.HandleFunc("/podInfo", s.handlePodInfo) @@ -97,10 +98,6 @@ func (s *Server) error(w http.ResponseWriter, err error) { http.Error(w, fmt.Sprintf("Internal Error: %v", err), http.StatusInternalServerError) } -// handleHealth handles health checking requests against the Kubelet -func (s *Server) handleHealth(w http.ResponseWriter, req *http.Request) { -} - // handleContainer handles container requests against the Kubelet func (s *Server) handleContainer(w http.ResponseWriter, req *http.Request) { defer req.Body.Close()