mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 18:28:13 +00:00 
			
		
		
		
	Merge pull request #120574 from logicalhan/cslis
promote component SLIs to GA; remove feature gates for component slis
This commit is contained in:
		| @@ -215,9 +215,8 @@ func Run(ctx context.Context, c *config.CompletedConfig) error { | |||||||
| 	var unsecuredMux *mux.PathRecorderMux | 	var unsecuredMux *mux.PathRecorderMux | ||||||
| 	if c.SecureServing != nil { | 	if c.SecureServing != nil { | ||||||
| 		unsecuredMux = genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Generic.Debugging, healthzHandler) | 		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) | 		handler := genericcontrollermanager.BuildHandlerChain(unsecuredMux, &c.Authorization, &c.Authentication) | ||||||
| 		// TODO: handle stoppedCh and listenerStoppedCh returned by c.SecureServing.Serve | 		// TODO: handle stoppedCh and listenerStoppedCh returned by c.SecureServing.Serve | ||||||
| 		if _, _, err := c.SecureServing.Serve(handler, 0, stopCh); err != nil { | 		if _, _, err := c.SecureServing.Serve(handler, 0, stopCh); err != nil { | ||||||
|   | |||||||
| @@ -806,9 +806,8 @@ func serveMetrics(bindAddress string, proxyMode kubeproxyconfig.ProxyMode, enabl | |||||||
|  |  | ||||||
| 	proxyMux := mux.NewPathRecorderMux("kube-proxy") | 	proxyMux := mux.NewPathRecorderMux("kube-proxy") | ||||||
| 	healthz.InstallHandler(proxyMux) | 	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) { | 	proxyMux.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) { | ||||||
| 		w.Header().Set("Content-Type", "text/plain; charset=utf-8") | 		w.Header().Set("Content-Type", "text/plain; charset=utf-8") | ||||||
| 		w.Header().Set("X-Content-Type-Options", "nosniff") | 		w.Header().Set("X-Content-Type-Options", "nosniff") | ||||||
|   | |||||||
| @@ -294,9 +294,8 @@ func newHealthzAndMetricsHandler(config *kubeschedulerconfig.KubeSchedulerConfig | |||||||
| 	pathRecorderMux := mux.NewPathRecorderMux("kube-scheduler") | 	pathRecorderMux := mux.NewPathRecorderMux("kube-scheduler") | ||||||
| 	healthz.InstallHandler(pathRecorderMux, checks...) | 	healthz.InstallHandler(pathRecorderMux, checks...) | ||||||
| 	installMetricHandler(pathRecorderMux, informers, isLeader) | 	installMetricHandler(pathRecorderMux, informers, isLeader) | ||||||
| 	if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) { | 	slis.SLIMetricsWithReset{}.Install(pathRecorderMux) | ||||||
| 		slis.SLIMetricsWithReset{}.Install(pathRecorderMux) |  | ||||||
| 	} |  | ||||||
| 	if config.EnableProfiling { | 	if config.EnableProfiling { | ||||||
| 		routes.Profiling{}.Install(pathRecorderMux) | 		routes.Profiling{}.Install(pathRecorderMux) | ||||||
| 		if config.EnableContentionProfiling { | 		if config.EnableContentionProfiling { | ||||||
|   | |||||||
| @@ -377,9 +377,8 @@ func (s *Server) InstallDefaultHandlers() { | |||||||
| 		healthz.NamedCheck("syncloop", s.syncLoopHealthCheck), | 		healthz.NamedCheck("syncloop", s.syncLoopHealthCheck), | ||||||
| 	) | 	) | ||||||
|  |  | ||||||
| 	if utilfeature.DefaultFeatureGate.Enabled(metricsfeatures.ComponentSLIs) { | 	slis.SLIMetricsWithReset{}.Install(s.restfulCont) | ||||||
| 		slis.SLIMetricsWithReset{}.Install(s.restfulCont) |  | ||||||
| 	} |  | ||||||
| 	s.addMetricsBucketMatcher("pods") | 	s.addMetricsBucketMatcher("pods") | ||||||
| 	ws := new(restful.WebService) | 	ws := new(restful.WebService) | ||||||
| 	ws. | 	ws. | ||||||
|   | |||||||
| @@ -994,14 +994,10 @@ func installAPI(s *GenericAPIServer, c *Config) { | |||||||
| 	if c.EnableMetrics { | 	if c.EnableMetrics { | ||||||
| 		if c.EnableProfiling { | 		if c.EnableProfiling { | ||||||
| 			routes.MetricsWithReset{}.Install(s.Handler.NonGoRestfulMux) | 			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 { | 		} else { | ||||||
| 			routes.DefaultMetrics{}.Install(s.Handler.NonGoRestfulMux) | 			routes.DefaultMetrics{}.Install(s.Handler.NonGoRestfulMux) | ||||||
| 			if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) { | 			slis.SLIMetrics{}.Install(s.Handler.NonGoRestfulMux) | ||||||
| 				slis.SLIMetrics{}.Install(s.Handler.NonGoRestfulMux) |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -202,9 +202,9 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface | |||||||
| 	// Start the controller manager HTTP server | 	// Start the controller manager HTTP server | ||||||
| 	if c.SecureServing != nil { | 	if c.SecureServing != nil { | ||||||
| 		unsecuredMux := genericcontrollermanager.NewBaseHandler(&c.ComponentConfig.Generic.Debugging, healthzHandler) | 		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) | 		handler := genericcontrollermanager.BuildHandlerChain(unsecuredMux, &c.Authorization, &c.Authentication) | ||||||
| 		// TODO: handle stoppedCh and listenerStoppedCh returned by c.SecureServing.Serve | 		// TODO: handle stoppedCh and listenerStoppedCh returned by c.SecureServing.Serve | ||||||
| 		if _, _, err := c.SecureServing.Serve(handler, 0, stopCh); err != nil { | 		if _, _, err := c.SecureServing.Serve(handler, 0, stopCh); err != nil { | ||||||
|   | |||||||
| @@ -37,7 +37,7 @@ var ( | |||||||
| 			Namespace:      "kubernetes", | 			Namespace:      "kubernetes", | ||||||
| 			Name:           "healthcheck", | 			Name:           "healthcheck", | ||||||
| 			Help:           "This metric records the result of a single healthcheck.", | 			Help:           "This metric records the result of a single healthcheck.", | ||||||
| 			StabilityLevel: k8smetrics.BETA, | 			StabilityLevel: k8smetrics.STABLE, | ||||||
| 		}, | 		}, | ||||||
| 		[]string{"name", "type"}, | 		[]string{"name", "type"}, | ||||||
| 	) | 	) | ||||||
| @@ -48,7 +48,7 @@ var ( | |||||||
| 			Namespace:      "kubernetes", | 			Namespace:      "kubernetes", | ||||||
| 			Name:           "healthchecks_total", | 			Name:           "healthchecks_total", | ||||||
| 			Help:           "This metric records the results of all healthcheck.", | 			Help:           "This metric records the results of all healthcheck.", | ||||||
| 			StabilityLevel: k8smetrics.BETA, | 			StabilityLevel: k8smetrics.STABLE, | ||||||
| 		}, | 		}, | ||||||
| 		[]string{"name", "type", "status"}, | 		[]string{"name", "type", "status"}, | ||||||
| 	) | 	) | ||||||
|   | |||||||
| @@ -37,10 +37,10 @@ func TestObserveHealthcheck(t *testing.T) { | |||||||
| 	initialState := Error | 	initialState := Error | ||||||
| 	healthcheckName := "healthcheck-a" | 	healthcheckName := "healthcheck-a" | ||||||
| 	initialOutput := ` | 	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 |         # TYPE kubernetes_healthcheck gauge | ||||||
|         kubernetes_healthcheck{name="healthcheck-a",type="healthz"} 0 |         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 |         # TYPE kubernetes_healthchecks_total counter | ||||||
|         kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1 |         kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1 | ||||||
| ` | ` | ||||||
| @@ -57,10 +57,10 @@ func TestObserveHealthcheck(t *testing.T) { | |||||||
| 			hcType:   "healthz", | 			hcType:   "healthz", | ||||||
| 			hcStatus: Success, | 			hcStatus: Success, | ||||||
| 			want: ` | 			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 |         # TYPE kubernetes_healthcheck gauge | ||||||
|         kubernetes_healthcheck{name="healthcheck-a",type="healthz"} 1 |         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 |         # TYPE kubernetes_healthchecks_total counter | ||||||
|         kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1 |         kubernetes_healthchecks_total{name="healthcheck-a",status="error",type="healthz"} 1 | ||||||
|         kubernetes_healthchecks_total{name="healthcheck-a",status="success",type="healthz"} 1 |         kubernetes_healthchecks_total{name="healthcheck-a",status="success",type="healthz"} 1 | ||||||
|   | |||||||
| @@ -96,23 +96,6 @@ | |||||||
|   labels: |   labels: | ||||||
|   - name |   - name | ||||||
|   - stage |   - 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 | - name: registered_metrics_total | ||||||
|   help: The count of registered metrics broken by stability level and deprecation |   help: The count of registered metrics broken by stability level and deprecation | ||||||
|     version. |     version. | ||||||
| @@ -446,6 +429,23 @@ | |||||||
|   - priority |   - priority | ||||||
|   - resource |   - resource | ||||||
|   - unit |   - 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 | - name: evictions_total | ||||||
|   subsystem: node_collector |   subsystem: node_collector | ||||||
|   help: Number of Node evictions that happened since current instance of NodeController |   help: Number of Node evictions that happened since current instance of NodeController | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot