mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 02:11:09 +00:00
wire up feature-gate for component slis
Change-Id: Iba6ffbcac9dba4f4be3023ada6ac31691c1ae17b
This commit is contained in:
parent
44a0b4e145
commit
01bfbdff2d
@ -35,6 +35,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
utilwaitgroup "k8s.io/apimachinery/pkg/util/waitgroup"
|
||||
"k8s.io/apimachinery/pkg/version"
|
||||
@ -67,6 +68,7 @@ import (
|
||||
"k8s.io/client-go/informers"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/component-base/logs"
|
||||
"k8s.io/component-base/metrics/features"
|
||||
"k8s.io/component-base/metrics/prometheus/slis"
|
||||
"k8s.io/klog/v2"
|
||||
openapicommon "k8s.io/kube-openapi/pkg/common"
|
||||
@ -318,6 +320,10 @@ type AuthorizationInfo struct {
|
||||
Authorizer authorizer.Authorizer
|
||||
}
|
||||
|
||||
func init() {
|
||||
utilruntime.Must(features.AddFeatureGates(utilfeature.DefaultMutableFeatureGate))
|
||||
}
|
||||
|
||||
// NewConfig returns a Config struct with the default values
|
||||
func NewConfig(codecs serializer.CodecFactory) *Config {
|
||||
defaultHealthChecks := []healthz.HealthChecker{healthz.PingHealthz, healthz.LogHealthz}
|
||||
@ -882,13 +888,18 @@ func installAPI(s *GenericAPIServer, c *Config) {
|
||||
// so far, only logging related endpoints are considered valid to add for these debug flags.
|
||||
routes.DebugFlags{}.Install(s.Handler.NonGoRestfulMux, "v", routes.StringFlagPutHandler(logs.GlogSetter))
|
||||
}
|
||||
|
||||
if c.EnableMetrics {
|
||||
if c.EnableProfiling {
|
||||
routes.MetricsWithReset{}.Install(s.Handler.NonGoRestfulMux)
|
||||
slis.SLIMetricsWithReset{}.Install(s.Handler.NonGoRestfulMux)
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
|
||||
slis.SLIMetricsWithReset{}.Install(s.Handler.NonGoRestfulMux)
|
||||
}
|
||||
} else {
|
||||
routes.DefaultMetrics{}.Install(s.Handler.NonGoRestfulMux)
|
||||
slis.SLIMetrics{}.Install(s.Handler.NonGoRestfulMux)
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.ComponentSLIs) {
|
||||
slis.SLIMetrics{}.Install(s.Handler.NonGoRestfulMux)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,6 @@ func TestNewWithDelegate(t *testing.T) {
|
||||
"/livez/poststarthook/storage-object-count-tracker-hook",
|
||||
"/livez/poststarthook/wrapping-post-start-hook",
|
||||
"/metrics",
|
||||
"/metrics/slis",
|
||||
"/readyz",
|
||||
"/readyz/delegate-health",
|
||||
"/readyz/informer-sync",
|
||||
|
1
vendor/modules.txt
vendored
1
vendor/modules.txt
vendored
@ -1973,6 +1973,7 @@ k8s.io/component-base/logs/klogflags
|
||||
k8s.io/component-base/logs/logreduction
|
||||
k8s.io/component-base/logs/testinit
|
||||
k8s.io/component-base/metrics
|
||||
k8s.io/component-base/metrics/features
|
||||
k8s.io/component-base/metrics/legacyregistry
|
||||
k8s.io/component-base/metrics/prometheus/clientgo
|
||||
k8s.io/component-base/metrics/prometheus/clientgo/leaderelection
|
||||
|
Loading…
Reference in New Issue
Block a user