mirror of
https://github.com/grafana/grafana.git
synced 2025-01-15 19:22:34 -06:00
Chore: Add skeleton for background plugin installer (#91743)
This commit is contained in:
parent
25dbb32cea
commit
d342e76f63
@ -191,6 +191,7 @@ Experimental features might be changed or removed without prior notice.
|
||||
| `databaseReadReplica` | Use a read replica for some database queries. |
|
||||
| `alertingApiServer` | Register Alerting APIs with the K8s API server |
|
||||
| `dashboardRestoreUI` | Enables the frontend to be able to restore a recently deleted dashboard |
|
||||
| `backgroundPluginInstaller` | Enable background plugin installer |
|
||||
| `dataplaneAggregator` | Enable grafana dataplane aggregator |
|
||||
| `adhocFilterOneOf` | Exposes a new 'one of' operator for ad-hoc filters. This operator allows users to filter by multiple values in a single filter. |
|
||||
|
||||
|
@ -200,6 +200,7 @@ export interface FeatureToggles {
|
||||
bodyScrolling?: boolean;
|
||||
cloudwatchMetricInsightsCrossAccount?: boolean;
|
||||
prometheusAzureOverrideAudience?: boolean;
|
||||
backgroundPluginInstaller?: boolean;
|
||||
dataplaneAggregator?: boolean;
|
||||
adhocFilterOneOf?: boolean;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/angulardetectorsprovider"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/keyretriever/dynamic"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginexternal"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugininstaller"
|
||||
pluginStore "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
|
||||
"github.com/grafana/grafana/pkg/services/provisioning"
|
||||
publicdashboardsmetric "github.com/grafana/grafana/pkg/services/publicdashboards/metric"
|
||||
@ -63,6 +64,7 @@ func ProvideBackgroundServiceRegistry(
|
||||
anon *anonimpl.AnonDeviceService,
|
||||
ssoSettings *ssosettingsimpl.Service,
|
||||
pluginExternal *pluginexternal.Service,
|
||||
pluginInstaller *plugininstaller.Service,
|
||||
// Need to make sure these are initialized, is there a better place to put them?
|
||||
_ dashboardsnapshots.Service,
|
||||
_ serviceaccounts.Service, _ *guardian.Provider,
|
||||
@ -105,6 +107,7 @@ func ProvideBackgroundServiceRegistry(
|
||||
anon,
|
||||
ssoSettings,
|
||||
pluginExternal,
|
||||
pluginInstaller,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -1379,6 +1379,13 @@ var (
|
||||
Owner: grafanaPartnerPluginsSquad,
|
||||
Expression: "true", // Enabled by default for now
|
||||
},
|
||||
{
|
||||
Name: "backgroundPluginInstaller",
|
||||
Description: "Enable background plugin installer",
|
||||
Stage: FeatureStageExperimental,
|
||||
Owner: grafanaPluginsPlatformSquad,
|
||||
RequiresRestart: true,
|
||||
},
|
||||
{
|
||||
Name: "dataplaneAggregator",
|
||||
Description: "Enable grafana dataplane aggregator",
|
||||
|
@ -181,5 +181,6 @@ cloudWatchRoundUpEndTime,GA,@grafana/aws-datasources,false,false,false
|
||||
bodyScrolling,preview,@grafana/grafana-frontend-platform,false,false,true
|
||||
cloudwatchMetricInsightsCrossAccount,preview,@grafana/aws-datasources,false,false,true
|
||||
prometheusAzureOverrideAudience,deprecated,@grafana/partner-datasources,false,false,false
|
||||
backgroundPluginInstaller,experimental,@grafana/plugins-platform-backend,false,true,false
|
||||
dataplaneAggregator,experimental,@grafana/grafana-app-platform-squad,false,true,false
|
||||
adhocFilterOneOf,experimental,@grafana/dashboards-squad,false,false,false
|
||||
|
|
@ -735,6 +735,10 @@ const (
|
||||
// Deprecated. Allow override default AAD audience for Azure Prometheus endpoint. Enabled by default. This feature should no longer be used and will be removed in the future.
|
||||
FlagPrometheusAzureOverrideAudience = "prometheusAzureOverrideAudience"
|
||||
|
||||
// FlagBackgroundPluginInstaller
|
||||
// Enable background plugin installer
|
||||
FlagBackgroundPluginInstaller = "backgroundPluginInstaller"
|
||||
|
||||
// FlagDataplaneAggregator
|
||||
// Enable grafana dataplane aggregator
|
||||
FlagDataplaneAggregator = "dataplaneAggregator"
|
||||
|
@ -529,6 +529,19 @@
|
||||
"codeowner": "@grafana/partner-datasources"
|
||||
}
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"name": "backgroundPluginInstaller",
|
||||
"resourceVersion": "1723202510081",
|
||||
"creationTimestamp": "2024-08-09T11:21:50Z"
|
||||
},
|
||||
"spec": {
|
||||
"description": "Enable background plugin installer",
|
||||
"stage": "experimental",
|
||||
"codeowner": "@grafana/plugins-platform-backend",
|
||||
"requiresRestart": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"name": "bodyScrolling",
|
||||
|
32
pkg/services/pluginsintegration/plugininstaller/service.go
Normal file
32
pkg/services/pluginsintegration/plugininstaller/service.go
Normal file
@ -0,0 +1,32 @@
|
||||
package plugininstaller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
features featuremgmt.FeatureToggles
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func ProvideService(cfg *setting.Cfg, features featuremgmt.FeatureToggles) *Service {
|
||||
s := &Service{
|
||||
features: features,
|
||||
log: log.New("plugin.installer"),
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// IsDisabled disables background installation of plugins.
|
||||
func (s *Service) IsDisabled() bool {
|
||||
return !s.features.IsEnabled(context.Background(), featuremgmt.FlagBackgroundPluginInstaller)
|
||||
}
|
||||
|
||||
func (s *Service) Run(ctx context.Context) error {
|
||||
s.log.Debug("PluginInstaller.Run not implemented")
|
||||
return nil
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package plugininstaller
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
)
|
||||
|
||||
// Test if the service is disabled
|
||||
func TestService_IsDisabled(t *testing.T) {
|
||||
// Create a new service
|
||||
s := &Service{
|
||||
features: featuremgmt.WithFeatures(featuremgmt.FlagBackgroundPluginInstaller),
|
||||
}
|
||||
|
||||
// Check if the service is disabled
|
||||
if s.IsDisabled() {
|
||||
t.Error("Service should be enabled")
|
||||
}
|
||||
}
|
@ -47,6 +47,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugincontext"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginexternal"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugininstaller"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
|
||||
pluginSettings "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings/service"
|
||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
|
||||
@ -124,6 +125,7 @@ var WireSet = wire.NewSet(
|
||||
pluginexternal.ProvideService,
|
||||
plugincontext.ProvideBaseService,
|
||||
wire.Bind(new(plugincontext.BasePluginContextProvider), new(*plugincontext.BaseProvider)),
|
||||
plugininstaller.ProvideService,
|
||||
)
|
||||
|
||||
// WireExtensionSet provides a wire.ProviderSet of plugin providers that can be
|
||||
|
Loading…
Reference in New Issue
Block a user