mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 03:03:59 +00:00
Move kubelet api paths to constants
This commit is contained in:
parent
426caf5bd1
commit
a602ae77b8
@ -62,6 +62,13 @@ import (
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
)
|
||||
|
||||
const (
|
||||
metricsPath = "/metrics"
|
||||
specPath = "/spec/"
|
||||
statsPath = "/stats/"
|
||||
logsPath = "/logs/"
|
||||
)
|
||||
|
||||
// Server is a http.Handler which exposes kubelet functionality over HTTP.
|
||||
type Server struct {
|
||||
auth AuthInterface
|
||||
@ -258,12 +265,12 @@ func (s *Server) InstallDefaultHandlers() {
|
||||
Operation("getPods"))
|
||||
s.restfulCont.Add(ws)
|
||||
|
||||
s.restfulCont.Add(stats.CreateHandlers(s.host, s.resourceAnalyzer))
|
||||
s.restfulCont.Handle("/metrics", prometheus.Handler())
|
||||
s.restfulCont.Add(stats.CreateHandlers(statsPath, s.host, s.resourceAnalyzer))
|
||||
s.restfulCont.Handle(metricsPath, prometheus.Handler())
|
||||
|
||||
ws = new(restful.WebService)
|
||||
ws.
|
||||
Path("/spec/").
|
||||
Path(specPath).
|
||||
Produces(restful.MIME_JSON)
|
||||
ws.Route(ws.GET("").
|
||||
To(s.getSpec).
|
||||
@ -336,7 +343,7 @@ func (s *Server) InstallDebuggingHandlers() {
|
||||
|
||||
ws = new(restful.WebService)
|
||||
ws.
|
||||
Path("/logs/")
|
||||
Path(logsPath)
|
||||
ws.Route(ws.GET("").
|
||||
To(s.getLogs).
|
||||
Operation("getLogs"))
|
||||
|
@ -55,11 +55,11 @@ type handler struct {
|
||||
summaryProvider SummaryProvider
|
||||
}
|
||||
|
||||
func CreateHandlers(provider StatsProvider, summaryProvider SummaryProvider) *restful.WebService {
|
||||
func CreateHandlers(rootPath string, provider StatsProvider, summaryProvider SummaryProvider) *restful.WebService {
|
||||
h := &handler{provider, summaryProvider}
|
||||
|
||||
ws := &restful.WebService{}
|
||||
ws.Path("/stats/").
|
||||
ws.Path(rootPath).
|
||||
Produces(restful.MIME_JSON)
|
||||
|
||||
endpoints := []struct {
|
||||
|
Loading…
Reference in New Issue
Block a user