mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
K8s: Restores: Put behind a feature toggle (#98472)
This commit is contained in:
parent
dc8e010cf3
commit
5429512779
@ -170,6 +170,7 @@ Experimental features might be changed or removed without prior notice.
|
|||||||
| `kubernetesSnapshots` | Routes snapshot requests from /api to the /apis endpoint |
|
| `kubernetesSnapshots` | Routes snapshot requests from /api to the /apis endpoint |
|
||||||
| `kubernetesDashboards` | Use the kubernetes API in the frontend for dashboards |
|
| `kubernetesDashboards` | Use the kubernetes API in the frontend for dashboards |
|
||||||
| `kubernetesCliDashboards` | Use the k8s client to retrieve dashboards internally |
|
| `kubernetesCliDashboards` | Use the k8s client to retrieve dashboards internally |
|
||||||
|
| `kubernetesRestore` | Allow restoring objects in k8s |
|
||||||
| `kubernetesFolders` | Use the kubernetes API in the frontend for folders, and route /api/folders requests to k8s |
|
| `kubernetesFolders` | Use the kubernetes API in the frontend for folders, and route /api/folders requests to k8s |
|
||||||
| `grafanaAPIServerTestingWithExperimentalAPIs` | Facilitate integration testing of experimental APIs |
|
| `grafanaAPIServerTestingWithExperimentalAPIs` | Facilitate integration testing of experimental APIs |
|
||||||
| `datasourceQueryTypes` | Show query type endpoints in datasource API servers (currently hardcoded for testdata, expressions, and prometheus) |
|
| `datasourceQueryTypes` | Show query type endpoints in datasource API servers (currently hardcoded for testdata, expressions, and prometheus) |
|
||||||
|
@ -111,6 +111,7 @@ export interface FeatureToggles {
|
|||||||
kubernetesSnapshots?: boolean;
|
kubernetesSnapshots?: boolean;
|
||||||
kubernetesDashboards?: boolean;
|
kubernetesDashboards?: boolean;
|
||||||
kubernetesCliDashboards?: boolean;
|
kubernetesCliDashboards?: boolean;
|
||||||
|
kubernetesRestore?: boolean;
|
||||||
kubernetesFolders?: boolean;
|
kubernetesFolders?: boolean;
|
||||||
grafanaAPIServerTestingWithExperimentalAPIs?: boolean;
|
grafanaAPIServerTestingWithExperimentalAPIs?: boolean;
|
||||||
datasourceQueryTypes?: boolean;
|
datasourceQueryTypes?: boolean;
|
||||||
|
@ -41,6 +41,7 @@ var (
|
|||||||
// This is used just so wire has something unique to return
|
// This is used just so wire has something unique to return
|
||||||
type DashboardsAPIBuilder struct {
|
type DashboardsAPIBuilder struct {
|
||||||
dashboardService dashboards.DashboardService
|
dashboardService dashboards.DashboardService
|
||||||
|
features featuremgmt.FeatureToggles
|
||||||
|
|
||||||
accessControl accesscontrol.AccessControl
|
accessControl accesscontrol.AccessControl
|
||||||
legacy *dashboard.DashboardStorage
|
legacy *dashboard.DashboardStorage
|
||||||
@ -69,6 +70,7 @@ func RegisterAPIService(cfg *setting.Cfg, features featuremgmt.FeatureToggles,
|
|||||||
log: log.New("grafana-apiserver.dashboards.v0alpha1"),
|
log: log.New("grafana-apiserver.dashboards.v0alpha1"),
|
||||||
|
|
||||||
dashboardService: dashboardService,
|
dashboardService: dashboardService,
|
||||||
|
features: features,
|
||||||
accessControl: accessControl,
|
accessControl: accessControl,
|
||||||
unified: unified,
|
unified: unified,
|
||||||
search: dashboard.NewSearchHandler(unified, tracing),
|
search: dashboard.NewSearchHandler(unified, tracing),
|
||||||
@ -157,18 +159,20 @@ func (b *DashboardsAPIBuilder) UpdateAPIGroupInfo(apiGroupInfo *genericapiserver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage[dash.StoragePath("restore")] = dashboard.NewRestoreConnector(
|
if b.features.IsEnabledGlobally(featuremgmt.FlagKubernetesRestore) {
|
||||||
b.unified,
|
storage[dash.StoragePath("restore")] = dashboard.NewRestoreConnector(
|
||||||
dashboardv0alpha1.DashboardResourceInfo.GroupResource(),
|
b.unified,
|
||||||
defaultOpts,
|
dashboardv0alpha1.DashboardResourceInfo.GroupResource(),
|
||||||
)
|
defaultOpts,
|
||||||
|
)
|
||||||
|
|
||||||
storage[dash.StoragePath("latest")] = dashboard.NewLatestConnector(
|
storage[dash.StoragePath("latest")] = dashboard.NewLatestConnector(
|
||||||
b.unified,
|
b.unified,
|
||||||
dashboardv0alpha1.DashboardResourceInfo.GroupResource(),
|
dashboardv0alpha1.DashboardResourceInfo.GroupResource(),
|
||||||
defaultOpts,
|
defaultOpts,
|
||||||
scheme,
|
scheme,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Register the DTO endpoint that will consolidate all dashboard bits
|
// Register the DTO endpoint that will consolidate all dashboard bits
|
||||||
storage[dash.StoragePath("dto")], err = dashboard.NewDTOConnector(
|
storage[dash.StoragePath("dto")], err = dashboard.NewDTOConnector(
|
||||||
|
@ -38,6 +38,7 @@ var (
|
|||||||
// This is used just so wire has something unique to return
|
// This is used just so wire has something unique to return
|
||||||
type DashboardsAPIBuilder struct {
|
type DashboardsAPIBuilder struct {
|
||||||
dashboardService dashboards.DashboardService
|
dashboardService dashboards.DashboardService
|
||||||
|
features featuremgmt.FeatureToggles
|
||||||
|
|
||||||
accessControl accesscontrol.AccessControl
|
accessControl accesscontrol.AccessControl
|
||||||
legacy *dashboard.DashboardStorage
|
legacy *dashboard.DashboardStorage
|
||||||
@ -65,6 +66,7 @@ func RegisterAPIService(cfg *setting.Cfg, features featuremgmt.FeatureToggles,
|
|||||||
log: log.New("grafana-apiserver.dashboards.v1alpha1"),
|
log: log.New("grafana-apiserver.dashboards.v1alpha1"),
|
||||||
|
|
||||||
dashboardService: dashboardService,
|
dashboardService: dashboardService,
|
||||||
|
features: features,
|
||||||
accessControl: accessControl,
|
accessControl: accessControl,
|
||||||
unified: unified,
|
unified: unified,
|
||||||
|
|
||||||
@ -148,18 +150,20 @@ func (b *DashboardsAPIBuilder) UpdateAPIGroupInfo(apiGroupInfo *genericapiserver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage[dash.StoragePath("restore")] = dashboard.NewRestoreConnector(
|
if b.features.IsEnabledGlobally(featuremgmt.FlagKubernetesRestore) {
|
||||||
b.unified,
|
storage[dash.StoragePath("restore")] = dashboard.NewRestoreConnector(
|
||||||
dashboardv1alpha1.DashboardResourceInfo.GroupResource(),
|
b.unified,
|
||||||
defaultOpts,
|
dashboardv1alpha1.DashboardResourceInfo.GroupResource(),
|
||||||
)
|
defaultOpts,
|
||||||
|
)
|
||||||
|
|
||||||
storage[dash.StoragePath("latest")] = dashboard.NewLatestConnector(
|
storage[dash.StoragePath("latest")] = dashboard.NewLatestConnector(
|
||||||
b.unified,
|
b.unified,
|
||||||
dashboardv1alpha1.DashboardResourceInfo.GroupResource(),
|
dashboardv1alpha1.DashboardResourceInfo.GroupResource(),
|
||||||
defaultOpts,
|
defaultOpts,
|
||||||
scheme,
|
scheme,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Register the DTO endpoint that will consolidate all dashboard bits
|
// Register the DTO endpoint that will consolidate all dashboard bits
|
||||||
storage[dash.StoragePath("dto")], err = dashboard.NewDTOConnector(
|
storage[dash.StoragePath("dto")], err = dashboard.NewDTOConnector(
|
||||||
|
@ -38,6 +38,7 @@ var (
|
|||||||
// This is used just so wire has something unique to return
|
// This is used just so wire has something unique to return
|
||||||
type DashboardsAPIBuilder struct {
|
type DashboardsAPIBuilder struct {
|
||||||
dashboardService dashboards.DashboardService
|
dashboardService dashboards.DashboardService
|
||||||
|
features featuremgmt.FeatureToggles
|
||||||
|
|
||||||
accessControl accesscontrol.AccessControl
|
accessControl accesscontrol.AccessControl
|
||||||
legacy *dashboard.DashboardStorage
|
legacy *dashboard.DashboardStorage
|
||||||
@ -65,6 +66,7 @@ func RegisterAPIService(cfg *setting.Cfg, features featuremgmt.FeatureToggles,
|
|||||||
log: log.New("grafana-apiserver.dashboards.v2alpha1"),
|
log: log.New("grafana-apiserver.dashboards.v2alpha1"),
|
||||||
|
|
||||||
dashboardService: dashboardService,
|
dashboardService: dashboardService,
|
||||||
|
features: features,
|
||||||
accessControl: accessControl,
|
accessControl: accessControl,
|
||||||
unified: unified,
|
unified: unified,
|
||||||
|
|
||||||
@ -148,18 +150,20 @@ func (b *DashboardsAPIBuilder) UpdateAPIGroupInfo(apiGroupInfo *genericapiserver
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
storage[dash.StoragePath("restore")] = dashboard.NewRestoreConnector(
|
if b.features.IsEnabledGlobally(featuremgmt.FlagKubernetesRestore) {
|
||||||
b.unified,
|
storage[dash.StoragePath("restore")] = dashboard.NewRestoreConnector(
|
||||||
dashboardv2alpha1.DashboardResourceInfo.GroupResource(),
|
b.unified,
|
||||||
defaultOpts,
|
dashboardv2alpha1.DashboardResourceInfo.GroupResource(),
|
||||||
)
|
defaultOpts,
|
||||||
|
)
|
||||||
|
|
||||||
storage[dash.StoragePath("latest")] = dashboard.NewLatestConnector(
|
storage[dash.StoragePath("latest")] = dashboard.NewLatestConnector(
|
||||||
b.unified,
|
b.unified,
|
||||||
dashboardv2alpha1.DashboardResourceInfo.GroupResource(),
|
dashboardv2alpha1.DashboardResourceInfo.GroupResource(),
|
||||||
defaultOpts,
|
defaultOpts,
|
||||||
scheme,
|
scheme,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Register the DTO endpoint that will consolidate all dashboard bits
|
// Register the DTO endpoint that will consolidate all dashboard bits
|
||||||
storage[dash.StoragePath("dto")], err = dashboard.NewDTOConnector(
|
storage[dash.StoragePath("dto")], err = dashboard.NewDTOConnector(
|
||||||
|
@ -1109,9 +1109,9 @@ func (dr *DashboardServiceImpl) getDashboardThroughK8s(ctx context.Context, quer
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// if including deleted dashboards, use the /latest subresource
|
// if including deleted dashboards for restore, use the /latest subresource
|
||||||
subresource := ""
|
subresource := ""
|
||||||
if query.IncludeDeleted {
|
if query.IncludeDeleted && dr.features.IsEnabledGlobally(featuremgmt.FlagKubernetesRestore) {
|
||||||
subresource = "latest"
|
subresource = "latest"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,6 +702,12 @@ var (
|
|||||||
Stage: FeatureStageExperimental,
|
Stage: FeatureStageExperimental,
|
||||||
Owner: grafanaAppPlatformSquad,
|
Owner: grafanaAppPlatformSquad,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "kubernetesRestore",
|
||||||
|
Description: "Allow restoring objects in k8s",
|
||||||
|
Stage: FeatureStageExperimental,
|
||||||
|
Owner: grafanaAppPlatformSquad,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "kubernetesFolders",
|
Name: "kubernetesFolders",
|
||||||
Description: "Use the kubernetes API in the frontend for folders, and route /api/folders requests to k8s",
|
Description: "Use the kubernetes API in the frontend for folders, and route /api/folders requests to k8s",
|
||||||
|
@ -92,6 +92,7 @@ kubernetesPlaylists,GA,@grafana/grafana-app-platform-squad,false,true,false
|
|||||||
kubernetesSnapshots,experimental,@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
|
kubernetesDashboards,experimental,@grafana/grafana-app-platform-squad,false,false,true
|
||||||
kubernetesCliDashboards,experimental,@grafana/grafana-app-platform-squad,false,false,false
|
kubernetesCliDashboards,experimental,@grafana/grafana-app-platform-squad,false,false,false
|
||||||
|
kubernetesRestore,experimental,@grafana/grafana-app-platform-squad,false,false,false
|
||||||
kubernetesFolders,experimental,@grafana/search-and-storage,false,false,false
|
kubernetesFolders,experimental,@grafana/search-and-storage,false,false,false
|
||||||
grafanaAPIServerTestingWithExperimentalAPIs,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
|
datasourceQueryTypes,experimental,@grafana/grafana-app-platform-squad,false,true,false
|
||||||
|
|
@ -379,6 +379,10 @@ const (
|
|||||||
// Use the k8s client to retrieve dashboards internally
|
// Use the k8s client to retrieve dashboards internally
|
||||||
FlagKubernetesCliDashboards = "kubernetesCliDashboards"
|
FlagKubernetesCliDashboards = "kubernetesCliDashboards"
|
||||||
|
|
||||||
|
// FlagKubernetesRestore
|
||||||
|
// Allow restoring objects in k8s
|
||||||
|
FlagKubernetesRestore = "kubernetesRestore"
|
||||||
|
|
||||||
// FlagKubernetesFolders
|
// FlagKubernetesFolders
|
||||||
// Use the kubernetes API in the frontend for folders, and route /api/folders requests to k8s
|
// Use the kubernetes API in the frontend for folders, and route /api/folders requests to k8s
|
||||||
FlagKubernetesFolders = "kubernetesFolders"
|
FlagKubernetesFolders = "kubernetesFolders"
|
||||||
|
@ -1940,6 +1940,19 @@
|
|||||||
"expression": "false"
|
"expression": "false"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"name": "kuberenetesRestore",
|
||||||
|
"resourceVersion": "1735880172453",
|
||||||
|
"creationTimestamp": "2025-01-03T04:56:12Z",
|
||||||
|
"deletionTimestamp": "2025-01-03T05:01:38Z"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"description": "Allow restoring objects in k8s",
|
||||||
|
"stage": "experimental",
|
||||||
|
"codeowner": "@grafana/grafana-app-platform-squad"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "kubernetesAggregator",
|
"name": "kubernetesAggregator",
|
||||||
@ -2028,6 +2041,18 @@
|
|||||||
"expression": "true"
|
"expression": "true"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"name": "kubernetesRestore",
|
||||||
|
"resourceVersion": "1735880498698",
|
||||||
|
"creationTimestamp": "2025-01-03T05:01:38Z"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"description": "Allow restoring objects in k8s",
|
||||||
|
"stage": "experimental",
|
||||||
|
"codeowner": "@grafana/grafana-app-platform-squad"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "kubernetesSnapshots",
|
"name": "kubernetesSnapshots",
|
||||||
|
Loading…
Reference in New Issue
Block a user