Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user apiserver /healthz instead of cs check #20909

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions kubetest/conformance/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ go_library(
deps = [
"//kubetest/e2e:go_default_library",
"//kubetest/process:go_default_library",
"@io_k8s_api//core/v1:go_default_library",
"@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library",
"@io_k8s_client_go//kubernetes:go_default_library",
"@io_k8s_client_go//tools/clientcmd:go_default_library",
],
Expand Down
20 changes: 10 additions & 10 deletions kubetest/conformance/conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import (
"os/exec"
"time"

"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/test-infra/kubetest/e2e"
Expand Down Expand Up @@ -103,17 +101,19 @@ func (d *Deployer) Up() error {
}

// IsUp returns nil if the apiserver is running, or the error received while checking.
// TODO(Q-Lee): check that relevant components have started. May consider checking addons.
func (d *Deployer) IsUp() error {
_, err := d.isAPIServerUp()
return err
}

func (d *Deployer) isAPIServerUp() (*v1.ComponentStatusList, error) {
if d.apiserver == nil {
return nil, fmt.Errorf("no apiserver client available")
return fmt.Errorf("no apiserver client available")
}
body, err := d.apiserver.CoreV1().RESTClient().Get().AbsPath("/healthz").Do(context.TODO()).Raw()
if err == nil && string(body) == "ok" {
return nil
}
if err != nil {
return err
}
//TODO(Q-Lee): check that relevant components have started. May consider checking addons.
return d.apiserver.CoreV1().ComponentStatuses().List(context.TODO(), metav1.ListOptions{})
return fmt.Errorf("apiserver is not healthy")
}

// DumpClusterLogs is a no-op.
Expand Down