@@ -40,14 +40,15 @@ func TestEndpointSliceStore(t *testing.T) {
40
40
{
41
41
Obj : & discoveryv1.EndpointSlice {
42
42
ObjectMeta : metav1.ObjectMeta {
43
- Name : "test_endpointslice-info" ,
43
+ Name : "test_endpointslice-info" ,
44
+ Namespace : "test" ,
44
45
},
45
46
AddressType : "IPv4" ,
46
47
},
47
48
Want : `
48
49
# HELP kube_endpointslice_info Information about endpointslice.
49
50
# TYPE kube_endpointslice_info gauge
50
- kube_endpointslice_info{endpointslice="test_endpointslice-info",addresstype="IPv4"} 1
51
+ kube_endpointslice_info{endpointslice="test_endpointslice-info",addresstype="IPv4",namespace="test" } 1
51
52
` ,
52
53
MetricNames : []string {
53
54
"kube_endpointslice_info" ,
@@ -57,14 +58,15 @@ func TestEndpointSliceStore(t *testing.T) {
57
58
Obj : & discoveryv1.EndpointSlice {
58
59
ObjectMeta : metav1.ObjectMeta {
59
60
Name : "test_kube_endpointslice-created" ,
61
+ Namespace : "test" ,
60
62
CreationTimestamp : metav1StartTime ,
61
63
},
62
64
AddressType : "IPv4" ,
63
65
},
64
66
Want : `
65
67
# HELP kube_endpointslice_created Unix creation timestamp
66
68
# TYPE kube_endpointslice_created gauge
67
- kube_endpointslice_created{endpointslice="test_kube_endpointslice-created"} 1.501569018e+09
69
+ kube_endpointslice_created{endpointslice="test_kube_endpointslice-created",namespace="test" } 1.501569018e+09
68
70
` ,
69
71
MetricNames : []string {
70
72
"kube_endpointslice_created" ,
@@ -73,7 +75,8 @@ func TestEndpointSliceStore(t *testing.T) {
73
75
{
74
76
Obj : & discoveryv1.EndpointSlice {
75
77
ObjectMeta : metav1.ObjectMeta {
76
- Name : "test_endpointslice-ports" ,
78
+ Name : "test_endpointslice-ports" ,
79
+ Namespace : "test" ,
77
80
},
78
81
AddressType : "IPv4" ,
79
82
Ports : []discoveryv1.EndpointPort {
@@ -86,7 +89,7 @@ func TestEndpointSliceStore(t *testing.T) {
86
89
Want : `
87
90
# HELP kube_endpointslice_ports Ports attached to the endpointslice.
88
91
# TYPE kube_endpointslice_ports gauge
89
- kube_endpointslice_ports{endpointslice="test_endpointslice-ports",port_name="http",port_protocol="TCP",port_number="80"} 1
92
+ kube_endpointslice_ports{endpointslice="test_endpointslice-ports",port_name="http",port_protocol="TCP",port_number="80",namespace="test" } 1
90
93
` ,
91
94
MetricNames : []string {
92
95
"kube_endpointslice_ports" ,
@@ -95,7 +98,8 @@ func TestEndpointSliceStore(t *testing.T) {
95
98
{
96
99
Obj : & discoveryv1.EndpointSlice {
97
100
ObjectMeta : metav1.ObjectMeta {
98
- Name : "test_endpointslice-endpoints" ,
101
+ Name : "test_endpointslice-endpoints" ,
102
+ Namespace : "test" ,
99
103
},
100
104
AddressType : "IPv4" ,
101
105
Endpoints : []discoveryv1.Endpoint {
@@ -116,8 +120,8 @@ func TestEndpointSliceStore(t *testing.T) {
116
120
# HELP kube_endpointslice_endpoints_hints Topology routing hints attached to endpoints
117
121
# TYPE kube_endpointslice_endpoints gauge
118
122
# TYPE kube_endpointslice_endpoints_hints gauge
119
- kube_endpointslice_endpoints{address="10.0.0.1",endpoint_nodename="node",endpoint_zone="west",endpointslice="test_endpointslice-endpoints",hostname="host",ready="true",terminating="false"} 1
120
- kube_endpointslice_endpoints{address="192.168.1.10",endpoint_nodename="node",endpoint_zone="west",endpointslice="test_endpointslice-endpoints",hostname="host",ready="true",terminating="false"} 1
123
+ kube_endpointslice_endpoints{address="10.0.0.1",endpoint_nodename="node",endpoint_zone="west",endpointslice="test_endpointslice-endpoints",hostname="host",ready="true",terminating="false",namespace="test" } 1
124
+ kube_endpointslice_endpoints{address="192.168.1.10",endpoint_nodename="node",endpoint_zone="west",endpointslice="test_endpointslice-endpoints",hostname="host",ready="true",terminating="false",namespace="test" } 1
121
125
` ,
122
126
123
127
MetricNames : []string {
@@ -127,7 +131,8 @@ func TestEndpointSliceStore(t *testing.T) {
127
131
{
128
132
Obj : & discoveryv1.EndpointSlice {
129
133
ObjectMeta : metav1.ObjectMeta {
130
- Name : "test_endpointslice-endpoints" ,
134
+ Name : "test_endpointslice-endpoints" ,
135
+ Namespace : "test" ,
131
136
},
132
137
AddressType : "IPv4" ,
133
138
Endpoints : []discoveryv1.Endpoint {
@@ -152,10 +157,10 @@ func TestEndpointSliceStore(t *testing.T) {
152
157
# HELP kube_endpointslice_endpoints Endpoints attached to the endpointslice.
153
158
# HELP kube_endpointslice_endpoints_hints Topology routing hints attached to endpoints
154
159
# TYPE kube_endpointslice_endpoints gauge
155
- # TYPE kube_endpointslice_endpoints_hints gauge
156
- kube_endpointslice_endpoints_hints{address="10.0.0.1",endpointslice="test_endpointslice-endpoints",for_zone="zone1"} 1
157
- kube_endpointslice_endpoints{address="10.0.0.1",endpoint_nodename="node",endpoint_zone="west",endpointslice="test_endpointslice-endpoints",hostname="host",ready="true",terminating="false"} 1
158
- kube_endpointslice_endpoints{address="192.168.1.10",endpoint_nodename="node",endpoint_zone="west",endpointslice="test_endpointslice-endpoints",hostname="host",ready="true",terminating="false"} 1
160
+ # TYPE kube_endpointslice_endpoints_hints gauge
161
+ kube_endpointslice_endpoints_hints{address="10.0.0.1",endpointslice="test_endpointslice-endpoints",for_zone="zone1",namespace="test" } 1
162
+ kube_endpointslice_endpoints{address="10.0.0.1",endpoint_nodename="node",endpoint_zone="west",endpointslice="test_endpointslice-endpoints",hostname="host",ready="true",terminating="false",namespace="test" } 1
163
+ kube_endpointslice_endpoints{address="192.168.1.10",endpoint_nodename="node",endpoint_zone="west",endpointslice="test_endpointslice-endpoints",hostname="host",ready="true",terminating="false",namespace="test" } 1
159
164
` ,
160
165
161
166
MetricNames : []string {
@@ -168,7 +173,8 @@ func TestEndpointSliceStore(t *testing.T) {
168
173
},
169
174
Obj : & discoveryv1.EndpointSlice {
170
175
ObjectMeta : metav1.ObjectMeta {
171
- Name : "test_endpointslice-labels" ,
176
+ Name : "test_endpointslice-labels" ,
177
+ Namespace : "test" ,
172
178
Annotations : map [string ]string {
173
179
"foo" : "baz" ,
174
180
},
@@ -183,7 +189,7 @@ func TestEndpointSliceStore(t *testing.T) {
183
189
# HELP kube_endpointslice_labels Kubernetes labels converted to Prometheus labels.
184
190
# TYPE kube_endpointslice_annotations gauge
185
191
# TYPE kube_endpointslice_labels gauge
186
- kube_endpointslice_annotations{endpointslice="test_endpointslice-labels",annotation_foo="baz"} 1
192
+ kube_endpointslice_annotations{endpointslice="test_endpointslice-labels",annotation_foo="baz",namespace="test" } 1
187
193
` ,
188
194
MetricNames : []string {
189
195
"kube_endpointslice_annotations" , "kube_endpointslice_labels" ,
0 commit comments