@@ -32,8 +32,6 @@ import (
3232 "time"
3333
3434 driver "github.com/arangodb/go-driver"
35- vst "github.com/arangodb/go-driver/vst"
36- vstProtocol "github.com/arangodb/go-driver/vst/protocol"
3735 "github.com/arangodb/go-driver/agency"
3836 "github.com/arangodb/go-driver/http"
3937 "github.com/arangodb/go-driver/jwt"
@@ -102,10 +100,10 @@ func CreateArangodClient(ctx context.Context, cli corev1.CoreV1Interface, apiObj
102100}
103101
104102// CreateArangodDatabaseClient creates a go-driver client for accessing the entire cluster (or single server).
105- func CreateArangodDatabaseClient (ctx context.Context , cli corev1.CoreV1Interface , apiObject * api.ArangoDeployment , useVst ... bool ) (driver.Client , error ) {
103+ func CreateArangodDatabaseClient (ctx context.Context , cli corev1.CoreV1Interface , apiObject * api.ArangoDeployment ) (driver.Client , error ) {
106104 // Create connection
107105 dnsName := k8sutil .CreateDatabaseClientServiceDNSName (apiObject )
108- c , err := createArangodClientForDNSName (ctx , cli , apiObject , dnsName , useVst ... )
106+ c , err := createArangodClientForDNSName (ctx , cli , apiObject , dnsName )
109107 if err != nil {
110108 return nil , maskAny (err )
111109 }
@@ -157,36 +155,21 @@ func CreateArangodImageIDClient(ctx context.Context, deployment k8sutil.APIObjec
157155}
158156
159157// CreateArangodClientForDNSName creates a go-driver client for a given DNS name.
160- func createArangodClientForDNSName (ctx context.Context , cli corev1.CoreV1Interface , apiObject * api.ArangoDeployment , dnsName string , useVst ... bool ) (driver.Client , error ) {
161- config := driver.ClientConfig {}
162- var conn driver.Connection
163- if len (useVst ) > 0 && useVst [0 ] {
164- connConfig , err := createArangodVSTConfigForDNSNames (ctx , cli , apiObject , []string {dnsName })
165- if err != nil {
166- return nil , maskAny (err )
167- }
168- // TODO deal with TLS with proper CA checking
169- conn , err = vst .NewConnection (connConfig )
170- if err != nil {
171- return nil , maskAny (err )
172- }
173- } else {
174- connConfig , err := createArangodHTTPConfigForDNSNames (ctx , cli , apiObject , []string {dnsName })
175- if err != nil {
176- return nil , maskAny (err )
177- }
178- // TODO deal with TLS with proper CA checking
179- conn , err = http .NewConnection (connConfig )
180- if err != nil {
181- return nil , maskAny (err )
182- }
158+ func createArangodClientForDNSName (ctx context.Context , cli corev1.CoreV1Interface , apiObject * api.ArangoDeployment , dnsName string ) (driver.Client , error ) {
159+ connConfig , err := createArangodHTTPConfigForDNSNames (ctx , cli , apiObject , []string {dnsName })
160+ if err != nil {
161+ return nil , maskAny (err )
162+ }
163+ // TODO deal with TLS with proper CA checking
164+ conn , err := http .NewConnection (connConfig )
165+ if err != nil {
166+ return nil , maskAny (err )
183167 }
184168
185169 // Create client
186- config = driver.ClientConfig {
170+ config : = driver.ClientConfig {
187171 Connection : conn ,
188172 }
189-
190173 auth , err := createArangodClientAuthentication (ctx , cli , apiObject )
191174 if err != nil {
192175 return nil , maskAny (err )
@@ -217,27 +200,6 @@ func createArangodHTTPConfigForDNSNames(ctx context.Context, cli corev1.CoreV1In
217200 return connConfig , nil
218201}
219202
220- // createArangodVSTConfigForDNSNames creates a go-driver VST connection config for a given DNS names.
221- func createArangodVSTConfigForDNSNames (ctx context.Context , cli corev1.CoreV1Interface , apiObject * api.ArangoDeployment , dnsNames []string ) (vst.ConnectionConfig , error ) {
222- scheme := "http"
223- tlsConfig := & tls.Config {InsecureSkipVerify : true }
224- if apiObject != nil && apiObject .Spec .IsSecure () {
225- scheme = "https"
226- tlsConfig = & tls.Config {}
227- }
228- transport := vstProtocol.TransportConfig {
229- Version : vstProtocol .Version1_1 ,
230- }
231- connConfig := vst.ConnectionConfig {
232- TLSConfig : tlsConfig ,
233- Transport : transport ,
234- }
235- for _ , dnsName := range dnsNames {
236- connConfig .Endpoints = append (connConfig .Endpoints , scheme + "://" + net .JoinHostPort (dnsName , strconv .Itoa (k8sutil .ArangoPort )))
237- }
238- return connConfig , nil
239- }
240-
241203// createArangodClientAuthentication creates a go-driver authentication for the servers in the given deployment.
242204func createArangodClientAuthentication (ctx context.Context , cli corev1.CoreV1Interface , apiObject * api.ArangoDeployment ) (driver.Authentication , error ) {
243205 if apiObject != nil && apiObject .Spec .IsAuthenticated () {
0 commit comments