Skip to content

Commit f2a22c5

Browse files
authored
Merge pull request kubernetes-csi#1275 from AndrewSirenko/leader-metrics
Add leader election, work-queue, process, and Go runtime metrics
2 parents ba554e3 + fe8de84 commit f2a22c5

File tree

10 files changed

+249
-18
lines changed

10 files changed

+249
-18
lines changed

Diff for: CHANGELOG/CHANGELOG-3.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
webhook server has been added. This server will perform additional validation (strict) which was not done during the beta release of volume snapshots. It will prevent the cluster from gaining (via create or update) invalid objects.
2121
2. The controller will label objects which fail the additional validation. The label "snapshot.storage.kubernetes.io/invalid-snapshot-content-resource" will be added to invalid VolumeSnapshotContent objects. The label "snapshot.storage.kubernetes.io/invalid-snapshot-resource" will be added to invalid VolumeSnapshot objects.
2222

23-
The combination of 1 and 2 will allow cluster admins to stop the increase of invalid objects, and provide a way to easily list all objects which currently fail the strict validation. It is the kubernets distribution and cluster admin's responsibility to install the webhook and to ensure all the invalid objects in the cluster have been deleted or fixed. See the KEP at https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/177-volume-snapshot/tighten-validation-webhook-crd.md ([#353](https://github.com/kubernetes-csi/external-snapshotter/pull/353), [@AndiLi99](https://github.com/AndiLi99))
23+
The combination of 1 and 2 will allow cluster admins to stop the increase of invalid objects, and provide a way to easily list all objects which currently fail the strict validation. It is the kubernetes distribution and cluster admin's responsibility to install the webhook and to ensure all the invalid objects in the cluster have been deleted or fixed. See the KEP at https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/177-volume-snapshot/tighten-validation-webhook-crd.md ([#353](https://github.com/kubernetes-csi/external-snapshotter/pull/353), [@AndiLi99](https://github.com/AndiLi99))
2424

2525
### Snapshot Controller
2626

Diff for: cmd/csi-snapshotter/main.go

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ import (
4949
controller "github.com/kubernetes-csi/external-snapshotter/v8/pkg/sidecar-controller"
5050
"github.com/kubernetes-csi/external-snapshotter/v8/pkg/snapshotter"
5151
utilflag "k8s.io/component-base/cli/flag"
52+
"k8s.io/component-base/metrics/legacyregistry"
53+
_ "k8s.io/component-base/metrics/prometheus/clientgo/leaderelection" // register leader election in the default legacy registry
54+
_ "k8s.io/component-base/metrics/prometheus/workqueue" // register work queues in the default legacy registry
5255

5356
clientset "github.com/kubernetes-csi/external-snapshotter/client/v8/clientset/versioned"
5457
snapshotscheme "github.com/kubernetes-csi/external-snapshotter/client/v8/clientset/versioned/scheme"
@@ -201,6 +204,10 @@ func main() {
201204

202205
klog.V(2).Infof("CSI driver name: %q", driverName)
203206

207+
// Add default legacy registry so that metrics manager serves Go runtime and process metrics.
208+
// Also registers the `k8s.io/component-base/` work queue and leader election metrics we anonymously import.
209+
metricsManager.WithAdditionalRegistry(legacyregistry.DefaultGatherer)
210+
204211
// Prepare http endpoint for metrics + leader election healthz
205212
mux := http.NewServeMux()
206213
if addr != "" {

Diff for: go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module github.com/kubernetes-csi/external-snapshotter/v8
22

3-
go 1.23.1
3+
go 1.23.6
44

55
require (
66
github.com/container-storage-interface/spec v1.11.0
77
github.com/evanphx/json-patch v5.9.0+incompatible
88
github.com/golang/mock v1.6.0
9-
github.com/kubernetes-csi/csi-lib-utils v0.20.0
9+
github.com/kubernetes-csi/csi-lib-utils v0.21.0
1010
github.com/kubernetes-csi/csi-test/v5 v5.3.1
1111
github.com/kubernetes-csi/external-snapshotter/client/v8 v8.2.0
1212
github.com/prometheus/client_golang v1.20.5
@@ -60,7 +60,7 @@ require (
6060
go.opentelemetry.io/otel v1.33.0 // indirect
6161
go.opentelemetry.io/otel/metric v1.33.0 // indirect
6262
go.opentelemetry.io/otel/trace v1.33.0 // indirect
63-
golang.org/x/net v0.32.0 // indirect
63+
golang.org/x/net v0.33.0 // indirect
6464
golang.org/x/oauth2 v0.24.0 // indirect
6565
golang.org/x/sys v0.28.0 // indirect
6666
golang.org/x/term v0.27.0 // indirect

Diff for: go.sum

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
6363
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
6464
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
6565
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
66-
github.com/kubernetes-csi/csi-lib-utils v0.20.0 h1:JTvHRJugn+cByMnIU4nCnqPqOOUhuPzhlLqRvenwjDA=
67-
github.com/kubernetes-csi/csi-lib-utils v0.20.0/go.mod h1:3b/HFVURW11oxV/gUAKyhhkvFpxXO/zRdvh1wdEfCZY=
66+
github.com/kubernetes-csi/csi-lib-utils v0.21.0 h1:dUN/iIgXLucAxyML2iPyhniIlACQumIeAJmIzsMBddc=
67+
github.com/kubernetes-csi/csi-lib-utils v0.21.0/go.mod h1:ZCVRTYuup+bwX9tOeE5Q3LDw64QvltSwMUQ3M3g2T+Q=
6868
github.com/kubernetes-csi/csi-test/v5 v5.3.1 h1:Wiukp1In+kif+BFo6q2ExjgB+MbrAz4jZWzGfijypuY=
6969
github.com/kubernetes-csi/csi-test/v5 v5.3.1/go.mod h1:7hA2cSYJ6T8CraEZPA6zqkLZwemjBD54XAnPsPC3VpA=
7070
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
@@ -138,8 +138,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
138138
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
139139
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
140140
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
141-
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
142-
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
141+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
142+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
143143
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
144144
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
145145
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

Diff for: release-tools/prow.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ configvar CSI_PROW_BUILD_PLATFORMS "linux amd64 amd64; linux ppc64le ppc64le -pp
8686
# which is disabled with GOFLAGS=-mod=vendor).
8787
configvar GOFLAGS_VENDOR "$( [ -d vendor ] && echo '-mod=vendor' )" "Go flags for using the vendor directory"
8888

89-
configvar CSI_PROW_GO_VERSION_BUILD "1.23.1" "Go version for building the component" # depends on component's source code
89+
configvar CSI_PROW_GO_VERSION_BUILD "1.23.6" "Go version for building the component" # depends on component's source code
9090
configvar CSI_PROW_GO_VERSION_E2E "" "override Go version for building the Kubernetes E2E test suite" # normally doesn't need to be set, see install_e2e
9191
configvar CSI_PROW_GO_VERSION_SANITY "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building the csi-sanity test suite" # depends on CSI_PROW_SANITY settings below
9292
configvar CSI_PROW_GO_VERSION_KIND "${CSI_PROW_GO_VERSION_BUILD}" "Go version for building 'kind'" # depends on CSI_PROW_KIND_VERSION below

Diff for: vendor/github.com/kubernetes-csi/csi-lib-utils/metrics/metrics.go

+19-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: vendor/github.com/kubernetes-csi/csi-lib-utils/protosanitizer/protosanitizer.go

+5-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: vendor/k8s.io/component-base/metrics/prometheus/clientgo/leaderelection/metrics.go

+68
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: vendor/k8s.io/component-base/metrics/prometheus/workqueue/metrics.go

+137
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)