@@ -17,9 +17,9 @@ package service
17
17
import (
18
18
"log"
19
19
20
- "github.com/kubernetes/dashboard/resource/common"
21
- "k8s.io/kubernetes/pkg/api"
22
20
client "k8s.io/kubernetes/pkg/client/unversioned"
21
+
22
+ "github.com/kubernetes/dashboard/resource/common"
23
23
)
24
24
25
25
// Service is a representation of a service.
@@ -38,9 +38,6 @@ type Service struct {
38
38
// Label selector of the service.
39
39
Selector map [string ]string `json:"selector"`
40
40
41
- // Type determines how the service will be exposed. Valid options: ClusterIP, NodePort, LoadBalancer
42
- Type api.ServiceType `json:"type"`
43
-
44
41
// ClusterIP is usually assigned by the master. Valid values are None, empty string (""), or
45
42
// a valid IP address. None can be specified for headless services when proxying is not required
46
43
ClusterIP string `json:"clusterIP"`
@@ -52,20 +49,6 @@ type ServiceList struct {
52
49
Services []Service `json:"services"`
53
50
}
54
51
55
- // GetService gets service details.
56
- func GetService (client client.Interface , namespace , name string ) (* Service , error ) {
57
- log .Printf ("Getting details of %s service in %s namespace" , name , namespace )
58
-
59
- // TODO(maciaszczykm): Use channels.
60
- serviceData , err := client .Services (namespace ).Get (name )
61
- if err != nil {
62
- return nil , err
63
- }
64
-
65
- service := GetServiceDetails (serviceData )
66
- return & service , nil
67
- }
68
-
69
52
// GetServiceList returns a list of all services in the cluster.
70
53
func GetServiceList (client client.Interface ) (* ServiceList , error ) {
71
54
log .Printf ("Getting list of all services in the cluster" )
@@ -81,21 +64,8 @@ func GetServiceList(client client.Interface) (*ServiceList, error) {
81
64
82
65
serviceList := & ServiceList {Services : make ([]Service , 0 )}
83
66
for _ , service := range services .Items {
84
- serviceList .Services = append (serviceList .Services , GetServiceDetails (& service ))
67
+ serviceList .Services = append (serviceList .Services , ToService (& service ))
85
68
}
86
69
87
70
return serviceList , nil
88
71
}
89
-
90
- // GetServiceDetails returns api service object based on kubernetes service object
91
- func GetServiceDetails (service * api.Service ) Service {
92
- return Service {
93
- ObjectMeta : common .CreateObjectMeta (service .ObjectMeta ),
94
- TypeMeta : common .CreateTypeMeta (service .TypeMeta ),
95
- InternalEndpoint : common .GetInternalEndpoint (service .Name , service .Namespace , service .Spec .Ports ),
96
- // TODO(maciaszczykm): Fill ExternalEndpoints with data.
97
- Selector : service .Spec .Selector ,
98
- ClusterIP : service .Spec .ClusterIP ,
99
- Type : service .Spec .Type ,
100
- }
101
- }
0 commit comments