@@ -25,8 +25,9 @@ import (
2525)
2626
2727const (
28- GetNodeResourcesPath = "/node/"
29- GetAllResourcesPath = "/resources"
28+ GetNodeResourcesPath = "/node/"
29+ GetAllResourcesPath = "/resources/all"
30+ GetResourcesSummaryPath = "/resources/summary"
3031)
3132
3233type IntrospectHandler struct {
@@ -42,6 +43,7 @@ func (i *IntrospectHandler) Start(_ context.Context) error {
4243 mux := http .NewServeMux ()
4344 mux .HandleFunc (GetAllResourcesPath , i .ResourceHandler )
4445 mux .HandleFunc (GetNodeResourcesPath , i .NodeResourceHandler )
46+ mux .HandleFunc (GetResourcesSummaryPath , i .ResourceSummaryHandler )
4547
4648 // Should this be a fatal error?
4749 err := http .ListenAndServe (i .BindAddress , mux )
@@ -95,6 +97,26 @@ func (i *IntrospectHandler) NodeResourceHandler(w http.ResponseWriter, r *http.R
9597 w .Write (jsonData )
9698}
9799
100+ // ResourceSummaryHandler returns all the resources associated with the Node
101+ func (i * IntrospectHandler ) ResourceSummaryHandler (w http.ResponseWriter , r * http.Request ) {
102+ response := make (map [string ]interface {})
103+ for resourceName , provider := range i .ResourceManager .GetResourceProviders () {
104+ data := provider .IntrospectSummary ()
105+ response [resourceName ] = data
106+ }
107+
108+ jsonData , err := json .MarshalIndent (response , "" , "\t " )
109+ if err != nil {
110+ w .WriteHeader (http .StatusInternalServerError )
111+ w .Write ([]byte (err .Error ()))
112+ return
113+ }
114+
115+ w .Header ().Set ("content-type" , "application/json" )
116+ w .WriteHeader (http .StatusOK )
117+ w .Write (jsonData )
118+ }
119+
98120func (i * IntrospectHandler ) SetupWithManager (mgr ctrl.Manager , healthzHanlder * rcHealthz.HealthzHandler ) error {
99121 // add health check on subpath for introspect controller
100122 healthzHanlder .AddControllersHealthCheckers (
0 commit comments