Skip to content

Commit 7c129f1

Browse files
committed
Merge branch 'main' into kubernetes#2501-Count-volumes-attached-to-a-node
# Conflicts: # internal/store/node_test.go
2 parents 08c753e + 17151ac commit 7c129f1

File tree

93 files changed

+2179
-1294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2179
-1294
lines changed

.github/workflows/ci.yml

+30-20
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ 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:
2828
name: ci-go-lint
2929
runs-on: ubuntu-latest
3030
steps:
3131
- name: Check out code into the Go module directory
32-
uses: actions/checkout@v4
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3333

3434
- name: Set up Go 1.x
35-
uses: actions/setup-go@v5
35+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
3636
with:
3737
go-version: ${{ env.GO_VERSION }}
3838
id: go
@@ -51,10 +51,10 @@ jobs:
5151
runs-on: ubuntu-latest
5252
steps:
5353
- name: Check out code into the Go module directory
54-
uses: actions/checkout@v4
54+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5555

5656
- name: Set up Go 1.x
57-
uses: actions/setup-go@v5
57+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
5858
with:
5959
go-version: ${{ env.GO_VERSION }}
6060
id: go
@@ -72,10 +72,10 @@ jobs:
7272
runs-on: ubuntu-latest
7373
steps:
7474
- name: Check out code into the Go module directory
75-
uses: actions/checkout@v4
75+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7676

7777
- name: Set up Go 1.x
78-
uses: actions/setup-go@v5
78+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
7979
with:
8080
go-version: ${{ env.GO_VERSION }}
8181
id: go
@@ -93,10 +93,10 @@ jobs:
9393
runs-on: ubuntu-latest
9494
steps:
9595
- name: Check out code into the Go module directory
96-
uses: actions/checkout@v4
96+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9797

9898
- name: Set up Go 1.x
99-
uses: actions/setup-go@v5
99+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
100100
with:
101101
go-version: ${{ env.GO_VERSION }}
102102
id: go
@@ -114,10 +114,10 @@ jobs:
114114
runs-on: ubuntu-latest
115115
steps:
116116
- name: Check out code into the Go module directory
117-
uses: actions/checkout@v4
117+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
118118

119119
- name: Set up Go 1.x
120-
uses: actions/setup-go@v5
120+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
121121
with:
122122
go-version: ${{ env.GO_VERSION }}
123123
id: go
@@ -135,7 +135,7 @@ jobs:
135135
runs-on: ubuntu-latest
136136
steps:
137137
- name: Check out code into the Go module directory
138-
uses: actions/checkout@v4
138+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
139139

140140
- name: Setup promtool
141141
run: |
@@ -150,10 +150,10 @@ jobs:
150150
runs-on: ubuntu-latest
151151
steps:
152152
- name: Check out code into the Go module directory
153-
uses: actions/checkout@v4
153+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
154154

155155
- name: Set up Go 1.x
156-
uses: actions/setup-go@v5
156+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
157157
with:
158158
go-version: ${{ env.GO_VERSION }}
159159
id: go
@@ -164,17 +164,27 @@ jobs:
164164
165165
- name: Benchmark tests
166166
run: |
167-
make test-benchmark-compare
167+
BENCHSTAT_OUTPUT_FILE=result.txt make test-benchmark-compare
168+
- run: |
169+
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
170+
cat result.txt >> "$GITHUB_STEP_SUMMARY"
171+
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
172+
cat <<EOL >> "$GITHUB_STEP_SUMMARY"
173+
<hr />
174+
The table shows the median and 95% confidence interval (CI) summaries for each benchmark comparing the HEAD and the BASE, and an A/B comparison under "vs base". The last column shows the statistical p-value with ten runs (n=10).
175+
The last row has the Geometric Mean (geomean) for the given rows in the table.
176+
Refer to <a href="https://pkg.go.dev/golang.org/x/perf/cmd/benchstat">benchstat's documentation</a> for more help.
177+
EOL
168178
169179
ci-build-kube-state-metrics:
170180
name: ci-build-kube-state-metrics
171181
runs-on: ubuntu-latest
172182
steps:
173183
- name: Check out code into the Go module directory
174-
uses: actions/checkout@v4
184+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
175185

176186
- name: Set up Go 1.x
177-
uses: actions/setup-go@v5
187+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
178188
with:
179189
go-version: ${{ env.GO_VERSION }}
180190
id: go
@@ -192,10 +202,10 @@ jobs:
192202
runs-on: ubuntu-latest
193203
steps:
194204
- name: Check out code into the Go module directory
195-
uses: actions/checkout@v4
205+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
196206

197207
- name: Set up Go 1.x
198-
uses: actions/setup-go@v5
208+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
199209
with:
200210
go-version: ${{ env.GO_VERSION }}
201211
id: go

.github/workflows/govulncheck.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- cron: '0 0 * * 1'
77

88
env:
9-
GO_VERSION: "^1.22"
9+
GO_VERSION: "^1.23"
1010

1111
permissions:
1212
contents: read
@@ -15,10 +15,10 @@ jobs:
1515
ci-security-checks:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919
name: Checkout code
2020
- name: Set up Go 1.x
21-
uses: actions/setup-go@v5
21+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
2222
with:
2323
go-version: ${{ env.GO_VERSION }}
2424
- name: Install govulncheck binary

.github/workflows/openvex.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,35 @@ name: openvex
33
on:
44
workflow_dispatch:
55
release:
6-
types: [published]
6+
types:
7+
- released
8+
9+
permissions:
10+
contents: read
11+
712
jobs:
813
vexctl:
914
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write
18+
1019
steps:
1120
- name: Checkout code
12-
uses: actions/checkout@v4
21+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
1323
- name: Set environment variables
1424
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
25+
1526
- uses: openvex/generate-vex@c59881b41451d7ccba5c3b74cd195382b8971fcd
1627
# Refer: https://github.com/openvex/vexctl#operational-model
1728
name: Run vexctl
1829
with:
1930
product: pkg:golang/k8s.io/kube-state-metrics/v2@${{ env.RELEASE_VERSION }}
31+
file: kube-state-metrics.openvex.json
32+
33+
- name: Upload OpenVEX document to GitHub Release
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
run: |
37+
gh release upload ${{ env.RELEASE_VERSION }} kube-state-metrics.openvex.json

.github/workflows/sbom.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Generate SBOM with Kubernetes BOM
2+
3+
on:
4+
release:
5+
types:
6+
- released
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
sbom:
13+
runs-on: ubuntu-latest
14+
15+
permissions:
16+
contents: write
17+
18+
env:
19+
OUTPUT: sbom.spdx
20+
TAG: ${{ github.event.release.tag_name }}
21+
22+
steps:
23+
- name: Fetch source code into GITHUB_WORKSPACE
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
- name: Install Kubernetes BOM
27+
uses: kubernetes-sigs/release-actions/setup-bom@a69972745f85aab4ba5d6c681e2a0e7f73eaff2b # v0.3.0
28+
29+
- name: Generate SBOM
30+
run: |
31+
bom generate \
32+
--dirs=. \
33+
--image=registry.k8s.io/kube-state-metrics/kube-state-metrics:$TAG \
34+
--namespace=https://github.com/kubernetes/kube-state-metrics/releases/download/$TAG/$OUTPUT \
35+
--output=$OUTPUT
36+
37+
- name: Upload SBOM to GitHub Release
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: |
41+
gh release upload $TAG $OUTPUT

.github/workflows/semantic.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
name: Validate PR title for semantic commit message
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: amannn/action-semantic-pull-request@v5
21+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.golangci.yml

+2-1
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
@@ -17,6 +17,7 @@ linters:
1717
- revive
1818
- staticcheck
1919
- unconvert
20+
- unused
2021

2122
linters-settings:
2223
goimports:

CHANGELOG.md

+38
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
## v2.14.0 / 2024-11-08
2+
3+
### Note
4+
5+
* This release builds with Golang `v1.23.3`
6+
* This release builds with `k8s.io/client-go`: `v0.31.2`
7+
* This release removes `kube_endpoint_address_not_ready` and `kube_endpoint_address_available` which have been deprecated in 2022. Please use `kube_endpoint_address`as a replacement.
8+
9+
* [BUGFIX] Use --track-unscheduled-pods to select unscheduled pods in Daemonset sharding by @CatherineF-dev in <https://github.com/kubernetes/kube-state-metrics/pull/2388>
10+
* [BUGFIX] Install tools so VERSION gets set by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2456>
11+
* [BUGFIX] Syntax errors in kube-state-metrics.libsonnet by @jeffmccune in <https://github.com/kubernetes/kube-state-metrics/pull/2454>
12+
* [BUGFIX] Set kube_job_status_failed metric even when there are no job.Status.Conditions present by @richabanker in <https://github.com/kubernetes/kube-state-metrics/pull/2485>
13+
* [BUGFIX] de-duplication of custom resource metrics by @bartlettc22 in <https://github.com/kubernetes/kube-state-metrics/pull/2502>
14+
* [BUGFIX] Configure sharding every time MetricsHandler.Run runs by @wallee94 in <https://github.com/kubernetes/kube-state-metrics/pull/2478>
15+
* [BUGFIX] Panic in `util.GVRFromType` for core objects by @L3n41c in <https://github.com/kubernetes/kube-state-metrics/pull/2535>
16+
* [BUGFIX] Big memory value overflow by @leiwingqueen in <https://github.com/kubernetes/kube-state-metrics/pull/2540>
17+
* [BUGFIX] Expose empty labels by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2539>
18+
* [BUGFIX] CustomResourceMetrics: Convert status condition Unknown to a valid value by @Haleygo in <https://github.com/kubernetes/kube-state-metrics/pull/2536>
19+
* [CHANGE] Remove deprecated endpoint address metric by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2527>
20+
* [FEATURE] Add new metric kube_job_status_suspended by @Indresh2410 in <https://github.com/kubernetes/kube-state-metrics/pull/2542>
21+
* [FEATURE] Move endpoint ports into address metric by @mrueg in <https://github.com/kubernetes/kube-state-metrics/pull/2503>
22+
* [ENHANCEMENT] Use concurrent map when storing metrics by @rarruda in <https://github.com/kubernetes/kube-state-metrics/pull/2510>
23+
24+
## v2.13.0 / 2024-07-18
25+
26+
### Note
27+
28+
* This release builds with Golang `v1.22.5`.
29+
* This release builds with `k8s.io/client-go`: `v0.30.3`.
30+
* This release adds read and write timeouts for requests. The defaults might have an impact on scrapes that take a long time.
31+
32+
* [BUGFIX] Pod autosharding: transition from labelselector to fieldselector by @pkoutsovasilis in <https://github.com/kubernetes/kube-state-metrics/pull/2347>
33+
* [ENHANCEMENT] Add automatic detection of memory limits by @SuperQ in <https://github.com/kubernetes/kube-state-metrics/pull/2447>
34+
* [FEATURE] Add `readyz` endpoint by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2442>
35+
* [FEATURE] Add `livez` endpoint by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2418>
36+
* [FEATURE] Add kube_persistentvolume_volume_mode metric by @ricardoapl in <https://github.com/kubernetes/kube-state-metrics/pull/2370>
37+
* [FEATURE] Add read and write timeouts by @Pokom in <https://github.com/kubernetes/kube-state-metrics/pull/2412>
38+
139
## v2.12.0 / 2024-04-02
240

341
### Note

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
ARG GOVERSION=1.22
1+
ARG GOVERSION=1.23
22
ARG GOARCH
33
FROM golang:${GOVERSION} as builder
44
ARG GOARCH
55
ENV GOARCH=${GOARCH}
66
WORKDIR /go/src/k8s.io/kube-state-metrics/
77
COPY . /go/src/k8s.io/kube-state-metrics/
88

9-
RUN make build-local
9+
RUN make install-tools && make build-local
1010

1111
FROM gcr.io/distroless/static:latest-${GOARCH}
1212
COPY --from=builder /go/src/k8s.io/kube-state-metrics/kube-state-metrics /

Makefile

+6-6
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.51.1
19-
GO_VERSION = 1.22.2
18+
PROMETHEUS_VERSION = 2.55.1
19+
GO_VERSION = 1.23.3
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
@@ -48,7 +48,7 @@ lint: shellcheck licensecheck lint-markdown-format
4848

4949
lint-fix: fix-markdown-format
5050
golangci-lint run --fix -v
51-
51+
5252

5353
doccheck: generate validate-template
5454
@echo "- Checking if the generated documentation is up to date..."
@@ -97,8 +97,8 @@ validate-template: generate-template
9797
# the two.
9898
test-benchmark-compare:
9999
@git fetch
100-
./tests/compare_benchmarks.sh main
101-
./tests/compare_benchmarks.sh ${LATEST_RELEASE_BRANCH}
100+
./tests/compare_benchmarks.sh main 2
101+
./tests/compare_benchmarks.sh ${LATEST_RELEASE_BRANCH} 2
102102

103103
all: all-container
104104

0 commit comments

Comments
 (0)