@@ -63,58 +63,6 @@ type TypeMeta struct {
63
63
Kind ResourceKind `json:"kind,omitempty"`
64
64
}
65
65
66
- // ServicePort is a pair of port and protocol, e.g. a service endpoint.
67
- type ServicePort struct {
68
- // Positive port number.
69
- Port int `json:"port"`
70
-
71
- // Protocol name, e.g., TCP or UDP.
72
- Protocol api.Protocol `json:"protocol"`
73
- }
74
-
75
- // Events response structure.
76
- type EventList struct {
77
- // Namespace.
78
- Namespace string `json:"namespace"`
79
-
80
- // List of events from given namespace.
81
- Events []Event `json:"events"`
82
- }
83
-
84
- // Event is a single event representation.
85
- type Event struct {
86
- // A human-readable description of the status of related object.
87
- Message string `json:"message"`
88
-
89
- // Component from which the event is generated.
90
- SourceComponent string `json:"sourceComponent"`
91
-
92
- // Host name on which the event is generated.
93
- SourceHost string `json:"sourceHost"`
94
-
95
- // Reference to a piece of an object, which triggered an event. For example
96
- // "spec.containers{name}" refers to container within pod with given name, if no container
97
- // name is specified, for example "spec.containers[2]", then it refers to container with
98
- // index 2 in this pod.
99
- SubObject string `json:"object"`
100
-
101
- // The number of times this event has occurred.
102
- Count int `json:"count"`
103
-
104
- // The time at which the event was first recorded.
105
- FirstSeen unversioned.Time `json:"firstSeen"`
106
-
107
- // The time at which the most recent occurrence of this event was recorded.
108
- LastSeen unversioned.Time `json:"lastSeen"`
109
-
110
- // Short, machine understandable string that gives the reason
111
- // for this event being generated.
112
- Reason string `json:"reason"`
113
-
114
- // Event type (at the moment only normal and warning are supported).
115
- Type string `json:"type"`
116
- }
117
-
118
66
// Returns internal endpoint name for the given service properties, e.g.,
119
67
// NewObjectMeta creates a new instance of ObjectMeta struct based on K8s object meta.
120
68
func NewObjectMeta (k8SObjectMeta api.ObjectMeta ) ObjectMeta {
@@ -158,15 +106,6 @@ var kindToAPIPathMapping = map[string]string{
158
106
ResourceKindReplicaSet : "replicasets" ,
159
107
}
160
108
161
- // GetServicePorts returns human readable name for the given service ports list.
162
- func GetServicePorts (apiPorts []api.ServicePort ) []ServicePort {
163
- var ports []ServicePort
164
- for _ , port := range apiPorts {
165
- ports = append (ports , ServicePort {port .Port , port .Protocol })
166
- }
167
- return ports
168
- }
169
-
170
109
// IsLabelSelectorMatching returns true when an object with the given
171
110
// selector targets the same Resources (or subset) that
172
111
// the tested object with the given selector.
@@ -186,29 +125,3 @@ func IsLabelSelectorMatching(labelSelector map[string]string,
186
125
187
126
return true
188
127
}
189
-
190
- func FilterNamespacedPodsBySelector (pods []api.Pod , namespace string ,
191
- resourceSelector map [string ]string ) []api.Pod {
192
-
193
- var matchingPods []api.Pod
194
- for _ , pod := range pods {
195
- if pod .ObjectMeta .Namespace == namespace &&
196
- IsLabelSelectorMatching (resourceSelector , pod .Labels ) {
197
- matchingPods = append (matchingPods , pod )
198
- }
199
- }
200
-
201
- return matchingPods
202
- }
203
-
204
- // Returns pods targeted by given selector.
205
- func FilterPodsBySelector (pods []api.Pod , resourceSelector map [string ]string ) []api.Pod {
206
-
207
- var matchingPods []api.Pod
208
- for _ , pod := range pods {
209
- if IsLabelSelectorMatching (resourceSelector , pod .Labels ) {
210
- matchingPods = append (matchingPods , pod )
211
- }
212
- }
213
- return matchingPods
214
- }
0 commit comments