Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit c51f71c

Browse files
committed
use /healthz endpoint to determine apiserver readiness
1 parent 5539c04 commit c51f71c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pkg/bootkube/create.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package bootkube
22

33
import (
44
"fmt"
5+
"net/http"
56
"os"
67
"strings"
78
"time"
@@ -154,9 +155,10 @@ func apiTest() error {
154155
}
155156

156157
// API Server is responding
157-
_, err = client.Discovery().ServerVersion()
158-
if err != nil {
159-
return err
158+
healthStatus := 0
159+
client.Discovery().RESTClient().Get().AbsPath("/healthz").Do().StatusCode(&healthStatus)
160+
if healthStatus != http.StatusOK {
161+
return fmt.Errorf("API Server http status: %d", healthStatus)
160162
}
161163

162164
// System namespace has been created

0 commit comments

Comments
 (0)