Skip to content

Commit 362192d

Browse files
Merge pull request #82 from rhobs/automated-updates-master
[bot] Bump openshift/kube-state-metrics to v2.7.0
2 parents ea2e6d5 + 481474f commit 362192d

File tree

1,070 files changed

+291840
-154448
lines changed

Some content is hidden

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

1,070 files changed

+291840
-154448
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ on:
1313
- master
1414
- release*
1515

16+
permissions:
17+
contents: read
18+
1619
env:
1720
E2E_SETUP_KIND: yes
1821
E2E_SETUP_KUBECTL: yes
1922
SUDO: sudo
20-
GO_VERSION: "^1.18"
23+
GO_VERSION: "^1.19"
2124
GOLANGCI_LINT_VERSION: "v1.48.0"
2225

2326
jobs:
@@ -26,13 +29,13 @@ jobs:
2629
runs-on: ubuntu-latest
2730
steps:
2831
- name: Set up Go 1.x
29-
uses: actions/setup-go@v2
32+
uses: actions/setup-go@v3
3033
with:
3134
go-version: ${{ env.GO_VERSION }}
3235
id: go
3336

3437
- name: Check out code into the Go module directory
35-
uses: actions/checkout@v2
38+
uses: actions/checkout@v3
3639

3740
- name: Setup environment
3841
run: |
@@ -49,13 +52,13 @@ jobs:
4952
runs-on: ubuntu-latest
5053
steps:
5154
- name: Set up Go 1.x
52-
uses: actions/setup-go@v2
55+
uses: actions/setup-go@v3
5356
with:
5457
go-version: ${{ env.GO_VERSION }}
5558
id: go
5659

5760
- name: Check out code into the Go module directory
58-
uses: actions/checkout@v2
61+
uses: actions/checkout@v3
5962

6063
- name: Setup environment
6164
run: |
@@ -71,13 +74,13 @@ jobs:
7174
runs-on: ubuntu-latest
7275
steps:
7376
- name: Set up Go 1.x
74-
uses: actions/setup-go@v2
77+
uses: actions/setup-go@v3
7578
with:
7679
go-version: ${{ env.GO_VERSION }}
7780
id: go
7881

7982
- name: Check out code into the Go module directory
80-
uses: actions/checkout@v2
83+
uses: actions/checkout@v3
8184

8285
- name: Setup environment
8386
run: |
@@ -93,13 +96,13 @@ jobs:
9396
runs-on: ubuntu-latest
9497
steps:
9598
- name: Set up Go 1.x
96-
uses: actions/setup-go@v2
99+
uses: actions/setup-go@v3
97100
with:
98101
go-version: ${{ env.GO_VERSION }}
99102
id: go
100103

101104
- name: Check out code into the Go module directory
102-
uses: actions/checkout@v2
105+
uses: actions/checkout@v3
103106

104107
- name: Setup environment
105108
run: |
@@ -115,13 +118,13 @@ jobs:
115118
runs-on: ubuntu-latest
116119
steps:
117120
- name: Set up Go 1.x
118-
uses: actions/setup-go@v2
121+
uses: actions/setup-go@v3
119122
with:
120123
go-version: ${{ env.GO_VERSION }}
121124
id: go
122125

123126
- name: Check out code into the Go module directory
124-
uses: actions/checkout@v2
127+
uses: actions/checkout@v3
125128

126129
- name: Setup environment
127130
run: |
@@ -137,7 +140,7 @@ jobs:
137140
runs-on: ubuntu-latest
138141
steps:
139142
- name: Check out code into the Go module directory
140-
uses: actions/checkout@v2
143+
uses: actions/checkout@v3
141144

142145
- name: Setup promtool
143146
run: |
@@ -152,13 +155,13 @@ jobs:
152155
runs-on: ubuntu-latest
153156
steps:
154157
- name: Set up Go 1.x
155-
uses: actions/setup-go@v2
158+
uses: actions/setup-go@v3
156159
with:
157160
go-version: ${{ env.GO_VERSION }}
158161
id: go
159162

160163
- name: Check out code into the Go module directory
161-
uses: actions/checkout@v2
164+
uses: actions/checkout@v3
162165

163166
- name: Setup environment
164167
run: |
@@ -174,13 +177,13 @@ jobs:
174177
runs-on: ubuntu-latest
175178
steps:
176179
- name: Set up Go 1.x
177-
uses: actions/setup-go@v2
180+
uses: actions/setup-go@v3
178181
with:
179182
go-version: ${{ env.GO_VERSION }}
180183
id: go
181184

182185
- name: Check out code into the Go module directory
183-
uses: actions/checkout@v2
186+
uses: actions/checkout@v3
184187

185188
- name: Setup environment
186189
run: |
@@ -196,13 +199,13 @@ jobs:
196199
runs-on: ubuntu-latest
197200
steps:
198201
- name: Set up Go 1.x
199-
uses: actions/setup-go@v2
202+
uses: actions/setup-go@v3
200203
with:
201204
go-version: ${{ env.GO_VERSION }}
202205
id: go
203206

204207
- name: Check out code into the Go module directory
205-
uses: actions/checkout@v2
208+
uses: actions/checkout@v3
206209

207210
- name: Setup environment
208211
run: |

.github/workflows/cron.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: cron
2+
3+
on:
4+
schedule:
5+
# Run every Monday
6+
- cron: '0 0 * * 1'
7+
8+
env:
9+
GO_VERSION: "^1.19"
10+
11+
jobs:
12+
ci-security-checks:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
name: Checkout code
17+
- name: Set up Go 1.x
18+
uses: actions/setup-go@v3
19+
with:
20+
go-version: ${{ env.GO_VERSION }}
21+
- name: Install govulncheck binary
22+
run: |
23+
go install golang.org/x/vuln/cmd/govulncheck@latest
24+
- name: Run security checks
25+
run: |
26+
govulncheck -v ./...

.golangci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ linters:
88
- gocyclo
99
- gofmt
1010
- goimports
11+
- gosec
1112
- gosimple
1213
- govet
1314
- ineffassign
@@ -28,3 +29,7 @@ issues:
2829
- path: _test\.go
2930
linters:
3031
- promlinter
32+
# TODO(mrueg) Improve error handling
33+
- text: "G104:"
34+
linters:
35+
- gosec

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
## v2.7.0 / 2022-11-25
2+
3+
Note: Experimental VerticalPodAutoscaler metrics are considered deprecated in this release and will be removed in v2.9.0.
4+
Please use CustomResourceStateMetrics to gather metrics from VPA resources. See: #1718
5+
6+
Note: Experimental CustomResourceState changed their naming convention for better usability.
7+
The name of the CRD used to be interpolated into the name of the metric which made it impossible to aggregate a CRD across different versions.
8+
This was changed to have the GVK information represented as labels:
9+
kube_myteam_io_v1_Foo_uptime -> kube_crd_uptime{group="myteam.io", kind="Foo", version="v1"}
10+
See: #1847
11+
12+
* [CHANGE] Deprecate VerticalPodAutoscaler metrics #1835 @rexagod
13+
* [CHANGE] Recommend kube-scheduler metrics for container resource limits and requests #1849 @rexagod
14+
* [FEATURE] Add experimental kube_pod_container_status_last_terminated_exitcode metric #1752 @ssabo
15+
* [FEATURE] Introduce custom-resources-only flag #1813 @bavarianbidi
16+
* [FEATURE] Allow allowlist filtering by wildcard key #1823 @rexagod
17+
* [FEATURE] Add ContainerResourceSourceType to hpa spec and target metrics #1831 @whitebear009
18+
* [FEATURE] Represent group, version and kind of a resource as labels #1850 @rexagod
19+
* [FEATURE] Sharding metrics per node via fieldSelector #1864 @CatherineF-dev
20+
* [FEATURE] Add experimental StatefulSet retention policy metrics #1876 @mattcary
21+
* [FEATURE] Allow labelFromKey field for all applicable metric types #1880 @rexagod
22+
* [FEATURE] Introduce Viper, allow hot-reload on config change #1827 @rexagod
23+
* [FEATURE] Introduce Cobra, allow configuration via environment variables #1834 @rexagod
24+
* [FEATURE] Add experimental kube_node_deletion_timestamp metric #1890 @rexagod
25+
* [FEATURE] Support autoscaling/v2 resources for HorizontalPodAutoscaler #1906 @JoaoBraveCoding
26+
* [FEATURE] Add IngressClass metrics #1905 @kaitoii11
27+
* [ENHANCEMENT] Import Kubernetes metrics stability framework #1844 @CatherineF-dev
28+
* [ENHANCEMENT] Promote kube_pod_container_status_waiting_reason and kube_deployment_status_replicas_ready to stable #1821 @CatherineF-dev
29+
* [ENHANCEMENT] Build with Kubernetes 1.25 and go 1.19 #1819 @mrueg
30+
* [BUGFIX] Handle singular labels in allowlist #1826 @rexagod
31+
* [BUGFIX] Do not expose ingress path metric when service is nil #1841 @evir35
32+
* [BUGFIX] Allow lease metrics to be exported across all namespaces #1845 @lantingchiang
33+
134
## v2.6.0 / 2022-08-26
235
* [FEATURE] Add local storage labels to kube_persistentvolume_info #1814 @nabokihms
336
* [FEATURE] Add support for StateSet and Info metrics for Custom-Resource State #1777 @chrischdi

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG GOVERSION=1.18
1+
ARG GOVERSION=1.19
22
ARG GOARCH
33
FROM golang:${GOVERSION} as builder
44
ARG GOARCH

Makefile

Lines changed: 2 additions & 2 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.37.0
19-
GO_VERSION = 1.18.5
18+
PROMETHEUS_VERSION = 2.39.1
19+
GO_VERSION = 1.19.3
2020
IMAGE = $(REGISTRY)/kube-state-metrics
2121
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
2222
USER ?= $(shell id -u -n)

README.md

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ are deleted they are no longer visible on the `/metrics` endpoint.
4545
- [Resource recommendation](#resource-recommendation)
4646
- [Horizontal sharding](#horizontal-sharding)
4747
- [Automated sharding](#automated-sharding)
48+
- [Daemonset sharding for pod metrics](#daemonset-sharding-pod-metrics)
4849
- [Setup](#setup)
4950
- [Building the Docker container](#building-the-docker-container)
5051
- [Usage](#usage)
@@ -67,19 +68,17 @@ All additional compatibility is only best effort, or happens to still/already be
6768
#### Compatibility matrix
6869

6970
At most, 5 kube-state-metrics and 5 [kubernetes releases](https://github.com/kubernetes/kubernetes/releases) will be recorded below.
71+
Generally, it is recommended to use the latest release of kube-state-metrics. If you run a very recent version of Kubernetes, you might want to use an unreleased version to have the full range of supported resources. If you run an older version of Kubernetes, you might need to run an older version in order to have full support for all resources. Be aware, that the maintainers will only support the latest release. Older versions might be supported by interested users of the community.
7072

71-
| kube-state-metrics | **Kubernetes 1.20** | **Kubernetes 1.21** | **Kubernetes 1.22** | **Kubernetes 1.23** | **Kubernetes 1.24** |
72-
|--------------------|:--------------------:|:---------------------:|:-------------------:|:-------------------:|:-------------------:|
73-
| **v2.3.0** ||||| - |
74-
| **v2.4.2** | -/✓ | -/✓ ||| - |
75-
| **v2.5.0** | -/✓ | -/✓ ||||
76-
| **v2.6.0** | -/✓ | -/✓ ||||
77-
| **master** | -/✓ | -/✓ ||||
73+
| kube-state-metrics | Kubernetes client-go Version |
74+
|--------------------|:----------------------------:|
75+
| **v2.3.0** | v1.23 |
76+
| **v2.4.2** | v1.23 |
77+
| **v2.5.0** | v1.24 |
78+
| **v2.6.0** | v1.24 |
79+
| **v2.7.0** | v1.25 |
80+
| **master** | v1.25 |
7881

79-
- `` Fully supported version range.
80-
- `-` The Kubernetes cluster has features the client-go library can't use (additional API objects, deprecated APIs, etc).
81-
82-
**Note:** The current kube-state-metrics `v2.0.0 +` releases work on Kubernetes v1.17 & v1.18 excluding Ingress or CertificateSigningRequest resource metrics. If you require those metrics on an older Kubernetes version, use kube-state-metrics `v1.9.8`.
8382

8483
#### Resource group version compatibility
8584

@@ -90,7 +89,7 @@ release.
9089
#### Container Image
9190

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

9594
### Metrics Documentation
9695

@@ -238,6 +237,36 @@ This way of deploying shards is useful when you want to manage KSM shards throug
238237

239238
The downside of using an auto-sharded setup comes from the rollout strategy supported by `StatefulSet`s. When managed by a `StatefulSet`, pods are replaced one at a time with each pod first getting terminated and then recreated. Besides such rollouts being slower, they will also lead to short downtime for each shard. If a Prometheus scrape happens during a rollout, it can miss some of the metrics exported by kube-state-metrics.
240239

240+
### Daemonset sharding for pod metrics
241+
242+
For pod metrics, they can be sharded per node with the following flag:
243+
* `--node`
244+
245+
Each kube-state-metrics pod uses FieldSelector (spec.nodeName) to watch/list pod metrics only on the same node.
246+
247+
A daemonset kube-state-metrics example:
248+
```
249+
apiVersion: apps/v1
250+
kind: DaemonSet
251+
spec:
252+
template:
253+
spec:
254+
containers:
255+
- image: registry.k8s.io/kube-state-metrics/kube-state-metrics:IMAGE_TAG
256+
name: kube-state-metrics
257+
args:
258+
- --resource=pods
259+
- --node=$(NODE_NAME)
260+
env:
261+
- name: NODE_NAME
262+
valueFrom:
263+
fieldRef:
264+
apiVersion: v1
265+
fieldPath: spec.nodeName
266+
```
267+
268+
Other metrics can be sharded via [Horizontal sharding](#horizontal-sharding).
269+
241270
### Setup
242271

243272
Install this project to your `$GOPATH` using `go get`:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.0
1+
2.7.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+
- [IngressClass Metrics](ingressclass-metrics.md)
6869
- [Role Metrics](role-metrics.md)
6970
- [RoleBinding Metrics](rolebinding-metrics.md)
7071
- [ServiceAccount Metrics](serviceaccount-metrics.md)

docs/cli-arguments.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,25 @@ spec:
2424
[embedmd]:# (../help.txt)
2525
```txt
2626
$ kube-state-metrics -h
27-
Usage of ./kube-state-metrics:
27+
kube-state-metrics is a simple service that listens to the Kubernetes API server and generates metrics about the state of the objects.
28+
29+
Usage:
30+
kube-state-metrics [flags]
31+
kube-state-metrics [command]
32+
33+
Available Commands:
34+
completion Generate completion script for kube-state-metrics.
35+
help Help about any command
36+
version Print version information.
37+
38+
Flags:
2839
--add_dir_header If true, adds the file directory to the header of the log messages
2940
--alsologtostderr log to standard error as well as files (no effect when -logtostderr=true)
3041
--apiserver string The URL of the apiserver to use as a master
42+
--config string Path to the kube-state-metrics options config file
3143
--custom-resource-state-config string Inline Custom Resource State Metrics config YAML (experimental)
3244
--custom-resource-state-config-file string Path to a Custom Resource State Metrics config file (experimental)
45+
--custom-resource-state-only Only provide Custom Resource State metrics (experimental)
3346
--enable-gzip-encoding Gzip responses when requested by clients via 'Accept-Encoding: gzip' header.
3447
-h, --help Print Help text
3548
--host string Host to expose metrics on. (default "::")
@@ -42,10 +55,11 @@ Usage of ./kube-state-metrics:
4255
--metric-allowlist string Comma-separated list of metrics to be exposed. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.
4356
--metric-annotations-allowlist string Comma-separated list of Kubernetes annotations keys that will be used in the resource' labels metric. By default the metric contains only name and namespace labels. To include additional annotations provide a list of resource names in their plural form and Kubernetes annotation keys you would like to allow for them (Example: '=namespaces=[kubernetes.io/team,...],pods=[kubernetes.io/team],...)'. A single '*' can be provided per resource instead to allow any annotations, but that has severe performance implications (Example: '=pods=[*]').
4457
--metric-denylist string Comma-separated list of metrics not to be enabled. This list comprises of exact metric names and/or regex patterns. The allowlist and denylist are mutually exclusive.
45-
--metric-labels-allowlist string Comma-separated list of additional Kubernetes label keys that will be used in the resource' labels metric. By default the metric contains only name and namespace labels. To include additional labels provide a list of resource names in their plural form and Kubernetes label keys you would like to allow for them (Example: '=namespaces=[k8s-label-1,k8s-label-n,...],pods=[app],...)'. A single '*' can be provided per resource instead to allow any labels, but that has severe performance implications (Example: '=pods=[*]').
58+
--metric-labels-allowlist string Comma-separated list of additional Kubernetes label keys that will be used in the resource' labels metric. By default the metric contains only name and namespace labels. To include additional labels provide a list of resource names in their plural form and Kubernetes label keys you would like to allow for them (Example: '=namespaces=[k8s-label-1,k8s-label-n,...],pods=[app],...)'. A single '*' can be provided per resource instead to allow any labels, but that has severe performance implications (Example: '=pods=[*]'). Additionally, an asterisk (*) can be provided as a key, which will resolve to all resources, i.e., assuming '--resources=deployments,pods', '=*=[*]' will resolve to '=deployments=[*],pods=[*]'.
4659
--metric-opt-in-list string Comma-separated list of metrics which are opt-in and not enabled by default. This is in addition to the metric allow- and denylists
4760
--namespaces string Comma-separated list of namespaces to be enabled. Defaults to ""
4861
--namespaces-denylist string Comma-separated list of namespaces not to be enabled. If namespaces and namespaces-denylist are both set, only namespaces that are excluded in namespaces-denylist will be used.
62+
--node string Name of the node that contains the kube-state-metrics pod. Most likely it should be passed via the downward API. This is used for daemonset sharding. Only available for resources (pod metrics) that support spec.nodeName fieldSelector. This is experimental.
4963
--one_output If true, only write logs to their native severity level (vs also writing to each lower severity level; no effect when -logtostderr=true)
5064
--pod string Name of the pod that contains the kube-state-metrics container. When set, it is expected that --pod and --pod-namespace are both set. Most likely this should be passed via the downward API. This is used for auto-detecting sharding. If set, this has preference over statically configured sharding. This is experimental, it may be removed without notice.
5165
--pod-namespace string Name of the namespace of the pod specified by --pod. When set, it is expected that --pod and --pod-namespace are both set. Most likely this should be passed via the downward API. This is used for auto-detecting sharding. If set, this has preference over statically configured sharding. This is experimental, it may be removed without notice.
@@ -63,4 +77,6 @@ Usage of ./kube-state-metrics:
6377
-v, --v Level number for the log level verbosity
6478
--version kube-state-metrics build version information
6579
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
80+
81+
Use "kube-state-metrics [command] --help" for more information about a command.
6682
```

0 commit comments

Comments
 (0)