mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -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. |
|
| `databaseReadReplica` | Use a read replica for some database queries. |
|
||||||
| `alertingApiServer` | Register Alerting APIs with the K8s API server |
|
| `alertingApiServer` | Register Alerting APIs with the K8s API server |
|
||||||
| `dashboardRestoreUI` | Enables the frontend to be able to restore a recently deleted dashboard |
|
| `dashboardRestoreUI` | Enables the frontend to be able to restore a recently deleted dashboard |
|
||||||
|
| `backgroundPluginInstaller` | Enable background plugin installer |
|
||||||
| `dataplaneAggregator` | Enable grafana dataplane aggregator |
|
| `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. |
|
| `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;
|
bodyScrolling?: boolean;
|
||||||
cloudwatchMetricInsightsCrossAccount?: boolean;
|
cloudwatchMetricInsightsCrossAccount?: boolean;
|
||||||
prometheusAzureOverrideAudience?: boolean;
|
prometheusAzureOverrideAudience?: boolean;
|
||||||
|
backgroundPluginInstaller?: boolean;
|
||||||
dataplaneAggregator?: boolean;
|
dataplaneAggregator?: boolean;
|
||||||
adhocFilterOneOf?: boolean;
|
adhocFilterOneOf?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/angulardetectorsprovider"
|
"github.com/grafana/grafana/pkg/services/pluginsintegration/angulardetectorsprovider"
|
||||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/keyretriever/dynamic"
|
"github.com/grafana/grafana/pkg/services/pluginsintegration/keyretriever/dynamic"
|
||||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginexternal"
|
"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"
|
pluginStore "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
|
||||||
"github.com/grafana/grafana/pkg/services/provisioning"
|
"github.com/grafana/grafana/pkg/services/provisioning"
|
||||||
publicdashboardsmetric "github.com/grafana/grafana/pkg/services/publicdashboards/metric"
|
publicdashboardsmetric "github.com/grafana/grafana/pkg/services/publicdashboards/metric"
|
||||||
@ -63,6 +64,7 @@ func ProvideBackgroundServiceRegistry(
|
|||||||
anon *anonimpl.AnonDeviceService,
|
anon *anonimpl.AnonDeviceService,
|
||||||
ssoSettings *ssosettingsimpl.Service,
|
ssoSettings *ssosettingsimpl.Service,
|
||||||
pluginExternal *pluginexternal.Service,
|
pluginExternal *pluginexternal.Service,
|
||||||
|
pluginInstaller *plugininstaller.Service,
|
||||||
// Need to make sure these are initialized, is there a better place to put them?
|
// Need to make sure these are initialized, is there a better place to put them?
|
||||||
_ dashboardsnapshots.Service,
|
_ dashboardsnapshots.Service,
|
||||||
_ serviceaccounts.Service, _ *guardian.Provider,
|
_ serviceaccounts.Service, _ *guardian.Provider,
|
||||||
@ -105,6 +107,7 @@ func ProvideBackgroundServiceRegistry(
|
|||||||
anon,
|
anon,
|
||||||
ssoSettings,
|
ssoSettings,
|
||||||
pluginExternal,
|
pluginExternal,
|
||||||
|
pluginInstaller,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1379,6 +1379,13 @@ var (
|
|||||||
Owner: grafanaPartnerPluginsSquad,
|
Owner: grafanaPartnerPluginsSquad,
|
||||||
Expression: "true", // Enabled by default for now
|
Expression: "true", // Enabled by default for now
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "backgroundPluginInstaller",
|
||||||
|
Description: "Enable background plugin installer",
|
||||||
|
Stage: FeatureStageExperimental,
|
||||||
|
Owner: grafanaPluginsPlatformSquad,
|
||||||
|
RequiresRestart: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "dataplaneAggregator",
|
Name: "dataplaneAggregator",
|
||||||
Description: "Enable grafana dataplane aggregator",
|
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
|
bodyScrolling,preview,@grafana/grafana-frontend-platform,false,false,true
|
||||||
cloudwatchMetricInsightsCrossAccount,preview,@grafana/aws-datasources,false,false,true
|
cloudwatchMetricInsightsCrossAccount,preview,@grafana/aws-datasources,false,false,true
|
||||||
prometheusAzureOverrideAudience,deprecated,@grafana/partner-datasources,false,false,false
|
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
|
dataplaneAggregator,experimental,@grafana/grafana-app-platform-squad,false,true,false
|
||||||
adhocFilterOneOf,experimental,@grafana/dashboards-squad,false,false,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.
|
// 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"
|
FlagPrometheusAzureOverrideAudience = "prometheusAzureOverrideAudience"
|
||||||
|
|
||||||
|
// FlagBackgroundPluginInstaller
|
||||||
|
// Enable background plugin installer
|
||||||
|
FlagBackgroundPluginInstaller = "backgroundPluginInstaller"
|
||||||
|
|
||||||
// FlagDataplaneAggregator
|
// FlagDataplaneAggregator
|
||||||
// Enable grafana dataplane aggregator
|
// Enable grafana dataplane aggregator
|
||||||
FlagDataplaneAggregator = "dataplaneAggregator"
|
FlagDataplaneAggregator = "dataplaneAggregator"
|
||||||
|
@ -529,6 +529,19 @@
|
|||||||
"codeowner": "@grafana/partner-datasources"
|
"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": {
|
"metadata": {
|
||||||
"name": "bodyScrolling",
|
"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/plugincontext"
|
||||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
|
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginerrs"
|
||||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginexternal"
|
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginexternal"
|
||||||
|
"github.com/grafana/grafana/pkg/services/pluginsintegration/plugininstaller"
|
||||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
|
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings"
|
||||||
pluginSettings "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings/service"
|
pluginSettings "github.com/grafana/grafana/pkg/services/pluginsintegration/pluginsettings/service"
|
||||||
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
|
"github.com/grafana/grafana/pkg/services/pluginsintegration/pluginstore"
|
||||||
@ -124,6 +125,7 @@ var WireSet = wire.NewSet(
|
|||||||
pluginexternal.ProvideService,
|
pluginexternal.ProvideService,
|
||||||
plugincontext.ProvideBaseService,
|
plugincontext.ProvideBaseService,
|
||||||
wire.Bind(new(plugincontext.BasePluginContextProvider), new(*plugincontext.BaseProvider)),
|
wire.Bind(new(plugincontext.BasePluginContextProvider), new(*plugincontext.BaseProvider)),
|
||||||
|
plugininstaller.ProvideService,
|
||||||
)
|
)
|
||||||
|
|
||||||
// WireExtensionSet provides a wire.ProviderSet of plugin providers that can be
|
// WireExtensionSet provides a wire.ProviderSet of plugin providers that can be
|
||||||
|
Loading…
Reference in New Issue
Block a user