From 56b088aa2e66abe8db268dad612e3457c78abc55 Mon Sep 17 00:00:00 2001 From: Austin Pond Date: Tue, 21 Oct 2025 14:25:16 -0400 Subject: [PATCH] APIServer: Add Method for Installer-Based Apps to Self-Register with the APIRegistrar (#112479) * [APIServer] Add the method RegisterAPIInstaller to the APIRegistrar interface, and implement it in the builder. This allows new installer-based apps to register themselves in enterprise. * Rename RegisterAPIInstaller to RegisterAppInstaller --- pkg/services/apiserver/builder/common.go | 2 ++ pkg/services/apiserver/service.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/pkg/services/apiserver/builder/common.go b/pkg/services/apiserver/builder/common.go index c99176099b8..bebbad8e8a6 100644 --- a/pkg/services/apiserver/builder/common.go +++ b/pkg/services/apiserver/builder/common.go @@ -15,6 +15,7 @@ import ( "k8s.io/kube-openapi/pkg/common" "k8s.io/kube-openapi/pkg/spec3" + appsdkapiserver "github.com/grafana/grafana-app-sdk/k8s/apiserver" grafanarest "github.com/grafana/grafana/pkg/apiserver/rest" "github.com/grafana/grafana/pkg/services/apiserver/options" "github.com/grafana/grafana/pkg/storage/unified/apistore" @@ -113,6 +114,7 @@ type APIRoutes struct { type APIRegistrar interface { RegisterAPI(builder APIGroupBuilder) + RegisterAppInstaller(installer appsdkapiserver.AppInstaller) } func getGroup(builder APIGroupBuilder) (string, error) { diff --git a/pkg/services/apiserver/service.go b/pkg/services/apiserver/service.go index 77acc027a6f..3f9124e6337 100644 --- a/pkg/services/apiserver/service.go +++ b/pkg/services/apiserver/service.go @@ -248,6 +248,10 @@ func (s *service) RegisterAPI(b builder.APIGroupBuilder) { s.builders = append(s.builders, b) } +func (s *service) RegisterAppInstaller(i appsdkapiserver.AppInstaller) { + s.appInstallers = append(s.appInstallers, i) +} + // nolint:gocyclo func (s *service) start(ctx context.Context) error { // Get the list of groups the server will support