Skip to content

Commit eb03deb

Browse files
Add DatabaseInfo api (#1557)
Signed-off-by: Tamal Saha <[email protected]> Signed-off-by: Arnob kumar saha <[email protected]> Co-authored-by: Tamal Saha <[email protected]>
1 parent 72d44c3 commit eb03deb

File tree

153 files changed

+15402
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+15402
-175
lines changed

.config/api-rules/violation_exceptions.list

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,ServiceSp
5252
API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,ServiceSpec,Ports
5353
API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,DatabaseConnectionSpec,Databases
5454
API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,DatabaseConnectionSpec,Public
55+
API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,DatabaseInfoRequest,Keys
56+
API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,DatabaseInfoResponse,AvailableSecrets
57+
API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,DatabaseInfoResponse,Configurations
5558
API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,ElasticsearchNodesStatSpec,Roles
5659
API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,ElasticsearchNodesStatsSpec,Nodes
5760
API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,ElasticsearchSchemaOverviewSpec,Indices

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,4 +439,4 @@ ci: verify check-license lint build unit-tests #cover
439439

440440
.PHONY: clean
441441
clean:
442-
rm -rf .go bin
442+
rm -rf .go bin

apis/ui/v1alpha1/database_connection_types.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ const (
3030
ResourceDatabaseConnections = "databaseconnections"
3131
)
3232

33+
// +genclient
34+
// +k8s:openapi-gen=true
3335
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
3436
type DatabaseConnection struct {
3537
metav1.TypeMeta `json:",inline"`
@@ -39,8 +41,6 @@ type DatabaseConnection struct {
3941
Status dbapi.MariaDBStatus `json:"status,omitempty"`
4042
}
4143

42-
// TODO: Need to pass the Type information in the ObjectMeta. For example: MongoDB, MySQL etc.
43-
4444
// DatabaseConnectionSpec defines the desired state of DatabaseConnection
4545
type DatabaseConnectionSpec struct {
4646
Public []PublicInfo `json:"public,omitempty"`
@@ -91,7 +91,3 @@ type DatabaseConnectionList struct {
9191
metav1.ListMeta `json:"metadata,omitempty"`
9292
Items []DatabaseConnection `json:"items"`
9393
}
94-
95-
func init() {
96-
SchemeBuilder.Register(&DatabaseConnection{}, &DatabaseConnectionList{})
97-
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
Copyright AppsCode Inc. and Contributors
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
kmapi "kmodules.xyz/client-go/api/v1"
22+
)
23+
24+
const (
25+
ResourceKindDatabaseInfo = "DatabaseInfo"
26+
ResourceDatabaseInfo = "databaseinfo"
27+
ResourceDatabaseInfos = "databaseinfos"
28+
)
29+
30+
// +genclient
31+
// +genclient:nonNamespaced
32+
// +genclient:skipVerbs=get,list,update,delete,watch
33+
// +genclient:onlyVerbs=create
34+
// +k8s:openapi-gen=true
35+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
36+
37+
// +kubebuilder:object:root=true
38+
// +kubebuilder:resource:path=databaseinfos,singular=databaseinfo,scope=Cluster
39+
type DatabaseInfo struct {
40+
metav1.TypeMeta `json:",inline"`
41+
// Request describes the attributes for the graph request.
42+
// +optional
43+
Request *DatabaseInfoRequest `json:"request,omitempty"`
44+
// Response describes the attributes for the graph response.
45+
// +optional
46+
Response *DatabaseInfoResponse `json:"response,omitempty"`
47+
}
48+
49+
type DatabaseInfoRequest struct {
50+
Source kmapi.ObjectInfo `json:"source"`
51+
Keys []string `json:"keys,omitempty"`
52+
}
53+
54+
type DatabaseInfoResponse struct {
55+
Configurations []SingleComponentConfiguration `json:"configurations,omitempty"`
56+
AvailableSecrets []string `json:"availableSecrets,omitempty"`
57+
}
58+
59+
type SingleComponentConfiguration struct {
60+
// +optional
61+
ComponentName string `json:"componentName,omitempty"`
62+
Data map[string][]byte `json:"data,omitempty"`
63+
// +optional
64+
SecretName string `json:"secretName,omitempty"`
65+
// +optional
66+
ApplyConfig map[string]string `json:"applyConfig,omitempty"`
67+
}

apis/ui/v1alpha1/elasticsearch_insight_types.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ type ElasticsearchClusterHealth struct {
5353
TaskMaxWaitingInQueueMilliSeconds *float64 `json:"taskMaxWaitingInQueueMilliSeconds,omitempty"`
5454
}
5555

56-
// ElasticsearchInsight is the Schema for the elasticsearchinsights API
56+
// ElasticsearchInsight is the Schema for the Elasticsearch insight api
5757

58+
// +genclient
59+
// +k8s:openapi-gen=true
5860
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
5961
type ElasticsearchInsight struct {
6062
metav1.TypeMeta `json:",inline"`
@@ -72,7 +74,3 @@ type ElasticsearchInsightList struct {
7274
metav1.ListMeta `json:"metadata,omitempty"`
7375
Items []ElasticsearchInsight `json:"items"`
7476
}
75-
76-
func init() {
77-
SchemeBuilder.Register(&ElasticsearchInsight{}, &ElasticsearchInsightList{})
78-
}

apis/ui/v1alpha1/elasticsearch_nodes_stats_types.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ type ElasticsearchNodesStatsStatus struct {
298298

299299
// ElasticsearchNodesStats is the Schema for the ElasticsearchNodesStats API
300300

301+
// +genclient
302+
// +k8s:openapi-gen=true
301303
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
302304
type ElasticsearchNodesStats struct {
303305
metav1.TypeMeta `json:",inline"`
@@ -315,7 +317,3 @@ type ElasticsearchNodesStatsList struct {
315317
metav1.ListMeta `json:"metadata,omitempty"`
316318
Items []ElasticsearchNodesStats `json:"items"`
317319
}
318-
319-
func init() {
320-
SchemeBuilder.Register(&ElasticsearchNodesStats{}, &ElasticsearchNodesStatsList{})
321-
}

apis/ui/v1alpha1/elasticsearch_schema_overview_types.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ type ElasticsearchIndexSpec struct {
3939

4040
// ElasticsearchSchemaOverview is the Schema for the elasticsearchindices API
4141

42+
// +genclient
43+
// +k8s:openapi-gen=true
4244
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
4345
type ElasticsearchSchemaOverview struct {
4446
metav1.TypeMeta `json:",inline"`
@@ -55,7 +57,3 @@ type ElasticsearchSchemaOverviewList struct {
5557
metav1.ListMeta `json:"metadata,omitempty"`
5658
Items []ElasticsearchSchemaOverview `json:"items"`
5759
}
58-
59-
func init() {
60-
SchemeBuilder.Register(&ElasticsearchSchemaOverview{}, &ElasticsearchSchemaOverviewList{})
61-
}

apis/ui/v1alpha1/groupversion_info.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

apis/ui/v1alpha1/mariadb_insight_types.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ type MariaDBInsightSpec struct {
4646
ThreadsRunning *int32 `json:"threadsRunning,omitempty"`
4747
}
4848

49-
// MariaDBInsight is the Schema for the mariaDBinsights API
49+
// MariaDBInsight is the Schema for the MariaDBInsights API
5050

51+
// +genclient
52+
// +k8s:openapi-gen=true
5153
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
5254
type MariaDBInsight struct {
5355
metav1.TypeMeta `json:",inline"`
@@ -65,7 +67,3 @@ type MariaDBInsightList struct {
6567
metav1.ListMeta `json:"metadata,omitempty"`
6668
Items []MariaDBInsight `json:"items"`
6769
}
68-
69-
func init() {
70-
SchemeBuilder.Register(&MariaDBInsight{}, &MariaDBInsightList{})
71-
}

apis/ui/v1alpha1/mariadb_queries_types.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ type MariaDBQuerySpec struct {
4949

5050
// MariaDBQueries is the Schema for the mariadbslowqueries API
5151

52+
// +genclient
53+
// +k8s:openapi-gen=true
5254
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
5355
type MariaDBQueries struct {
5456
metav1.TypeMeta `json:",inline"`
@@ -65,7 +67,3 @@ type MariaDBQueriesList struct {
6567
metav1.ListMeta `json:"metadata,omitempty"`
6668
Items []MariaDBQueries `json:"items"`
6769
}
68-
69-
func init() {
70-
SchemeBuilder.Register(&MariaDBQueries{}, &MariaDBQueriesList{})
71-
}

0 commit comments

Comments
 (0)