mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 14:11:14 +00:00
Add a validator for validating components in the cluster infrastructure.
This commit is contained in:
@@ -91,6 +91,16 @@ func (g *APIGroup) InstallREST(mux mux, paths ...string) {
|
||||
redirectHandler := &RedirectHandler{g.handler.storage, g.handler.codec}
|
||||
opHandler := &OperationHandler{g.handler.ops, g.handler.codec}
|
||||
|
||||
servers := map[string]string{
|
||||
"controller-manager": "127.0.0.1:10252",
|
||||
"scheduler": "127.0.0.1:10251",
|
||||
// TODO: Add minion health checks here too.
|
||||
}
|
||||
validator, err := NewValidator(servers)
|
||||
if err != nil {
|
||||
glog.Errorf("failed to set up validator: %v", err)
|
||||
validator = nil
|
||||
}
|
||||
for _, prefix := range paths {
|
||||
prefix = strings.TrimRight(prefix, "/")
|
||||
proxyHandler := &ProxyHandler{prefix + "/proxy/", g.handler.storage, g.handler.codec}
|
||||
@@ -100,6 +110,9 @@ func (g *APIGroup) InstallREST(mux mux, paths ...string) {
|
||||
mux.Handle(prefix+"/redirect/", http.StripPrefix(prefix+"/redirect/", redirectHandler))
|
||||
mux.Handle(prefix+"/operations", http.StripPrefix(prefix+"/operations", opHandler))
|
||||
mux.Handle(prefix+"/operations/", http.StripPrefix(prefix+"/operations/", opHandler))
|
||||
if validator != nil {
|
||||
mux.Handle(prefix+"/validate", validator)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user