Skip to content

Commit

Permalink
Switch to proxy subresource (kubernetes#2622)
Browse files Browse the repository at this point in the history
  • Loading branch information
liggitt authored and Sebastian Florek committed Nov 27, 2017
1 parent 516c575 commit 813e504
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/backend/integration/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestIntegrationManager_GetState(t *testing.T) {
"Server provided and using in-cluster heapster",
"http://127.0.0.1:8080", "", &api.IntegrationState{
Connected: false,
Error: errors.New("Get http://127.0.0.1:8080/api/v1/proxy/namespaces/kube-system/services/heapster/healthz: dial tcp 127.0.0.1:8080: getsockopt: connection refused"),
Error: errors.New("Get http://127.0.0.1:8080/api/v1/namespaces/kube-system/services/heapster/proxy/healthz: dial tcp 127.0.0.1:8080: getsockopt: connection refused"),
}, nil,
},
{
Expand Down
6 changes: 4 additions & 2 deletions src/app/backend/integration/metric/heapster/restclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@ type inClusterHeapsterClient struct {

// Get creates request to given path.
func (c inClusterHeapsterClient) Get(path string) RequestInterface {
return c.client.Get().Prefix("proxy").
return c.client.Get().
Namespace("kube-system").
Resource("services").
Name("heapster").
SubResource("proxy").
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 {
_, err := self.client.Get().Prefix("proxy").
_, err := self.client.Get().
Namespace("kube-system").
Resource("services").
Name("heapster").
SubResource("proxy").
Suffix("/healthz").
DoRaw()
return err
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/alternative/kubernetes-dashboard-arm-head.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ rules:
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/alternative/kubernetes-dashboard-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ rules:
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/alternative/kubernetes-dashboard-head.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ rules:
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/alternative/kubernetes-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ rules:
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
verbs: ["get"]

---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/recommended/kubernetes-dashboard-arm-head.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ rules:
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/recommended/kubernetes-dashboard-arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ rules:
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/recommended/kubernetes-dashboard-head.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ rules:
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
4 changes: 4 additions & 0 deletions src/deploy/recommended/kubernetes-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ rules:
resources: ["services"]
resourceNames: ["heapster"]
verbs: ["proxy"]
- apiGroups: [""]
resources: ["services/proxy"]
resourceNames: ["heapster", "http:heapster:", "https:heapster:"]
verbs: ["get"]

---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down

0 comments on commit 813e504

Please sign in to comment.