Revert "Revert: DataSource: Support config CRUD from apiservers (#106996) (#110342)"

This reverts commit 72eeefabd7.
This commit is contained in:
beejeebus
2025-10-07 14:31:07 -04:00
committed by beejeebus
parent 84a2f41016
commit c3f34efb41
58 changed files with 2039 additions and 471 deletions
+9 -13
View File
@@ -6,19 +6,17 @@ import (
"fmt"
"net/http"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/registry/rest"
"github.com/grafana/grafana-plugin-sdk-go/backend"
data "github.com/grafana/grafana-plugin-sdk-go/experimental/apis/data/v0alpha1"
"github.com/grafana/grafana/pkg/apimachinery/errutil"
query "github.com/grafana/grafana/pkg/apis/query/v0alpha1"
query_headers "github.com/grafana/grafana/pkg/registry/apis/query"
"github.com/grafana/grafana/pkg/services/datasources"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/registry/rest"
"github.com/grafana/grafana/pkg/web"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
)
type subQueryREST struct {
@@ -29,6 +27,7 @@ var (
_ rest.Storage = (*subQueryREST)(nil)
_ rest.Connecter = (*subQueryREST)(nil)
_ rest.StorageMetadata = (*subQueryREST)(nil)
_ rest.Scoper = (*subQueryREST)(nil)
)
func (r *subQueryREST) New() runtime.Object {
@@ -38,6 +37,10 @@ func (r *subQueryREST) New() runtime.Object {
func (r *subQueryREST) Destroy() {}
func (r *subQueryREST) NamespaceScoped() bool {
return true
}
func (r *subQueryREST) ProducesMIMETypes(verb string) []string {
return []string{"application/json"} // and parquet!
}
@@ -59,15 +62,8 @@ func (r *subQueryREST) Connect(ctx context.Context, name string, opts runtime.Ob
if err != nil {
if errors.Is(err, datasources.ErrDataSourceNotFound) {
return nil, k8serrors.NewNotFound(
schema.GroupResource{
Group: r.builder.connectionResourceInfo.GroupResource().Group,
Resource: r.builder.connectionResourceInfo.GroupResource().Resource,
},
name,
)
return nil, r.builder.datasourceResourceInfo.NewNotFound(name)
}
return nil, err
}