remove plugin
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type DataSourceConnection struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata,omitzero,omitempty"`
|
||||
|
||||
// The configured display name
|
||||
Title string `json:"title"`
|
||||
@@ -25,9 +25,6 @@ type DataSourceConnectionRef struct {
|
||||
Group string `json:"group"`
|
||||
Version string `json:"version"`
|
||||
Name string `json:"name"`
|
||||
|
||||
// The plugin -- NOTE, this has a 1:1 mapping with apiGroup and should likely be removed
|
||||
Plugin string `json:"plugin"`
|
||||
}
|
||||
|
||||
// The valid connection name for a group + identifier
|
||||
@@ -39,7 +36,7 @@ func DataSourceConnectionName(group, name string) string {
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type DataSourceConnectionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata,omitzero,omitempty"`
|
||||
|
||||
Items []DataSourceConnection `json:"items"`
|
||||
}
|
||||
@@ -61,7 +58,7 @@ type DataSourceApiServerRegistry interface {
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type DataSourceApiServer struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata,omitzero,omitempty"`
|
||||
|
||||
// The display name
|
||||
Title string `json:"title"`
|
||||
@@ -80,7 +77,7 @@ type DataSourceApiServer struct {
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type DataSourceApiServerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata,omitzero,omitempty"`
|
||||
|
||||
Items []DataSourceApiServer `json:"items"`
|
||||
}
|
||||
|
||||
@@ -276,16 +276,8 @@ func schema_pkg_apis_query_v0alpha1_DataSourceConnectionRef(ref common.Reference
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"plugin": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The plugin -- NOTE, this has a 1:1 mapping with apiGroup and should likely be removed",
|
||||
Default: "",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"group", "version", "name", "plugin"},
|
||||
Required: []string{"group", "version", "name"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
API rule violation: list_type_missing,github.com/grafana/grafana/pkg/apis/query/v0alpha1,DataSourceApiServer,AliasIDs
|
||||
API rule violation: streaming_list_type_json_tags,github.com/grafana/grafana/pkg/apis/query/v0alpha1,DataSourceApiServerList,ListMeta
|
||||
API rule violation: streaming_list_type_json_tags,github.com/grafana/grafana/pkg/apis/query/v0alpha1,DataSourceConnectionList,ListMeta
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/internalversion"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
|
||||
@@ -105,13 +104,13 @@ func (q *connectionsProvider) GetConnection(ctx context.Context, namespace strin
|
||||
}
|
||||
|
||||
func (q *connectionsProvider) ListConnections(ctx context.Context, namespace string) (*queryV0.DataSourceConnectionList, error) {
|
||||
info, err := authlib.ParseNamespace(namespace)
|
||||
ns, err := authlib.ParseNamespace(namespace)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dss, err := q.dsService.GetDataSources(ctx, &datasources.GetDataSourcesQuery{
|
||||
OrgID: info.OrgID,
|
||||
OrgID: ns.OrgID,
|
||||
DataSourceLimit: 10000,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -121,7 +120,6 @@ func (q *connectionsProvider) ListConnections(ctx context.Context, namespace str
|
||||
Items: []queryV0.DataSourceConnection{},
|
||||
}
|
||||
for _, ds := range dss {
|
||||
// TODO, access control?!
|
||||
v, err := q.asConnection(ds, namespace)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -134,12 +132,7 @@ func (q *connectionsProvider) ListConnections(ctx context.Context, namespace str
|
||||
func (q *connectionsProvider) asConnection(ds *datasources.DataSource, ns string) (v *queryV0.DataSourceConnection, err error) {
|
||||
gv, err := q.registry.GetDatasourceGroupVersion(ds.Type)
|
||||
if err != nil {
|
||||
// how does this happen? (grafana-e2etest-datasource)
|
||||
gv = schema.GroupVersion{
|
||||
Group: "unknown-" + ds.Type,
|
||||
Version: "unknown",
|
||||
}
|
||||
err = nil
|
||||
return nil, fmt.Errorf("datasource type %q does not map to an apiserver %w", ds.Type, err)
|
||||
}
|
||||
|
||||
v = &queryV0.DataSourceConnection{
|
||||
@@ -155,7 +148,6 @@ func (q *connectionsProvider) asConnection(ds *datasources.DataSource, ns string
|
||||
Group: gv.Group,
|
||||
Version: gv.Version,
|
||||
Name: ds.UID,
|
||||
Plugin: ds.Type,
|
||||
},
|
||||
}
|
||||
v.UID = gapiutil.CalculateClusterWideUID(v) // indicates if the value changed on the server
|
||||
|
||||
Reference in New Issue
Block a user