17944: Adds /_health/vocabulary health endpoint. Improves cache refreshing.
[arvados.git] / lib / controller / handler.go
index 358b0ed0c2f4214e1e09012436372c1f37861391..22d2e8329a056cff1bce3a497798f60f9d4bc88f 100644 (file)
@@ -100,17 +100,22 @@ func neverRedirect(*http.Request, []*http.Request) error { return http.ErrUseLas
 
 func (h *Handler) setup() {
        mux := http.NewServeMux()
-       mux.Handle("/_health/", &health.Handler{
-               Token:  h.Cluster.ManagementToken,
-               Prefix: "/_health/",
-               Routes: health.Routes{"ping": func() error { _, err := h.db(context.TODO()); return err }},
-       })
+       var vocHealthFunc health.Func
 
        oidcAuthorizer := localdb.OIDCAccessTokenAuthorizer(h.Cluster, h.db)
-       rtr := router.New(federation.New(h.Cluster), router.Config{
+       rtr := router.New(federation.New(h.Cluster, &vocHealthFunc), router.Config{
                MaxRequestSize: h.Cluster.API.MaxRequestSize,
                WrapCalls:      api.ComposeWrappers(ctrlctx.WrapCallsInTransactions(h.db), oidcAuthorizer.WrapCalls),
        })
+
+       mux.Handle("/_health/", &health.Handler{
+               Token:  h.Cluster.ManagementToken,
+               Prefix: "/_health/",
+               Routes: health.Routes{
+                       "ping":       func() error { _, err := h.db(context.TODO()); return err },
+                       "vocabulary": vocHealthFunc,
+               },
+       })
        mux.Handle("/arvados/v1/config", rtr)
        mux.Handle("/arvados/v1/vocabulary", rtr)
        mux.Handle("/"+arvados.EndpointUserAuthenticate.Path, rtr) // must come before .../users/