Skip to content

Commit b5b585f

Browse files
Merge pull request #89 from rexagod/openshift-master
OCPBUGS-6320: Merge `upstream/release-2.8`
2 parents 0ad7baf + 92ba6e8 commit b5b585f

File tree

968 files changed

+57569
-353010
lines changed

Some content is hidden

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

968 files changed

+57569
-353010
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ assignees: ''
99

1010
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
1111
12-
If the matter is security related, please disclose it privately see https://github.com/kubernetes/kube-state-metrics/blob/master/SECURITY.md
12+
If the matter is security related, please disclose it privately see https://github.com/kubernetes/kube-state-metrics/blob/main/SECURITY.md
1313
-->
1414

1515
**What happened**:

.github/workflows/ci.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ name: continuous-integration
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
- release*
88
tags:
99
- v1.*
1010
- v2.*
1111
pull_request:
1212
branches:
13-
- master
13+
- main
1414
- release*
1515

1616
permissions:
@@ -21,7 +21,7 @@ env:
2121
E2E_SETUP_KUBECTL: yes
2222
SUDO: sudo
2323
GO_VERSION: "^1.19"
24-
GOLANGCI_LINT_VERSION: "v1.48.0"
24+
GOLANGCI_LINT_VERSION: "v1.50.1"
2525

2626
jobs:
2727
ci-go-lint:
@@ -39,7 +39,6 @@ jobs:
3939

4040
- name: Setup environment
4141
run: |
42-
go get -v -t -d ./...
4342
make install-tools
4443
4544
- name: Lint
@@ -62,7 +61,6 @@ jobs:
6261

6362
- name: Setup environment
6463
run: |
65-
go get -v -t -d ./...
6664
make install-tools
6765
6866
- name: Validate generated manifests
@@ -84,7 +82,6 @@ jobs:
8482

8583
- name: Setup environment
8684
run: |
87-
go get -v -t -d ./...
8885
make install-tools
8986
9087
- name: Validate go modules
@@ -106,7 +103,6 @@ jobs:
106103

107104
- name: Setup environment
108105
run: |
109-
go get -v -t -d ./...
110106
make install-tools
111107
112108
- name: Check that all metrics are documented
@@ -128,7 +124,6 @@ jobs:
128124

129125
- name: Setup environment
130126
run: |
131-
go get -v -t -d ./...
132127
make install-tools
133128
134129
- name: Unit tests
@@ -165,7 +160,6 @@ jobs:
165160

166161
- name: Setup environment
167162
run: |
168-
go get -v -t -d ./...
169163
make install-tools
170164
171165
- name: Benchmark tests
@@ -187,7 +181,6 @@ jobs:
187181

188182
- name: Setup environment
189183
run: |
190-
go get -v -t -d ./...
191184
make install-tools
192185
193186
- name: Build
@@ -209,7 +202,6 @@ jobs:
209202

210203
- name: Setup environment
211204
run: |
212-
go get -v -t -d ./...
213205
make install-tools
214206
215207
- name: End-to-end tests

.github/workflows/cron.yml renamed to .github/workflows/govulncheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: cron
1+
name: govulncheck
22

33
on:
44
schedule:

.golangci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ linters:
2020

2121
linters-settings:
2222
goimports:
23-
local-prefixes: k8s.io/kube-state-metrics
23+
local-prefixes: k8s.io/kube-state-metrics,k8s.io/kube-state-metrics/v2
2424

2525
issues:
2626
exclude-use-default: false
@@ -33,3 +33,6 @@ issues:
3333
- text: "G104:"
3434
linters:
3535
- gosec
36+
- text: "package-comments:"
37+
linters:
38+
- revive

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
## v2.8.0 / 2023-02-10
2+
3+
Note: The `--version` flag was removed as `kube-state-metrics version` also provides the same information. See #1956
4+
5+
Note: Experimental CustomResourceState changed their labels for better usability. See #1942
6+
kube_crd_uptime{group="myteam.io", kind="Foo", version="v1"} -> kube_customresource_uptime{customresource_group="myteam.io", customresource_kind="Foo", customresource_version="v1"}
7+
8+
* [CHANGE] Prefix Group, Version and Kind labels for CustomResourceState Metrics #1942 @bavarianbidi
9+
* [CHANGE] Fix empty string for "owner_\*" dimensions #1923 @pawcykca
10+
* [CHANGE] Remove broken --version flag, replace by version command #1956 @bjorand
11+
* [FEATURE] Add metrics for EndpointSlices #1910 @mrueg
12+
* [FEATURE] Add metrics for config file changes #1916 @mrueg
13+
* [FEATURE] Add metrics for CustomResource State config file change #1928 @mrueg
14+
* [FEATURE] Reload Kube-State-Metrics on CustomResourceState config file change #1930 @mrueg
15+
* [FEATURE] Make CustomResourceState metrics type dynamic #1930 @rexagod
16+
* [FEATURE] Add kube_pod_status_qos_class to pod metrics #1932 @frezes
17+
* [FEATURE] Add kube_pod_status_ready_time and kube_pod_status_containers_ready_time metrics #1938 @ryanrolds
18+
* [FEATURE] Enrich UserAgent with more information about kube-state-metrics #1960 @mrueg
19+
* [FEATURE] Convert True/False to 1.0/0.0 values in CustomResourceState metrics #1963 @jabdoa2
20+
* [FEATURE] Expose metrics in OpenMetrics format #1974 @mrueg
21+
* [BUGFIX] Handle unit length `valueFrom` values #1958 @rexagod
22+
* [ENHANCEMENT] Build with kubernetes 1.26 #1933 @mrueg
23+
124
## v2.7.0 / 2022-11-25
225

326
Note: Experimental VerticalPodAutoscaler metrics are considered deprecated in this release and will be removed in v2.9.0.

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ 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.39.1
19-
GO_VERSION = 1.19.3
18+
PROMETHEUS_VERSION = 2.40.6
19+
GO_VERSION = 1.19.4
2020
IMAGE = $(REGISTRY)/kube-state-metrics
2121
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
2222
USER ?= $(shell id -u -n)
@@ -44,6 +44,9 @@ licensecheck:
4444
lint: shellcheck licensecheck
4545
golangci-lint run
4646

47+
lint-fix:
48+
golangci-lint run --fix -v
49+
4750
doccheck: generate
4851
@echo "- Checking if the generated documentation is up to date..."
4952
@git diff --exit-code
@@ -78,7 +81,7 @@ shellcheck:
7881
# the two.
7982
test-benchmark-compare:
8083
@git fetch
81-
./tests/compare_benchmarks.sh master
84+
./tests/compare_benchmarks.sh main
8285
./tests/compare_benchmarks.sh ${LATEST_RELEASE_BRANCH}
8386

8487
all: all-container
@@ -147,11 +150,11 @@ scripts/vendor: scripts/jsonnetfile.json scripts/jsonnetfile.lock.json
147150

148151
install-tools:
149152
@echo Installing tools from tools.go
150-
@cat tools/tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %
153+
grep '^\s*_' tools/tools.go | awk '{print $$2}' | xargs -tI % go install -mod=readonly -modfile=tools/go.mod %
151154

152155
install-promtool:
153156
@echo Installing promtool
154157
@wget -qO- "https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.${OS}-${ARCH}.tar.gz" |\
155158
tar xvz --strip-components=1 prometheus-${PROMETHEUS_VERSION}.${OS}-${ARCH}/promtool
156159

157-
.PHONY: all build build-local all-push all-container container container-* do-push-* sub-push-* push push-multi-arch test-unit test-rules test-benchmark-compare clean e2e validate-modules shellcheck licensecheck lint generate embedmd
160+
.PHONY: all build build-local all-push all-container container container-* do-push-* sub-push-* push push-multi-arch test-unit test-rules test-benchmark-compare clean e2e validate-modules shellcheck licensecheck lint lint-fix generate embedmd

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Overview
22

33
[![Build Status](https://github.com/kubernetes/kube-state-metrics/workflows/continuous-integration/badge.svg)](https://github.com/kubernetes/kube-state-metrics/actions)
4-
[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes/kube-state-metrics)](https://goreportcard.com/report/github.com/kubernetes/kube-state-metrics) [![GoDoc](https://godoc.org/github.com/kubernetes/kube-state-metrics?status.svg)](https://godoc.org/github.com/kubernetes/kube-state-metrics)
4+
[![Go Report Card](https://goreportcard.com/badge/github.com/kubernetes/kube-state-metrics)](https://goreportcard.com/report/github.com/kubernetes/kube-state-metrics)
5+
[![Go Reference](https://pkg.go.dev/badge/github.com/kubernetes/kube-state-metrics.svg)](https://pkg.go.dev/github.com/kubernetes/kube-state-metrics)
6+
[![govulncheck](https://github.com/kubernetes/kube-state-metrics/actions/workflows/govulncheck.yml/badge.svg)](https://github.com/kubernetes/kube-state-metrics/actions/workflows/govulncheck.yml)
57

68
kube-state-metrics (KSM) is a simple service that listens to the Kubernetes API
79
server and generates metrics about the state of the objects. (See examples in
@@ -45,7 +47,7 @@ are deleted they are no longer visible on the `/metrics` endpoint.
4547
- [Resource recommendation](#resource-recommendation)
4648
- [Horizontal sharding](#horizontal-sharding)
4749
- [Automated sharding](#automated-sharding)
48-
- [Daemonset sharding for pod metrics](#daemonset-sharding-pod-metrics)
50+
- [Daemonset sharding for pod metrics](#daemonset-sharding-for-pod-metrics)
4951
- [Setup](#setup)
5052
- [Building the Docker container](#building-the-docker-container)
5153
- [Usage](#usage)
@@ -72,12 +74,12 @@ Generally, it is recommended to use the latest release of kube-state-metrics. If
7274

7375
| kube-state-metrics | Kubernetes client-go Version |
7476
|--------------------|:----------------------------:|
75-
| **v2.3.0** | v1.23 |
7677
| **v2.4.2** | v1.23 |
7778
| **v2.5.0** | v1.24 |
7879
| **v2.6.0** | v1.24 |
7980
| **v2.7.0** | v1.25 |
80-
| **master** | v1.25 |
81+
| **v2.8.0** | v1.26 |
82+
| **main** | v1.26 |
8183

8284

8385
#### Resource group version compatibility
@@ -89,7 +91,7 @@ release.
8991
#### Container Image
9092

9193
The latest container image can be found at:
92-
* `registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.7.0` (arch: `amd64`, `arm`, `arm64`, `ppc64le` and `s390x`)
94+
* `registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.8.0` (arch: `amd64`, `arm`, `arm64`, `ppc64le` and `s390x`)
9395

9496
### Metrics Documentation
9597

@@ -155,7 +157,7 @@ http_request_duration_seconds_count{handler="metrics",method="get"} 30
155157

156158
kube-state-metrics also exposes build and configuration metrics:
157159
```
158-
kube_state_metrics_build_info{branch="master",goversion="go1.15.3",revision="6c9d775d",version="v2.0.0-beta"} 1
160+
kube_state_metrics_build_info{branch="main",goversion="go1.15.3",revision="6c9d775d",version="v2.0.0-beta"} 1
159161
kube_state_metrics_shard_ordinal{shard_ordinal="0"} 0
160162
kube_state_metrics_total_shards 1
161163
```
@@ -165,6 +167,17 @@ please check the blog post [here](https://www.robustperception.io/exposing-the-s
165167
Sharding metrics expose `--shard` and `--total-shards` flags and can be used to validate
166168
run-time configuration, see [`/examples/prometheus-alerting-rules`](./examples/prometheus-alerting-rules).
167169

170+
kube-state-metrics also exposes metrics about it config file and the Custom Resource State config file:
171+
172+
```
173+
kube_state_metrics_config_hash{filename="crs.yml",type="customresourceconfig"} 2.38272279311849e+14
174+
kube_state_metrics_config_hash{filename="config.yml",type="config"} 2.65285922340846e+14
175+
kube_state_metrics_last_config_reload_success_timestamp_seconds{filename="crs.yml",type="customresourceconfig"} 1.6704882592037103e+09
176+
kube_state_metrics_last_config_reload_success_timestamp_seconds{filename="config.yml",type="config"} 1.6704882592035313e+09
177+
kube_state_metrics_last_config_reload_successful{filename="crs.yml",type="customresourceconfig"} 1
178+
kube_state_metrics_last_config_reload_successful{filename="config.yml",type="config"} 1
179+
```
180+
168181
### Scaling kube-state-metrics
169182

170183
#### Resource recommendation

RELEASE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ We use [Semantic Versioning](http://semver.org/).
66

77
We maintain a separate branch for each minor release, named `release-<major>.<minor>`, e.g. `release-1.1`, `release-2.0`.
88

9-
The usual flow is to merge new features and changes into the master branch and to merge bug fixes into the latest release branch. Bug fixes are then merged into master from the latest release branch. The master branch should always contain all commits from the latest release branch.
9+
The usual flow is to merge new features and changes into the main branch and to merge bug fixes into the latest release branch. Bug fixes are then merged into main from the latest release branch. The main branch should always contain all commits from the latest release branch.
1010

11-
If a bug fix got accidentally merged into master, cherry-pick commits have to be created in the latest release branch, which then have to be merged back into master. Try to avoid that situation.
11+
If a bug fix got accidentally merged into main, cherry-pick commits have to be created in the latest release branch, which then have to be merged back into main. Try to avoid that situation.
1212

1313
Maintaining the release branches for older minor releases happens on a best effort basis.
1414

@@ -34,7 +34,7 @@ Maintaining the release branches for older minor releases happens on a best effo
3434
* Create a new **pre-release** on github
3535
* New images are automatically built and pushed to `gcr.io/k8s-staging-kube-state-metrics/kube-state-metrics`
3636
* Promote image by sending a PR to [kubernetes/k8s.io](https://github.com/kubernetes/k8s.io) repository. Follow the [example PR](https://github.com/kubernetes/k8s.io/pull/3798). Use [kpromo pr](https://github.com/kubernetes-sigs/promo-tools/blob/main/docs/promotion-pull-requests.md) to update the manifest files in this repository, e.g. `kpromo pr --fork=$YOURNAME -i --project=kube-state-metrics -t=v2.5.0`
37-
* Create a PR to merge the changes of this release back into the master branch.
37+
* Create a PR to merge the changes of this release back into the main branch.
3838
* Once the PR to promote the image is merged, mark the pre-release as a regular release.
3939
4040
## Stable release

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.0
1+
2.8.0

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ See each file for specific documentation about the exposed metrics:
6565

6666
- [ClusterRole Metrics](clusterrole-metrics.md)
6767
- [ClusterRoleBinding Metrics](clusterrolebinding-metrics.md)
68+
- [EndpointSlice Metrics](endpointslice-metrics.md)
6869
- [IngressClass Metrics](ingressclass-metrics.md)
6970
- [Role Metrics](role-metrics.md)
7071
- [RoleBinding Metrics](rolebinding-metrics.md)

0 commit comments

Comments
 (0)