K8s: Refactor standalone apiserver initialization (#81932)

This commit is contained in:
Ryan McKinley
2024-02-06 08:40:35 -08:00
committed by GitHub
parent abaed01d7e
commit 91754bcda5
11 changed files with 256 additions and 438 deletions
+5 -4
View File
@@ -35,7 +35,6 @@ import (
"github.com/grafana/grafana/pkg/middleware/csrf"
"github.com/grafana/grafana/pkg/middleware/loggermw"
apiregistry "github.com/grafana/grafana/pkg/registry/apis"
"github.com/grafana/grafana/pkg/registry/apis/datasource"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/accesscontrol/acimpl"
"github.com/grafana/grafana/pkg/services/accesscontrol/ossaccesscontrol"
@@ -45,6 +44,7 @@ import (
"github.com/grafana/grafana/pkg/services/anonymous/anonimpl/anonstore"
"github.com/grafana/grafana/pkg/services/apikey/apikeyimpl"
grafanaapiserver "github.com/grafana/grafana/pkg/services/apiserver"
"github.com/grafana/grafana/pkg/services/apiserver/standalone"
"github.com/grafana/grafana/pkg/services/auth"
"github.com/grafana/grafana/pkg/services/auth/idimpl"
"github.com/grafana/grafana/pkg/services/auth/jwt"
@@ -465,7 +465,8 @@ func InitializeModuleServer(cfg *setting.Cfg, opts Options, apiOpts api.ServerOp
return &ModuleServer{}, nil
}
func InitializeDataSourceAPIServer(group string) (*datasource.DataSourceAPIBuilder, error) {
wire.Build(wireExtsDataSourceApiServerSet)
return &datasource.DataSourceAPIBuilder{}, nil
// Initialize the standalone APIServer factory
func InitializeAPIServerFactory() (standalone.APIServerFactory, error) {
wire.Build(wireExtsStandaloneAPIServerSet)
return &standalone.DummyAPIFactory{}, nil // Wire will replace this with a real interface
}
+3 -3
View File
@@ -11,7 +11,6 @@ import (
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/plugins/manager"
"github.com/grafana/grafana/pkg/registry"
"github.com/grafana/grafana/pkg/registry/apis/datasource"
"github.com/grafana/grafana/pkg/registry/backgroundsvcs"
"github.com/grafana/grafana/pkg/registry/usagestatssvcs"
"github.com/grafana/grafana/pkg/services/accesscontrol"
@@ -19,6 +18,7 @@ import (
"github.com/grafana/grafana/pkg/services/accesscontrol/ossaccesscontrol"
"github.com/grafana/grafana/pkg/services/anonymous"
"github.com/grafana/grafana/pkg/services/anonymous/anonimpl"
"github.com/grafana/grafana/pkg/services/apiserver/standalone"
"github.com/grafana/grafana/pkg/services/auth"
"github.com/grafana/grafana/pkg/services/auth/authimpl"
"github.com/grafana/grafana/pkg/services/auth/idimpl"
@@ -139,6 +139,6 @@ var wireExtsModuleServerSet = wire.NewSet(
wireExtsBaseCLISet,
)
var wireExtsDataSourceApiServerSet = wire.NewSet(
datasource.NewTestDataAPIServer,
var wireExtsStandaloneAPIServerSet = wire.NewSet(
standalone.GetDummyAPIFactory,
)