From 7dd4fbe3f5be15463c2d9511d89a13a115a99845 Mon Sep 17 00:00:00 2001 From: Arnob Kumar Saha Date: Fri, 10 Jan 2025 15:53:18 +0600 Subject: [PATCH] Pass different ca for gateway & inCluster (#1380) Signed-off-by: Arnob kumar saha --- .config/api-rules/violation_exceptions.list | 3 ++- apis/ui/v1alpha1/database_connection_types.go | 3 ++- apis/ui/v1alpha1/openapi_generated.go | 18 ++++++++++++------ apis/ui/v1alpha1/zz_generated.deepcopy.go | 15 ++++++++++----- crds/ui.kubedb.com_databaseconnections.yaml | 9 ++++++--- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/.config/api-rules/violation_exceptions.list b/.config/api-rules/violation_exceptions.list index c819ad2a9c..c49766fe50 100644 --- a/.config/api-rules/violation_exceptions.list +++ b/.config/api-rules/violation_exceptions.list @@ -49,13 +49,14 @@ API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,PodSpec,V API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,ServiceSpec,ExternalIPs API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,ServiceSpec,LoadBalancerSourceRanges API rule violation: list_type_missing,kmodules.xyz/offshoot-api/api/v1,ServiceSpec,Ports -API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,DatabaseConnectionSpec,CACert API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,DatabaseConnectionSpec,Databases API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,DatabaseConnectionSpec,Gateway API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,ElasticsearchNodesStatSpec,Roles API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,ElasticsearchNodesStatsSpec,Nodes API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,ElasticsearchSchemaOverviewSpec,Indices +API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,GatewayConnection,CACert API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,GenericSchemaOverviewSpec,Databases +API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,InClusterConnection,CACert API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,MariaDBQueriesSpec,Queries API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,MongoDBCollectionSpec,TotalSize API rule violation: list_type_missing,kubedb.dev/apimachinery/apis/ui/v1alpha1,MongoDBQueriesSpec,Queries diff --git a/apis/ui/v1alpha1/database_connection_types.go b/apis/ui/v1alpha1/database_connection_types.go index f62a5d4c7b..9112d4248c 100644 --- a/apis/ui/v1alpha1/database_connection_types.go +++ b/apis/ui/v1alpha1/database_connection_types.go @@ -61,7 +61,6 @@ type DatabaseConnectionSpec struct { // // And some language specific template strings. Like: Java, C#, Go, Python, Javascript, Ruby etc. ConnectOptions map[string]string `json:"connectOptions,omitempty"` - CACert []byte `json:"caCert,omitempty"` } //type ConnectOption struct { @@ -84,6 +83,7 @@ type DatabaseConnectionSpec struct { type GatewayConnection struct { *ofst.Gateway `json:",inline"` SecretRef *kmapi.ObjectReference `json:"secretRef,omitempty"` + CACert []byte `json:"caCert,omitempty"` } type InClusterConnection struct { @@ -93,6 +93,7 @@ type InClusterConnection struct { // Example: kubectl exec -it -n default service/mongo-test1 -c mongodb -- bash -c '' Exec string `json:"exec,omitempty"` SecretRef *kmapi.ObjectReference `json:"secretRef,omitempty"` + CACert []byte `json:"caCert,omitempty"` } // DatabaseConnectionList contains a list of DatabaseConnection diff --git a/apis/ui/v1alpha1/openapi_generated.go b/apis/ui/v1alpha1/openapi_generated.go index c39d5d2db9..7b887af500 100644 --- a/apis/ui/v1alpha1/openapi_generated.go +++ b/apis/ui/v1alpha1/openapi_generated.go @@ -25696,12 +25696,6 @@ func schema_apimachinery_apis_ui_v1alpha1_DatabaseConnectionSpec(ref common.Refe }, }, }, - "caCert": { - SchemaProps: spec.SchemaProps{ - Type: []string{"string"}, - Format: "byte", - }, - }, }, }, }, @@ -26445,6 +26439,12 @@ func schema_apimachinery_apis_ui_v1alpha1_GatewayConnection(ref common.Reference Ref: ref("kmodules.xyz/client-go/api/v1.ObjectReference"), }, }, + "caCert": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "byte", + }, + }, }, Required: []string{"name", "namespace"}, }, @@ -26542,6 +26542,12 @@ func schema_apimachinery_apis_ui_v1alpha1_InClusterConnection(ref common.Referen Ref: ref("kmodules.xyz/client-go/api/v1.ObjectReference"), }, }, + "caCert": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "byte", + }, + }, }, }, }, diff --git a/apis/ui/v1alpha1/zz_generated.deepcopy.go b/apis/ui/v1alpha1/zz_generated.deepcopy.go index e9b1c6fcf9..7de3b860b6 100644 --- a/apis/ui/v1alpha1/zz_generated.deepcopy.go +++ b/apis/ui/v1alpha1/zz_generated.deepcopy.go @@ -112,11 +112,6 @@ func (in *DatabaseConnectionSpec) DeepCopyInto(out *DatabaseConnectionSpec) { (*out)[key] = val } } - if in.CACert != nil { - in, out := &in.CACert, &out.CACert - *out = make([]byte, len(*in)) - copy(*out, *in) - } return } @@ -546,6 +541,11 @@ func (in *GatewayConnection) DeepCopyInto(out *GatewayConnection) { *out = new(apiv1.ObjectReference) **out = **in } + if in.CACert != nil { + in, out := &in.CACert, &out.CACert + *out = make([]byte, len(*in)) + copy(*out, *in) + } return } @@ -621,6 +621,11 @@ func (in *InClusterConnection) DeepCopyInto(out *InClusterConnection) { *out = new(apiv1.ObjectReference) **out = **in } + if in.CACert != nil { + in, out := &in.CACert, &out.CACert + *out = make([]byte, len(*in)) + copy(*out, *in) + } return } diff --git a/crds/ui.kubedb.com_databaseconnections.yaml b/crds/ui.kubedb.com_databaseconnections.yaml index 7af6c25e99..1c70ff8e6b 100644 --- a/crds/ui.kubedb.com_databaseconnections.yaml +++ b/crds/ui.kubedb.com_databaseconnections.yaml @@ -26,9 +26,6 @@ spec: type: object spec: properties: - caCert: - format: byte - type: string connectOptions: additionalProperties: type: string @@ -40,6 +37,9 @@ spec: gateway: items: properties: + caCert: + format: byte + type: string hostname: type: string ip: @@ -128,6 +128,9 @@ spec: type: array inCluster: properties: + caCert: + format: byte + type: string exec: type: string host: