Skip to content

Commit 8195dbe

Browse files
committed
Merge branch 'main' into remove-shard-validation-on-sts-create
2 parents 4aced25 + 3d969c5 commit 8195dbe

File tree

26 files changed

+204
-171
lines changed

26 files changed

+204
-171
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ env:
2020
E2E_SETUP_KIND: yes
2121
E2E_SETUP_KUBECTL: yes
2222
SUDO: sudo
23-
GO_VERSION: "^1.22"
24-
GOLANGCI_LINT_VERSION: "v1.56.2"
23+
GO_VERSION: "^1.23"
24+
GOLANGCI_LINT_VERSION: "v1.61.0"
2525

2626
jobs:
2727
ci-go-lint:

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
run:
2-
deadline: 10m
2+
timeout: 10m
33

44
linters:
55
disable-all: true

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
1515
OS ?= $(shell uname -s | tr A-Z a-z)
1616
ALL_ARCH = amd64 arm arm64 ppc64le s390x
1717
PKG = github.com/prometheus/common
18-
PROMETHEUS_VERSION = 2.53.1
19-
GO_VERSION = 1.22.5
18+
PROMETHEUS_VERSION = 2.54.1
19+
GO_VERSION = 1.23.1
2020
IMAGE = $(REGISTRY)/kube-state-metrics
2121
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
2222
USER ?= $(shell id -u -n)
2323
HOST ?= $(shell hostname)
24-
MARKDOWNLINT_CLI2_VERSION = 0.13.0
24+
MARKDOWNLINT_CLI2_VERSION = 0.14.0
2525

2626

2727
export DOCKER_CLI_EXPERIMENTAL=enabled

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,17 +407,20 @@ Starting from the kube-state-metrics chart `v2.13.3` (kube-state-metrics image `
407407

408408
#### Development
409409

410-
When developing, test a metric dump against your local Kubernetes cluster by
411-
running:
410+
When developing, test a metric dump against your local Kubernetes cluster by running:
412411

413412
> Users can override the apiserver address in KUBE-CONFIG file with `--apiserver` command line.
414413

415-
go install
416-
kube-state-metrics --port=8080 --telemetry-port=8081 --kubeconfig=<KUBE-CONFIG> --apiserver=<APISERVER>
414+
```
415+
go install
416+
kube-state-metrics --port=8080 --telemetry-port=8081 --kubeconfig=<KUBE-CONFIG> --apiserver=<APISERVER>
417+
```
417418
418419
Then curl the metrics endpoint
419420
420-
curl localhost:8080/metrics
421+
```
422+
curl localhost:8080/metrics
423+
```
421424
422425
To run the e2e tests locally see the documentation in [tests/README.md](./tests/README.md).
423426

README.md.tpl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,17 +408,20 @@ Starting from the kube-state-metrics chart `v2.13.3` (kube-state-metrics image `
408408

409409
#### Development
410410

411-
When developing, test a metric dump against your local Kubernetes cluster by
412-
running:
411+
When developing, test a metric dump against your local Kubernetes cluster by running:
413412

414413
> Users can override the apiserver address in KUBE-CONFIG file with `--apiserver` command line.
415414

416-
go install
417-
kube-state-metrics --port=8080 --telemetry-port=8081 --kubeconfig=<KUBE-CONFIG> --apiserver=<APISERVER>
415+
```
416+
go install
417+
kube-state-metrics --port=8080 --telemetry-port=8081 --kubeconfig=<KUBE-CONFIG> --apiserver=<APISERVER>
418+
```
418419

419420
Then curl the metrics endpoint
420421

421-
curl localhost:8080/metrics
422+
```
423+
curl localhost:8080/metrics
424+
```
422425

423426
To run the e2e tests locally see the documentation in [tests/README.md](./tests/README.md).
424427

go.mod

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module k8s.io/kube-state-metrics/v2
22

3-
go 1.22.0
4-
5-
toolchain go1.22.5
3+
go 1.23.0
64

75
require (
86
github.com/KimMachineGun/automemlimit v0.6.1
@@ -11,10 +9,10 @@ require (
119
github.com/gobuffalo/flect v1.0.2
1210
github.com/google/go-cmp v0.6.0
1311
github.com/oklog/run v1.1.0
14-
github.com/prometheus/client_golang v1.20.0
12+
github.com/prometheus/client_golang v1.20.3
1513
github.com/prometheus/client_model v0.6.1
16-
github.com/prometheus/common v0.55.0
17-
github.com/prometheus/exporter-toolkit v0.11.0
14+
github.com/prometheus/common v0.59.1
15+
github.com/prometheus/exporter-toolkit v0.12.0
1816
github.com/robfig/cron/v3 v3.0.1
1917
github.com/spf13/cobra v1.8.1
2018
github.com/spf13/viper v1.19.0
@@ -61,6 +59,8 @@ require (
6159
github.com/klauspost/compress v1.17.9 // indirect
6260
github.com/magiconair/properties v1.8.7 // indirect
6361
github.com/mailru/easyjson v0.7.7 // indirect
62+
github.com/mdlayher/socket v0.4.1 // indirect
63+
github.com/mdlayher/vsock v1.2.1 // indirect
6464
github.com/mitchellh/mapstructure v1.5.0 // indirect
6565
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
6666
github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -81,14 +81,14 @@ require (
8181
github.com/spf13/pflag v1.0.5 // indirect
8282
github.com/subosito/gotenv v1.6.0 // indirect
8383
go.uber.org/multierr v1.11.0 // indirect
84-
golang.org/x/crypto v0.24.0 // indirect
84+
golang.org/x/crypto v0.26.0 // indirect
8585
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
86-
golang.org/x/net v0.26.0 // indirect
87-
golang.org/x/oauth2 v0.21.0 // indirect
88-
golang.org/x/sync v0.7.0 // indirect
89-
golang.org/x/sys v0.22.0 // indirect
90-
golang.org/x/term v0.21.0 // indirect
91-
golang.org/x/text v0.16.0 // indirect
86+
golang.org/x/net v0.28.0 // indirect
87+
golang.org/x/oauth2 v0.22.0 // indirect
88+
golang.org/x/sync v0.8.0 // indirect
89+
golang.org/x/sys v0.23.0 // indirect
90+
golang.org/x/term v0.23.0 // indirect
91+
golang.org/x/text v0.17.0 // indirect
9292
golang.org/x/time v0.5.0 // indirect
9393
google.golang.org/protobuf v1.34.2 // indirect
9494
gopkg.in/inf.v0 v0.9.1 // indirect

go.sum

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V
9393
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
9494
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
9595
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
96+
github.com/mdlayher/socket v0.4.1 h1:eM9y2/jlbs1M615oshPQOHZzj6R6wMT7bX5NPiQvn2U=
97+
github.com/mdlayher/socket v0.4.1/go.mod h1:cAqeGjoufqdxWkD7DkpyS+wcefOtmu5OQ8KuoJGIReA=
98+
github.com/mdlayher/vsock v1.2.1 h1:pC1mTJTvjo1r9n9fbm7S1j04rCgCzhCOS5DY0zqHlnQ=
99+
github.com/mdlayher/vsock v1.2.1/go.mod h1:NRfCibel++DgeMD8z/hP+PPTjlNJsdPOmxcnENvE+SE=
96100
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
97101
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
98102
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -121,14 +125,14 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
121125
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
122126
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
123127
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
124-
github.com/prometheus/client_golang v1.20.0 h1:jBzTZ7B099Rg24tny+qngoynol8LtVYlA2bqx3vEloI=
125-
github.com/prometheus/client_golang v1.20.0/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
128+
github.com/prometheus/client_golang v1.20.3 h1:oPksm4K8B+Vt35tUhw6GbSNSgVlVSBH0qELP/7u83l4=
129+
github.com/prometheus/client_golang v1.20.3/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
126130
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
127131
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
128-
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
129-
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
130-
github.com/prometheus/exporter-toolkit v0.11.0 h1:yNTsuZ0aNCNFQ3aFTD2uhPOvr4iD7fdBvKPAEGkNf+g=
131-
github.com/prometheus/exporter-toolkit v0.11.0/go.mod h1:BVnENhnNecpwoTLiABx7mrPB/OLRIgN74qlQbV+FK1Q=
132+
github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0=
133+
github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
134+
github.com/prometheus/exporter-toolkit v0.12.0 h1:DkE5RcEZR3lQA2QD5JLVQIf41dFKNsVMXFhgqcif7fo=
135+
github.com/prometheus/exporter-toolkit v0.12.0/go.mod h1:fQH0KtTn0yrrS0S82kqppRjDDiwMfIQUwT+RBRRhwUc=
132136
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
133137
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
134138
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
@@ -177,8 +181,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8
177181
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
178182
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
179183
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
180-
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
181-
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
184+
golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
185+
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
182186
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
183187
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
184188
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -187,27 +191,27 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
187191
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
188192
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
189193
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
190-
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
191-
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
192-
golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs=
193-
golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
194+
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
195+
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
196+
golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA=
197+
golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
194198
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
195199
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
196200
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
197-
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
198-
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
201+
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
202+
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
199203
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
200204
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
201205
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
202206
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
203-
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
204-
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
205-
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
206-
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
207+
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
208+
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
209+
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
210+
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
207211
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
208212
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
209-
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
210-
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
213+
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
214+
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
211215
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
212216
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
213217
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

internal/discovery/types.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ type kindPlural struct {
3737

3838
// CRDiscoverer provides a cache of the collected GVKs, along with helper utilities.
3939
type CRDiscoverer struct {
40-
// m is a mutex to protect the cache.
41-
m sync.RWMutex
42-
// Map is a cache of the collected GVKs.
43-
Map map[string]map[string][]kindPlural
44-
// ShouldUpdate is a flag that indicates whether the cache was updated.
45-
WasUpdated bool
4640
// CRDsAddEventsCounter tracks the number of times that the CRD informer triggered the "add" event.
4741
CRDsAddEventsCounter prometheus.Counter
4842
// CRDsDeleteEventsCounter tracks the number of times that the CRD informer triggered the "remove" event.
4943
CRDsDeleteEventsCounter prometheus.Counter
5044
// CRDsCacheCountGauge tracks the net amount of CRDs affecting the cache at this point.
5145
CRDsCacheCountGauge prometheus.Gauge
46+
// Map is a cache of the collected GVKs.
47+
Map map[string]map[string][]kindPlural
48+
// m is a mutex to protect the cache.
49+
m sync.RWMutex
50+
// ShouldUpdate is a flag that indicates whether the cache was updated.
51+
WasUpdated bool
5252
}
5353

5454
// SafeRead executes the given function while holding a read lock.

internal/store/builder.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,24 @@ var _ ksmtypes.BuilderInterface = &Builder{}
6565
// Builder helps to build store. It follows the builder pattern
6666
// (https://en.wikipedia.org/wiki/Builder_pattern).
6767
type Builder struct {
68-
kubeClient clientset.Interface
69-
customResourceClients map[string]interface{}
70-
namespaces options.NamespaceList
71-
// namespaceFilter is inside fieldSelectorFilter
72-
fieldSelectorFilter string
68+
kubeClient clientset.Interface
7369
ctx context.Context
74-
enabledResources []string
7570
familyGeneratorFilter generator.FamilyGeneratorFilter
71+
customResourceClients map[string]interface{}
7672
listWatchMetrics *watch.ListWatchMetrics
7773
shardingMetrics *sharding.Metrics
78-
shard int32
79-
totalShards int
8074
buildStoresFunc ksmtypes.BuildStoresFunc
8175
buildCustomResourceStoresFunc ksmtypes.BuildCustomResourceStoresFunc
8276
allowAnnotationsList map[string][]string
8377
allowLabelsList map[string][]string
84-
useAPIServerCache bool
8578
utilOptions *options.Options
79+
// namespaceFilter is inside fieldSelectorFilter
80+
fieldSelectorFilter string
81+
namespaces options.NamespaceList
82+
enabledResources []string
83+
totalShards int
84+
shard int32
85+
useAPIServerCache bool
8686
}
8787

8888
// NewBuilder returns a new builder.

internal/store/job.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ func jobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []generat
219219
}
220220
}
221221

222+
reasonKnown := false
222223
for _, c := range j.Status.Conditions {
223224
condition := c
224225
if condition.Type == v1batch.JobFailed {
225-
reasonKnown := false
226226
for _, reason := range jobFailureReasons {
227227
reasonKnown = reasonKnown || failureReason(&condition, reason)
228228

@@ -233,16 +233,16 @@ func jobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []generat
233233
Value: boolFloat64(failureReason(&condition, reason)),
234234
})
235235
}
236-
// for unknown reasons
237-
if !reasonKnown {
238-
ms = append(ms, &metric.Metric{
239-
LabelKeys: []string{"reason"},
240-
LabelValues: []string{""},
241-
Value: float64(j.Status.Failed),
242-
})
243-
}
244236
}
245237
}
238+
// for unknown reasons
239+
if !reasonKnown {
240+
ms = append(ms, &metric.Metric{
241+
LabelKeys: []string{"reason"},
242+
LabelValues: []string{""},
243+
Value: float64(j.Status.Failed),
244+
})
245+
}
246246

247247
return &metric.Family{
248248
Metrics: ms,

0 commit comments

Comments
 (0)