Fixed kubelet /healthz by using healthz package

Fixed #1094
This commit is contained in:
Dawn Chen 2014-08-28 15:34:39 -07:00
parent 27a18684bf
commit 223fb6e610
2 changed files with 3 additions and 6 deletions

View File

@ -49,7 +49,7 @@ for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
fi fi
# Make sure the kubelet is healthy # 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 "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!)" echo "Please run ./cluster/kube-down.sh and re-create the cluster. (sorry!)"
exit 1 exit 1

View File

@ -31,6 +31,7 @@ import (
"time" "time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/healthz"
"github.com/GoogleCloudPlatform/kubernetes/pkg/httplog" "github.com/GoogleCloudPlatform/kubernetes/pkg/httplog"
"github.com/golang/glog" "github.com/golang/glog"
"github.com/google/cadvisor/info" "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 // InstallDefaultHandlers registers the set of supported HTTP request patterns with the mux
func (s *Server) InstallDefaultHandlers() { func (s *Server) InstallDefaultHandlers() {
s.mux.HandleFunc("/healthz", s.handleHealth) healthz.InstallHandler(s.mux)
s.mux.HandleFunc("/container", s.handleContainer) s.mux.HandleFunc("/container", s.handleContainer)
s.mux.HandleFunc("/containers", s.handleContainers) s.mux.HandleFunc("/containers", s.handleContainers)
s.mux.HandleFunc("/podInfo", s.handlePodInfo) 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) 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 // handleContainer handles container requests against the Kubelet
func (s *Server) handleContainer(w http.ResponseWriter, req *http.Request) { func (s *Server) handleContainer(w http.ResponseWriter, req *http.Request) {
defer req.Body.Close() defer req.Body.Close()