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
This commit is contained in:
Austin Pond
2025-10-21 14:25:16 -04:00
committed by GitHub
parent c8664d303e
commit 56b088aa2e
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -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) {
+4
View File
@@ -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