K8s: add feature toggle for dashboard backend (#94753)

This commit is contained in:
Stephanie Hingtgen
2024-10-15 14:30:05 -05:00
committed by GitHub
parent a1434a98a3
commit 644a16048f
8 changed files with 40 additions and 18 deletions
@@ -165,6 +165,7 @@ Experimental features might be changed or removed without prior notice.
| `disableClassicHTTPHistogram` | Disables classic HTTP Histogram (use with enableNativeHTTPHistogram) |
| `kubernetesSnapshots` | Routes snapshot requests from /api to the /apis endpoint |
| `kubernetesDashboards` | Use the kubernetes API in the frontend for dashboards |
| `kubernetesDashboardsAPI` | Use the kubernetes API in the backend for dashboards |
| `kubernetesFolders` | Use the kubernetes API in the frontend for folders, and route /api/folders requests to k8s |
| `grafanaAPIServerTestingWithExperimentalAPIs` | Facilitate integration testing of experimental APIs |
| `datasourceQueryTypes` | Show query type endpoints in datasource API servers (currently hardcoded for testdata, expressions, and prometheus) |
@@ -116,6 +116,7 @@ export interface FeatureToggles {
kubernetesPlaylists?: boolean;
kubernetesSnapshots?: boolean;
kubernetesDashboards?: boolean;
kubernetesDashboardsAPI?: boolean;
kubernetesFolders?: boolean;
grafanaAPIServerTestingWithExperimentalAPIs?: boolean;
datasourceQueryTypes?: boolean;
+2 -2
View File
@@ -56,8 +56,8 @@ func RegisterAPIService(cfg *setting.Cfg, features featuremgmt.FeatureToggles,
tracing *tracing.TracingService,
unified resource.ResourceClient,
) *DashboardsAPIBuilder {
if !features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs) {
return nil // skip registration unless opting into experimental apis
if !features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs) && !features.IsEnabledGlobally(featuremgmt.FlagKubernetesDashboardsAPI) {
return nil // skip registration unless opting into experimental apis or dashboards in the k8s api
}
softDelete := features.IsEnabledGlobally(featuremgmt.FlagDashboardRestore)
+7
View File
@@ -743,6 +743,13 @@ var (
Owner: grafanaAppPlatformSquad,
FrontendOnly: true,
},
{
Name: "kubernetesDashboardsAPI",
Description: "Use the kubernetes API in the backend for dashboards",
Stage: FeatureStageExperimental,
Owner: grafanaAppPlatformSquad,
RequiresRestart: true, // changes the API routing
},
{
Name: "kubernetesFolders",
Description: "Use the kubernetes API in the frontend for folders, and route /api/folders requests to k8s",
+1
View File
@@ -97,6 +97,7 @@ transformationsVariableSupport,GA,@grafana/dataviz-squad,false,false,true
kubernetesPlaylists,GA,@grafana/grafana-app-platform-squad,false,true,false
kubernetesSnapshots,experimental,@grafana/grafana-app-platform-squad,false,true,false
kubernetesDashboards,experimental,@grafana/grafana-app-platform-squad,false,false,true
kubernetesDashboardsAPI,experimental,@grafana/grafana-app-platform-squad,false,true,false
kubernetesFolders,experimental,@grafana/search-and-storage,false,false,false
grafanaAPIServerTestingWithExperimentalAPIs,experimental,@grafana/search-and-storage,false,false,false
datasourceQueryTypes,experimental,@grafana/grafana-app-platform-squad,false,true,false
1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
97 kubernetesPlaylists GA @grafana/grafana-app-platform-squad false true false
98 kubernetesSnapshots experimental @grafana/grafana-app-platform-squad false true false
99 kubernetesDashboards experimental @grafana/grafana-app-platform-squad false false true
100 kubernetesDashboardsAPI experimental @grafana/grafana-app-platform-squad false true false
101 kubernetesFolders experimental @grafana/search-and-storage false false false
102 grafanaAPIServerTestingWithExperimentalAPIs experimental @grafana/search-and-storage false false false
103 datasourceQueryTypes experimental @grafana/grafana-app-platform-squad false true false
+4
View File
@@ -399,6 +399,10 @@ const (
// Use the kubernetes API in the frontend for dashboards
FlagKubernetesDashboards = "kubernetesDashboards"
// FlagKubernetesDashboardsAPI
// Use the kubernetes API in the backend for dashboards
FlagKubernetesDashboardsAPI = "kubernetesDashboardsAPI"
// FlagKubernetesFolders
// Use the kubernetes API in the frontend for folders, and route /api/folders requests to k8s
FlagKubernetesFolders = "kubernetesFolders"
+13
View File
@@ -1644,6 +1644,19 @@
"frontend": true
}
},
{
"metadata": {
"name": "kubernetesDashboardsAPI",
"resourceVersion": "1729017284006",
"creationTimestamp": "2024-10-15T18:34:44Z"
},
"spec": {
"description": "Use the kubernetes API in the backend for dashboards",
"stage": "experimental",
"codeowner": "@grafana/grafana-app-platform-squad",
"requiresRestart": true
}
},
{
"metadata": {
"name": "kubernetesFeatureToggles",
+11 -16
View File
@@ -117,10 +117,9 @@ func TestIntegrationDashboardsApp(t *testing.T) {
t.Run("with dual writer mode 0", func(t *testing.T) {
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
AppModeProduction: false, // required for experimental APIs
DisableAnonymous: true,
DisableAnonymous: true,
EnableFeatureToggles: []string{
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // Required to start the example service
featuremgmt.FlagKubernetesDashboardsAPI,
featuremgmt.FlagKubernetesDashboards,
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
@@ -134,10 +133,9 @@ func TestIntegrationDashboardsApp(t *testing.T) {
t.Run("with dual writer mode 1", func(t *testing.T) {
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
AppModeProduction: false, // required for experimental APIs
DisableAnonymous: true,
DisableAnonymous: true,
EnableFeatureToggles: []string{
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // Required to start the example service
featuremgmt.FlagKubernetesDashboardsAPI,
featuremgmt.FlagKubernetesDashboards,
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
@@ -151,10 +149,9 @@ func TestIntegrationDashboardsApp(t *testing.T) {
t.Run("with dual writer mode 2", func(t *testing.T) {
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
AppModeProduction: false, // required for experimental APIs
DisableAnonymous: true,
DisableAnonymous: true,
EnableFeatureToggles: []string{
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // Required to start the example service
featuremgmt.FlagKubernetesDashboardsAPI,
featuremgmt.FlagKubernetesDashboards,
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
@@ -168,10 +165,9 @@ func TestIntegrationDashboardsApp(t *testing.T) {
t.Run("with dual writer mode 3", func(t *testing.T) {
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
AppModeProduction: false, // required for experimental APIs
DisableAnonymous: true,
DisableAnonymous: true,
EnableFeatureToggles: []string{
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // Required to start the example service
featuremgmt.FlagKubernetesDashboardsAPI,
featuremgmt.FlagKubernetesDashboards,
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
@@ -185,10 +181,9 @@ func TestIntegrationDashboardsApp(t *testing.T) {
t.Run("with dual writer mode 4", func(t *testing.T) {
helper := apis.NewK8sTestHelper(t, testinfra.GrafanaOpts{
AppModeProduction: false, // required for experimental APIs
DisableAnonymous: true,
DisableAnonymous: true,
EnableFeatureToggles: []string{
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // Required to start the example service
featuremgmt.FlagKubernetesDashboardsAPI,
featuremgmt.FlagKubernetesDashboards,
},
UnifiedStorageConfig: map[string]setting.UnifiedStorageConfig{
@@ -204,7 +199,7 @@ func TestIntegrationDashboardsApp(t *testing.T) {
AppModeProduction: false, // required for experimental APIs
DisableAnonymous: true,
EnableFeatureToggles: []string{
featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs, // Required to start the example service
featuremgmt.FlagKubernetesDashboardsAPI, // Required to start the example service
},
})