Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

koordlet: add extended HTTP handler registry #2006

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/koordlet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func installHTTPHandler() {
if features.DefaultKoordletFeatureGate.Enabled(features.AuditEventsHTTPHandler) {
mux.HandleFunc("/events", audit.HttpHandler())
}
// install extended HTTP handlers
options.InstallExtendedHTTPHandler(mux)
// http.HandleFunc("/healthz", d.HealthzHandler())
klog.Fatalf("Prometheus monitoring failed: %v", http.ListenAndServe(*options.ServerAddr, mux))
}
13 changes: 13 additions & 0 deletions cmd/koordlet/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ package options

import (
"flag"
"net/http"

"k8s.io/klog/v2"
)

var (
Expand All @@ -27,3 +30,13 @@ var (
KubeAPIQPS = flag.Float64("kube-api-qps", 20.0, "QPS to use while talking with kube-apiserver.")
KubeAPIBurst = flag.Int("kube-api-burst", 30, "Burst to use while talking with kube-apiserver.")
)

// ExtendedHTTPHandlerRegistry is the registry of extended HTTP handlers.
var ExtendedHTTPHandlerRegistry = map[string]func() http.HandlerFunc{}

func InstallExtendedHTTPHandler(mux *http.ServeMux) {
for path, newHandler := range ExtendedHTTPHandlerRegistry {
mux.HandleFunc(path, newHandler())
klog.V(4).Infof("extended HTTP handler is registered on path %s", path)
}
}
Loading