Skip to content

Commit

Permalink
Merge pull request #767 from tariq1890/healthz
Browse files Browse the repository at this point in the history
return standardized text for health endpoint
  • Loading branch information
k8s-ci-robot committed May 28, 2019
2 parents ddce907 + 9bcb195 commit 73a7429
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ func serveMetrics(collectors []*coll.Collector, host string, port int, enableGZI
mux.Handle(metricsPath, &metricHandler{collectors, enableGZIPEncoding})
// Add healthzPath
mux.HandleFunc(healthzPath, func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(200)
w.Write([]byte("ok"))
w.WriteHeader(http.StatusOK)
w.Write([]byte(http.StatusText(http.StatusOK)))
})
// Add index
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ kubectl proxy &
# this for loop waits until kube-state-metrics is running by accessing the healthz endpoint
for _ in {1..30}; do # timeout for 1 minutes
KUBE_STATE_METRICS_STATUS=$(curl -s "http://localhost:8001/api/v1/namespaces/kube-system/services/kube-state-metrics:http-metrics/proxy/healthz")
if [[ "$KUBE_STATE_METRICS_STATUS" == "ok" ]]; then
if [[ "${KUBE_STATE_METRICS_STATUS}" == "OK" ]]; then
is_kube_state_metrics_running="true"
break
fi
Expand Down Expand Up @@ -174,7 +174,7 @@ for collector in ${collectors}; do
done

KUBE_STATE_METRICS_STATUS=$(curl -s "http://localhost:8001/api/v1/namespaces/kube-system/services/kube-state-metrics:http-metrics/proxy/healthz")
if [[ "$KUBE_STATE_METRICS_STATUS" == "ok" ]]; then
if [[ "${KUBE_STATE_METRICS_STATUS}" == "OK" ]]; then
echo "kube-state-metrics is still running after accessing metrics endpoint"
exit 0
fi
Expand Down

0 comments on commit 73a7429

Please sign in to comment.