mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 13:02:14 +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"
|
"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.
|
// Server is a http.Handler which exposes kubelet functionality over HTTP.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
auth AuthInterface
|
auth AuthInterface
|
||||||
@ -258,12 +265,12 @@ func (s *Server) InstallDefaultHandlers() {
|
|||||||
Operation("getPods"))
|
Operation("getPods"))
|
||||||
s.restfulCont.Add(ws)
|
s.restfulCont.Add(ws)
|
||||||
|
|
||||||
s.restfulCont.Add(stats.CreateHandlers(s.host, s.resourceAnalyzer))
|
s.restfulCont.Add(stats.CreateHandlers(statsPath, s.host, s.resourceAnalyzer))
|
||||||
s.restfulCont.Handle("/metrics", prometheus.Handler())
|
s.restfulCont.Handle(metricsPath, prometheus.Handler())
|
||||||
|
|
||||||
ws = new(restful.WebService)
|
ws = new(restful.WebService)
|
||||||
ws.
|
ws.
|
||||||
Path("/spec/").
|
Path(specPath).
|
||||||
Produces(restful.MIME_JSON)
|
Produces(restful.MIME_JSON)
|
||||||
ws.Route(ws.GET("").
|
ws.Route(ws.GET("").
|
||||||
To(s.getSpec).
|
To(s.getSpec).
|
||||||
@ -336,7 +343,7 @@ func (s *Server) InstallDebuggingHandlers() {
|
|||||||
|
|
||||||
ws = new(restful.WebService)
|
ws = new(restful.WebService)
|
||||||
ws.
|
ws.
|
||||||
Path("/logs/")
|
Path(logsPath)
|
||||||
ws.Route(ws.GET("").
|
ws.Route(ws.GET("").
|
||||||
To(s.getLogs).
|
To(s.getLogs).
|
||||||
Operation("getLogs"))
|
Operation("getLogs"))
|
||||||
|
@ -55,11 +55,11 @@ type handler struct {
|
|||||||
summaryProvider SummaryProvider
|
summaryProvider SummaryProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateHandlers(provider StatsProvider, summaryProvider SummaryProvider) *restful.WebService {
|
func CreateHandlers(rootPath string, provider StatsProvider, summaryProvider SummaryProvider) *restful.WebService {
|
||||||
h := &handler{provider, summaryProvider}
|
h := &handler{provider, summaryProvider}
|
||||||
|
|
||||||
ws := &restful.WebService{}
|
ws := &restful.WebService{}
|
||||||
ws.Path("/stats/").
|
ws.Path(rootPath).
|
||||||
Produces(restful.MIME_JSON)
|
Produces(restful.MIME_JSON)
|
||||||
|
|
||||||
endpoints := []struct {
|
endpoints := []struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user