@@ -37,6 +37,13 @@ type Service struct {
37
37
38
38
// Label selector of the service.
39
39
Selector map [string ]string `json:"selector"`
40
+
41
+ // Type determines how the service will be exposed. Valid options: ClusterIP, NodePort, LoadBalancer
42
+ Type api.ServiceType `json:"type"`
43
+
44
+ // ClusterIP is usually assigned by the master. Valid values are None, empty string (""), or
45
+ // a valid IP address. None can be specified for headless services when proxying is not required
46
+ ClusterIP string `json:"clusterIP"`
40
47
}
41
48
42
49
// ServiceList contains a list of services in the cluster.
@@ -55,7 +62,7 @@ func GetService(client client.Interface, namespace, name string) (*Service, erro
55
62
return nil , err
56
63
}
57
64
58
- service := getServices (serviceData )
65
+ service := GetServiceDetails (serviceData )
59
66
return & service , nil
60
67
}
61
68
@@ -74,18 +81,21 @@ func GetServiceList(client client.Interface) (*ServiceList, error) {
74
81
75
82
serviceList := & ServiceList {Services : make ([]Service , 0 )}
76
83
for _ , service := range services .Items {
77
- serviceList .Services = append (serviceList .Services , getServices (& service ))
84
+ serviceList .Services = append (serviceList .Services , GetServiceDetails (& service ))
78
85
}
79
86
80
87
return serviceList , nil
81
88
}
82
89
83
- func getServices (service * api.Service ) Service {
90
+ // GetServiceDetails returns api service object based on kubernetes service object
91
+ func GetServiceDetails (service * api.Service ) Service {
84
92
return Service {
85
93
ObjectMeta : common .CreateObjectMeta (service .ObjectMeta ),
86
94
TypeMeta : common .CreateTypeMeta (service .TypeMeta ),
87
95
InternalEndpoint : common .GetInternalEndpoint (service .Name , service .Namespace , service .Spec .Ports ),
88
96
// TODO(maciaszczykm): Fill ExternalEndpoints with data.
89
- Selector : service .Spec .Selector ,
97
+ Selector : service .Spec .Selector ,
98
+ ClusterIP : service .Spec .ClusterIP ,
99
+ Type : service .Spec .Type ,
90
100
}
91
101
}
0 commit comments