K8s: Register apiserver as background service, and list real playlists (#75338)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Todd Treece
2023-09-25 15:31:58 -07:00
committed by GitHub
co-authored by Ryan McKinley
parent 60922e5f77
commit 440f9a6ffb
16 changed files with 237 additions and 88 deletions
+8 -9
View File
@@ -5,7 +5,6 @@ import (
"fmt"
"net"
"os"
"path"
"path/filepath"
"strconv"
"sync"
@@ -16,7 +15,6 @@ import (
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/modules"
"github.com/grafana/grafana/pkg/services/featuremgmt"
grafanaapiserver "github.com/grafana/grafana/pkg/services/grafana-apiserver"
"github.com/grafana/grafana/pkg/setting"
)
@@ -122,13 +120,14 @@ func (s *ModuleServer) Run() error {
return NewService(s.cfg, s.opts, s.apiOpts)
})
if s.features.IsEnabled(featuremgmt.FlagGrafanaAPIServer) {
m.RegisterModule(modules.GrafanaAPIServer, func() (services.Service, error) {
return grafanaapiserver.New(path.Join(s.cfg.DataPath, "k8s"))
})
} else {
s.log.Debug("apiserver feature is disabled")
}
// TODO: uncomment this once the apiserver is ready to be run as a standalone target
//if s.features.IsEnabled(featuremgmt.FlagGrafanaAPIServer) {
// m.RegisterModule(modules.GrafanaAPIServer, func() (services.Service, error) {
// return grafanaapiserver.New(path.Join(s.cfg.DataPath, "k8s"))
// })
//} else {
// s.log.Debug("apiserver feature is disabled")
//}
m.RegisterModule(modules.All, nil)
+4
View File
@@ -33,6 +33,7 @@ import (
"github.com/grafana/grafana/pkg/login/social"
"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/corekind"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/accesscontrol/acimpl"
@@ -63,6 +64,7 @@ import (
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/folder"
"github.com/grafana/grafana/pkg/services/folder/folderimpl"
grafanaapiserver "github.com/grafana/grafana/pkg/services/grafana-apiserver"
"github.com/grafana/grafana/pkg/services/grpcserver"
grpccontext "github.com/grafana/grafana/pkg/services/grpcserver/context"
"github.com/grafana/grafana/pkg/services/grpcserver/interceptors"
@@ -359,6 +361,8 @@ var wireBasicSet = wire.NewSet(
loggermw.Provide,
signingkeysimpl.ProvideEmbeddedSigningKeysService,
wire.Bind(new(signingkeys.Service), new(*signingkeysimpl.Service)),
grafanaapiserver.WireSet,
apiregistry.WireSet,
)
var wireSet = wire.NewSet(