Plugins: Expose datasources as apiservers feature toggle (#93250)

This commit is contained in:
Ryan McKinley 2024-09-19 11:28:27 +03:00 committed by GitHub
parent 73eff837e8
commit f21a5987a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 48 additions and 12 deletions

View File

@ -145,6 +145,7 @@ Experimental features might be changed or removed without prior notice.
| `awsDatasourcesTempCredentials` | Support temporary security credentials in AWS plugins for Grafana Cloud customers |
| `mlExpressions` | Enable support for Machine Learning in server-side expressions |
| `metricsSummary` | Enables metrics summary queries in the Tempo data source |
| `datasourceAPIServers` | Expose some datasources as apiservers. |
| `permissionsFilterRemoveSubquery` | Alternative permission filter implementation that does not use subqueries for fetching the dashboard folder |
| `aiGeneratedDashboardChanges` | Enable AI powered features for dashboards to auto-summary changes when saving |
| `sseGroupByDatasource` | Send query to the same datasource in a single request when using server side expressions. The `cloudWatchBatchQueries` feature toggle should be enabled if this used with CloudWatch. |
@ -206,8 +207,8 @@ Experimental features might be changed or removed without prior notice.
The following toggles require explicitly setting Grafana's [app mode]({{< relref "../_index.md#app_mode" >}}) to 'development' before you can enable this feature toggle. These features tend to be experimental.
| Feature toggle name | Description |
| -------------------------------------- | -------------------------------------------------------------- |
| `grafanaAPIServerWithExperimentalAPIs` | Register experimental APIs with the k8s API server |
| `grafanaAPIServerEnsureKubectlAccess` | Start an additional https handler and write kubectl options |
| `panelTitleSearchInV1` | Enable searching for dashboards using panel title in search v1 |
| Feature toggle name | Description |
| -------------------------------------- | ----------------------------------------------------------------------------- |
| `grafanaAPIServerWithExperimentalAPIs` | Register experimental APIs with the k8s API server, including all datasources |
| `grafanaAPIServerEnsureKubectlAccess` | Start an additional https handler and write kubectl options |
| `panelTitleSearchInV1` | Enable searching for dashboards using panel title in search v1 |

View File

@ -87,6 +87,7 @@ export interface FeatureToggles {
mlExpressions?: boolean;
traceQLStreaming?: boolean;
metricsSummary?: boolean;
datasourceAPIServers?: boolean;
grafanaAPIServerWithExperimentalAPIs?: boolean;
grafanaAPIServerEnsureKubectlAccess?: boolean;
featureToggleAdminPage?: boolean;

View File

@ -58,8 +58,11 @@ func RegisterAPIService(
accessControl accesscontrol.AccessControl,
reg prometheus.Registerer,
) (*DataSourceAPIBuilder, error) {
// We want to expose just a limited set of plugins
explictPluginList := features.IsEnabledGlobally(featuremgmt.FlagDatasourceAPIServers)
// This requires devmode!
if !features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs) {
if !(explictPluginList || features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs)) {
return nil, nil // skip registration unless opting into experimental apis
}
@ -73,7 +76,7 @@ func RegisterAPIService(
}
for _, ds := range all {
if !slices.Contains(ids, ds.ID) {
if explictPluginList && !slices.Contains(ids, ds.ID) {
continue // skip this one
}

View File

@ -517,9 +517,16 @@ var (
FrontendOnly: true,
Owner: grafanaObservabilityTracesAndProfilingSquad,
},
{
Name: "datasourceAPIServers",
Description: "Expose some datasources as apiservers.",
Stage: FeatureStageExperimental,
Owner: grafanaAppPlatformSquad,
RequiresRestart: true, // changes the API routing
},
{
Name: "grafanaAPIServerWithExperimentalAPIs",
Description: "Register experimental APIs with the k8s API server",
Description: "Register experimental APIs with the k8s API server, including all datasources",
Stage: FeatureStageExperimental,
RequiresRestart: true,
RequiresDevMode: true,

View File

@ -68,6 +68,7 @@ transformationsRedesign,GA,@grafana/observability-metrics,false,false,true
mlExpressions,experimental,@grafana/alerting-squad,false,false,false
traceQLStreaming,GA,@grafana/observability-traces-and-profiling,false,false,true
metricsSummary,experimental,@grafana/observability-traces-and-profiling,false,false,true
datasourceAPIServers,experimental,@grafana/grafana-app-platform-squad,false,true,false
grafanaAPIServerWithExperimentalAPIs,experimental,@grafana/grafana-app-platform-squad,true,true,false
grafanaAPIServerEnsureKubectlAccess,experimental,@grafana/grafana-app-platform-squad,true,true,false
featureToggleAdminPage,experimental,@grafana/grafana-operator-experience-squad,false,true,false

1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
68 mlExpressions experimental @grafana/alerting-squad false false false
69 traceQLStreaming GA @grafana/observability-traces-and-profiling false false true
70 metricsSummary experimental @grafana/observability-traces-and-profiling false false true
71 datasourceAPIServers experimental @grafana/grafana-app-platform-squad false true false
72 grafanaAPIServerWithExperimentalAPIs experimental @grafana/grafana-app-platform-squad true true false
73 grafanaAPIServerEnsureKubectlAccess experimental @grafana/grafana-app-platform-squad true true false
74 featureToggleAdminPage experimental @grafana/grafana-operator-experience-squad false true false

View File

@ -283,8 +283,12 @@ const (
// Enables metrics summary queries in the Tempo data source
FlagMetricsSummary = "metricsSummary"
// FlagDatasourceAPIServers
// Expose some datasources as apiservers.
FlagDatasourceAPIServers = "datasourceAPIServers"
// FlagGrafanaAPIServerWithExperimentalAPIs
// Register experimental APIs with the k8s API server
// Register experimental APIs with the k8s API server, including all datasources
FlagGrafanaAPIServerWithExperimentalAPIs = "grafanaAPIServerWithExperimentalAPIs"
// FlagGrafanaAPIServerEnsureKubectlAccess

View File

@ -909,6 +909,22 @@
"expression": "true"
}
},
{
"metadata": {
"name": "datasourceAPIServers",
"resourceVersion": "1726731672938",
"creationTimestamp": "2024-09-12T07:32:40Z",
"annotations": {
"grafana.app/updatedTimestamp": "2024-09-19 07:41:12.938146 +0000 UTC"
}
},
"spec": {
"description": "Expose some datasources as apiservers.",
"stage": "experimental",
"codeowner": "@grafana/grafana-app-platform-squad",
"requiresRestart": true
}
},
{
"metadata": {
"name": "datasourceProxyDisableRBAC",
@ -1327,11 +1343,14 @@
{
"metadata": {
"name": "grafanaAPIServerWithExperimentalAPIs",
"resourceVersion": "1718727528075",
"creationTimestamp": "2023-10-06T18:55:22Z"
"resourceVersion": "1726731672938",
"creationTimestamp": "2023-10-06T18:55:22Z",
"annotations": {
"grafana.app/updatedTimestamp": "2024-09-19 07:41:12.938146 +0000 UTC"
}
},
"spec": {
"description": "Register experimental APIs with the k8s API server",
"description": "Register experimental APIs with the k8s API server, including all datasources",
"stage": "experimental",
"codeowner": "@grafana/grafana-app-platform-squad",
"requiresDevMode": true,