From 77fa29c10ef3744d609f77596dad6a2d56d82f32 Mon Sep 17 00:00:00 2001 From: Damien Grisonnet Date: Wed, 14 Dec 2022 23:40:21 +0100 Subject: [PATCH] pkg/registry: rename pod logs metrics The pod_logs subsystem was inadvertently made redundant in the following kube-apiserver metrics: - kube_apiserver_pod_logs_pods_logs_backend_tls_failure_total - kube_apiserver_pod_logs_pods_logs_insecure_backend_total To safely rename them, it is required to deprecate them in 1.27 whilst introducing the new metrics replacing them. Signed-off-by: Damien Grisonnet Kubernetes-commit: 1efa1a65ee26c68de3f972f4e079338889a3e5e9 --- pkg/registry/generic/rest/streamer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/registry/generic/rest/streamer.go b/pkg/registry/generic/rest/streamer.go index cb9e4898c..b1a61991b 100644 --- a/pkg/registry/generic/rest/streamer.go +++ b/pkg/registry/generic/rest/streamer.go @@ -46,6 +46,10 @@ type LocationStreamer struct { // TLSVerificationErrorCounter is an optional value that will Inc every time a TLS error is encountered. This can // be wired a single prometheus counter instance to get counts overall. TLSVerificationErrorCounter CounterMetric + // DeprecatedTLSVerificationErrorCounter is a temporary field used to rename + // the kube_apiserver_pod_logs_pods_logs_backend_tls_failure_total metric + // with a one release deprecation period in 1.27.0. + DeprecatedTLSVerificationErrorCounter CounterMetric } // a LocationStreamer must implement a rest.ResourceStreamer @@ -87,6 +91,9 @@ func (s *LocationStreamer) InputStream(ctx context.Context, apiVersion, acceptHe // TODO prefer segregate TLS errors more reliably, but we do want to increment a count if strings.Contains(err.Error(), "x509:") && s.TLSVerificationErrorCounter != nil { s.TLSVerificationErrorCounter.Inc() + if s.DeprecatedTLSVerificationErrorCounter != nil { + s.DeprecatedTLSVerificationErrorCounter.Inc() + } } return nil, false, "", err }