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

Fix in-cluster heapster config #2184

Merged
merged 2 commits into from
Jul 26, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions src/app/backend/integration/metric/heapster/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func CreateHeapsterClient(host string, k8sClient *kubernetes.Clientset) (

if host == "" && k8sClient != nil {
log.Print("Creating in-cluster Heapster client")
c := inClusterHeapsterClient{client: k8sClient.Core().RESTClient()}
c := inClusterHeapsterClient{client: k8sClient.CoreV1().RESTClient()}
return heapsterClient{client: c}, nil
}

Expand All @@ -247,6 +247,6 @@ func CreateHeapsterClient(host string, k8sClient *kubernetes.Clientset) (
return heapsterClient{}, err
}
log.Printf("Creating remote Heapster client for %s", host)
c := remoteHeapsterClient{client: restClient.Core().RESTClient()}
c := remoteHeapsterClient{client: restClient.CoreV1().RESTClient()}
return heapsterClient{client: c}, nil
}
25 changes: 16 additions & 9 deletions src/app/backend/integration/metric/heapster/restclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,24 @@ func (c inClusterHeapsterClient) Get(path string) RequestInterface {
Namespace("kube-system").
Resource("services").
Name("heapster").
Suffix("/api/v1" + path)
Suffix("/api/v1/" + path)
}

// HealthCheck does a health check of the application.
// Returns nil if connection to application can be established, error object otherwise.
func (self inClusterHeapsterClient) HealthCheck() error {
return healthCheck(self)
_, err := self.client.Get().Prefix("proxy").
Namespace("kube-system").
Resource("services").
Name("heapster").
Suffix("/healthz").
DoRaw()

if err == nil {
log.Print("Successful initial request to heapster")
}

return err
}

// RemoteHeapsterClient is an implementation of a remote Heapster client. Talks with Heapster
Expand All @@ -68,16 +80,11 @@ func (c remoteHeapsterClient) Get(path string) RequestInterface {
}

// HealthCheck does a health check of the application.
func (self remoteHeapsterClient) HealthCheck() error {
return healthCheck(self)
}

// Returns nil if connection to application can be established, error object otherwise.
func healthCheck(client HeapsterRESTClient) error {
_, err := client.Get("healthz").AbsPath("/").DoRaw()
func (self remoteHeapsterClient) HealthCheck() error {
_, err := self.Get("healthz").AbsPath("/").DoRaw()
if err == nil {
log.Print("Successful initial request to heapster")
return nil
}

return err
Expand Down