Merge pull request #120574 from logicalhan/cslis

promote component SLIs to GA; remove feature gates for component slis
This commit is contained in:
Kubernetes Prow Robot 2023-09-14 22:52:12 -07:00 committed by GitHub
commit d393d4e151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 44 deletions

View File

@ -215,9 +215,8 @@ func Run(ctx context.Context, c *config.CompletedConfig) error {
var unsecuredMux *mux.PathRecorderMux
if c.SecureServing != nil {
unsecuredMux = genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Generic.Debugging, healthzHandler)
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
slis.SLIMetricsWithReset{}.Install(unsecuredMux)
}
slis.SLIMetricsWithReset{}.Install(unsecuredMux)
handler := genericcontrollermanager.BuildHandlerChain(unsecuredMux, &c.Authorization, &c.Authentication)
// TODO: handle stoppedCh and listenerStoppedCh returned by c.SecureServing.Serve
if _, _, err := c.SecureServing.Serve(handler, 0, stopCh); err != nil {

View File

@ -806,9 +806,8 @@ func serveMetrics(bindAddress string, proxyMode kubeproxyconfig.ProxyMode, enabl
proxyMux := mux.NewPathRecorderMux("kube-proxy")
healthz.InstallHandler(proxyMux)
if utilfeature.DefaultFeatureGate.Enabled(metricsfeatures.ComponentSLIs) {
slis.SLIMetricsWithReset{}.Install(proxyMux)
}
slis.SLIMetricsWithReset{}.Install(proxyMux)
proxyMux.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
w.Header().Set("X-Content-Type-Options", "nosniff")

View File

@ -294,9 +294,8 @@ func newHealthzAndMetricsHandler(config *kubeschedulerconfig.KubeSchedulerConfig
pathRecorderMux := mux.NewPathRecorderMux("kube-scheduler")
healthz.InstallHandler(pathRecorderMux, checks...)
installMetricHandler(pathRecorderMux, informers, isLeader)
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
slis.SLIMetricsWithReset{}.Install(pathRecorderMux)
}
slis.SLIMetricsWithReset{}.Install(pathRecorderMux)
if config.EnableProfiling {
routes.Profiling{}.Install(pathRecorderMux)
if config.EnableContentionProfiling {

View File

@ -377,9 +377,8 @@ func (s *Server) InstallDefaultHandlers() {
healthz.NamedCheck("syncloop", s.syncLoopHealthCheck),
)
if utilfeature.DefaultFeatureGate.Enabled(metricsfeatures.ComponentSLIs) {
slis.SLIMetricsWithReset{}.Install(s.restfulCont)
}
slis.SLIMetricsWithReset{}.Install(s.restfulCont)
s.addMetricsBucketMatcher("pods")
ws := new(restful.WebService)
ws.

View File

@ -994,14 +994,10 @@ func installAPI(s *GenericAPIServer, c *Config) {
if c.EnableMetrics {
if c.EnableProfiling {
routes.MetricsWithReset{}.Install(s.Handler.NonGoRestfulMux)
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
slis.SLIMetricsWithReset{}.Install(s.Handler.NonGoRestfulMux)
}
slis.SLIMetricsWithReset{}.Install(s.Handler.NonGoRestfulMux)
} else {
routes.DefaultMetrics{}.Install(s.Handler.NonGoRestfulMux)
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
slis.SLIMetrics{}.Install(s.Handler.NonGoRestfulMux)
}
slis.SLIMetrics{}.Install(s.Handler.NonGoRestfulMux)
}
}

View File

@ -202,9 +202,9 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface
// Start the controller manager HTTP server
if c.SecureServing != nil {
unsecuredMux := genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Generic.Debugging, healthzHandler)
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
slis.SLIMetricsWithReset{}.Install(unsecuredMux)
}
slis.SLIMetricsWithReset{}.Install(unsecuredMux)
handler := genericcontrollermanager.BuildHandlerChain(unsecuredMux, &c.Authorization, &c.Authentication)
// TODO: handle stoppedCh and listenerStoppedCh returned by c.SecureServing.Serve
if _, _, err := c.SecureServing.Serve(handler, 0, stopCh); err != nil {

View File

@ -37,7 +37,7 @@ var (
Namespace: "kubernetes",
Name: "healthcheck",
Help: "This metric records the result of a single healthcheck.",
StabilityLevel: k8smetrics.BETA,
StabilityLevel: k8smetrics.STABLE,
},
[]string{"name", "type"},
)
@ -48,7 +48,7 @@ var (
Namespace: "kubernetes",
Name: "healthchecks_total",
Help: "This metric records the results of all healthcheck.",
StabilityLevel: k8smetrics.BETA,
StabilityLevel: k8smetrics.STABLE,
},
[]string{"name", "type", "status"},
)

View File

@ -37,10 +37,10 @@ func TestObserveHealthcheck(t *testing.T) {
initialState := Error
healthcheckName := "healthcheck-a"
initialOutput := `
# HELP kubernetes_healthcheck [BETA] This metric records the result of a single healthcheck.
# HELP kubernetes_healthcheck [STABLE] This metric records the result of a single healthcheck.
# TYPE kubernetes_healthcheck gauge
kubernetes_healthcheck{name="healthcheck-a",type="healthz"} 0
# HELP kubernetes_healthchecks_total [BETA] This metric records the results of all healthcheck.
# HELP kubernetes_healthchecks_total [STABLE] This metric records the results of all healthcheck.
# TYPE kubernetes_healthchecks_total counter
kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
`
@ -57,10 +57,10 @@ func TestObserveHealthcheck(t *testing.T) {
hcType: "healthz",
hcStatus: Success,
want: `
# HELP kubernetes_healthcheck [BETA] This metric records the result of a single healthcheck.
# HELP kubernetes_healthcheck [STABLE] This metric records the result of a single healthcheck.
# TYPE kubernetes_healthcheck gauge
kubernetes_healthcheck{name="healthcheck-a",type="healthz"} 1
# HELP kubernetes_healthchecks_total [BETA] This metric records the results of all healthcheck.
# HELP kubernetes_healthchecks_total [STABLE] This metric records the results of all healthcheck.
# TYPE kubernetes_healthchecks_total counter
kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1
kubernetes_healthchecks_total{name="healthcheck-a",status="success",type="healthz"} 1

View File

@ -96,23 +96,6 @@
labels:
- name
- stage
- name: healthcheck
namespace: kubernetes
help: This metric records the result of a single healthcheck.
type: Gauge
stabilityLevel: BETA
labels:
- name
- type
- name: healthchecks_total
namespace: kubernetes
help: This metric records the results of all healthcheck.
type: Counter
stabilityLevel: BETA
labels:
- name
- status
- type
- name: registered_metrics_total
help: The count of registered metrics broken by stability level and deprecation
version.
@ -446,6 +429,23 @@
- priority
- resource
- unit
- name: healthcheck
namespace: kubernetes
help: This metric records the result of a single healthcheck.
type: Gauge
stabilityLevel: STABLE
labels:
- name
- type
- name: healthchecks_total
namespace: kubernetes
help: This metric records the results of all healthcheck.
type: Counter
stabilityLevel: STABLE
labels:
- name
- status
- type
- name: evictions_total
subsystem: node_collector
help: Number of Node evictions that happened since current instance of NodeController