@@ -28,6 +28,8 @@ import (
28
28
"testing"
29
29
"time"
30
30
31
+ "k8s.io/kube-state-metrics/v2/pkg/optin"
32
+
31
33
"github.com/prometheus/client_golang/prometheus"
32
34
v1 "k8s.io/api/core/v1"
33
35
"k8s.io/apimachinery/pkg/api/resource"
@@ -151,7 +153,17 @@ func TestFullScrapeCycle(t *testing.T) {
151
153
if err != nil {
152
154
t .Fatal (err )
153
155
}
154
- builder .WithFamilyGeneratorFilter (l )
156
+
157
+ optInMetrics := make (map [string ]struct {})
158
+ optInMetricFamilyFilter , err := optin .NewMetricFamilyFilter (optInMetrics )
159
+ if err != nil {
160
+ t .Fatal (err )
161
+ }
162
+
163
+ builder .WithFamilyGeneratorFilter (generator .NewCompositeFamilyGeneratorFilter (
164
+ l ,
165
+ optInMetricFamilyFilter ,
166
+ ))
155
167
builder .WithAllowLabels (map [string ][]string {
156
168
"kube_pod_labels" : {
157
169
"namespace" ,
@@ -207,7 +219,6 @@ func TestFullScrapeCycle(t *testing.T) {
207
219
# HELP kube_pod_init_container_status_waiting Describes whether the init container is currently in waiting state.
208
220
# HELP kube_pod_init_container_status_waiting_reason Describes the reason the init container is currently in waiting state.
209
221
# HELP kube_pod_labels Kubernetes labels converted to Prometheus labels.
210
- # HELP kube_pod_nodeselectors Describes the Pod nodeSelectors.
211
222
# HELP kube_pod_overhead_cpu_cores The pod overhead in regards to cpu cores associated with running a pod.
212
223
# HELP kube_pod_overhead_memory_bytes The pod overhead in regards to memory associated with running a pod.
213
224
# HELP kube_pod_runtimeclass_name_info The runtimeclass associated with the pod.
@@ -251,7 +262,6 @@ func TestFullScrapeCycle(t *testing.T) {
251
262
# TYPE kube_pod_init_container_status_waiting gauge
252
263
# TYPE kube_pod_init_container_status_waiting_reason gauge
253
264
# TYPE kube_pod_labels gauge
254
- # TYPE kube_pod_nodeselectors gauge
255
265
# TYPE kube_pod_overhead_cpu_cores gauge
256
266
# TYPE kube_pod_overhead_memory_bytes gauge
257
267
# TYPE kube_pod_runtimeclass_name_info gauge
@@ -298,7 +308,6 @@ kube_pod_container_status_waiting{namespace="default",pod="pod0",uid="abc-0",con
298
308
kube_pod_created{namespace="default",pod="pod0",uid="abc-0"} 1.5e+09
299
309
kube_pod_info{namespace="default",pod="pod0",uid="abc-0",host_ip="1.1.1.1",pod_ip="1.2.3.4",node="node1",created_by_kind="<none>",created_by_name="<none>",priority_class="",host_network="false"} 1
300
310
kube_pod_labels{namespace="default",pod="pod0",uid="abc-0"} 1
301
- kube_pod_nodeselectors{namespace="default",pod="pod0",uid="abc-0"} 1
302
311
kube_pod_owner{namespace="default",pod="pod0",uid="abc-0",owner_kind="<none>",owner_name="<none>",owner_is_controller="<none>"} 1
303
312
kube_pod_restart_policy{namespace="default",pod="pod0",uid="abc-0",type="Always"} 1
304
313
kube_pod_status_phase{namespace="default",pod="pod0",uid="abc-0",phase="Failed"} 0
0 commit comments