Skip to content

Commit f70a387

Browse files
authored
Update ignite client (#188)
Signed-off-by: Muhammad Raisul Islam Evan <raisul@appscode.com>
1 parent e73f8f6 commit f70a387

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ require (
3737
k8s.io/klog/v2 v2.130.1
3838
kmodules.xyz/client-go v0.32.6
3939
kmodules.xyz/custom-resources v0.32.0
40-
kubedb.dev/apimachinery v0.56.0
40+
kubedb.dev/apimachinery v0.56.1-0.20250718121809-af2b0a656c75
4141
sigs.k8s.io/controller-runtime v0.20.4
4242
xorm.io/xorm v1.3.9
4343
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ kmodules.xyz/monitoring-agent-api v0.32.0 h1:cMQbWvbTc4JWeLI/zYE0HLefsdFYBzqvATL
546546
kmodules.xyz/monitoring-agent-api v0.32.0/go.mod h1:zgRKiJcuK7FOHy0Y1TsONRbJfgnPCs8t4Zh/6Afr+yU=
547547
kmodules.xyz/offshoot-api v0.32.0 h1:gogc5scSZe2JoXtZof72UGRl3Tit0kFaFRMkLLT1D8o=
548548
kmodules.xyz/offshoot-api v0.32.0/go.mod h1:tled7OxYZ3SkUJcrVFVVYyd+zXjsRSEm1R6Q3k4gcx0=
549-
kubedb.dev/apimachinery v0.56.0 h1:3vOdnv03sQiDJ17w25gsu+1acAUB5PLq/1oBhEsLuno=
550-
kubedb.dev/apimachinery v0.56.0/go.mod h1:Iw40Vbo63tNqgQA5pTue0WHBvPaxWsJy6MEWfZmACQw=
549+
kubedb.dev/apimachinery v0.56.1-0.20250718121809-af2b0a656c75 h1:KSIEzP4RUuMQ63mWBKQ8Tkth4jh+31Borcy3lWetcnQ=
550+
kubedb.dev/apimachinery v0.56.1-0.20250718121809-af2b0a656c75/go.mod h1:Iw40Vbo63tNqgQA5pTue0WHBvPaxWsJy6MEWfZmACQw=
551551
kubeops.dev/petset v0.0.10 h1:sNaqmHrD9bW7pcrWnwPoiQrKvdRwRX0BaRQc5QA78Bg=
552552
kubeops.dev/petset v0.0.10/go.mod h1:uHL83kggwmtSxdlIfxNbY2isV22iYV6YjADv0y+Z7YA=
553553
kubeops.dev/sidekick v0.0.11 h1:OydXdIH6cYSiWxKIWvrywk95WhhHSERkc7RNPOmTekc=

ignite/kubedb_client_builder.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import (
3737
"sigs.k8s.io/controller-runtime/pkg/client"
3838
)
3939

40+
const Public_Cache_Name = "PUBLIC"
41+
4042
type KubeDBClientBuilder struct {
4143
kc client.Client
4244
db *api.Ignite
@@ -79,7 +81,7 @@ func (o *KubeDBClientBuilder) WithTimeout(d time.Duration) *KubeDBClientBuilder
7981
return o
8082
}
8183

82-
func (o *KubeDBClientBuilder) GetIgniteBinaryClient() (*BinaryClient, error) {
84+
func (o *KubeDBClientBuilder) GetIgniteConnectionInfo() ignite.ConnInfo {
8385
igniteConnectionInfo := ignite.ConnInfo{
8486
Network: "tcp",
8587
Host: o.Address(),
@@ -91,8 +93,14 @@ func (o *KubeDBClientBuilder) GetIgniteBinaryClient() (*BinaryClient, error) {
9193
Timeout: o.timeout,
9294
},
9395
}
96+
return igniteConnectionInfo
97+
}
98+
99+
func (o *KubeDBClientBuilder) GetIgniteBinaryClient() (*BinaryClient, error) {
100+
igniteConnectionInfo := o.GetIgniteConnectionInfo()
101+
94102
if !o.db.Spec.DisableSecurity {
95-
err, username, password := o.getUsernamePassword()
103+
err, username, password := o.GetUsernamePassword()
96104
if err != nil {
97105
return nil, err
98106
}
@@ -123,14 +131,19 @@ func (o *KubeDBClientBuilder) GetIgniteBinaryClient() (*BinaryClient, error) {
123131
}, nil
124132
}
125133

126-
func (o *KubeDBClientBuilder) GetIgniteSqlClient() (*SqlClient, error) {
134+
func (o *KubeDBClientBuilder) GetIgniteDataSource() string {
127135
dataSource := fmt.Sprintf(
128136
"tcp://%s:%d/PUBLIC?version=1.1.0"+
129137
"&timeout=%d",
130138
o.Address(), kubedb.IgniteThinPort, o.timeout)
139+
return dataSource
140+
}
141+
142+
func (o *KubeDBClientBuilder) GetIgniteSqlClient() (*SqlClient, error) {
143+
dataSource := o.GetIgniteDataSource()
131144

132145
if !o.db.Spec.DisableSecurity {
133-
err, username, password := o.getUsernamePassword()
146+
err, username, password := o.GetUsernamePassword()
134147
if err != nil {
135148
return nil, nil
136149
}
@@ -155,7 +168,7 @@ func (o *KubeDBClientBuilder) GetIgniteSqlClient() (*SqlClient, error) {
155168
}, nil
156169
}
157170

158-
func (o *KubeDBClientBuilder) getUsernamePassword() (error, string, string) {
171+
func (o *KubeDBClientBuilder) GetUsernamePassword() (error, string, string) {
159172
authSecret := &core.Secret{}
160173

161174
err := o.kc.Get(o.ctx, types.NamespacedName{
@@ -174,7 +187,7 @@ func (o *KubeDBClientBuilder) getUsernamePassword() (error, string, string) {
174187

175188
func (igBin *BinaryClient) CreateCache(cacheName string) error {
176189
// create cache
177-
if err := igBin.CacheCreateWithName(cacheName); err != nil {
190+
if err := igBin.CacheGetOrCreateWithName(cacheName); err != nil {
178191
klog.Error(err, "failed to create cache: %v")
179192
return err
180193
}

vendor/kubedb.dev/apimachinery/apis/kubedb/constants.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,9 +1512,8 @@ const (
15121512
IgniteInitScriptDir = "/scripts"
15131513
IgniteConfigVolName = "ignite-config"
15141514
IgniteWorkVolName = "ignite-work"
1515+
IgniteWorkVolPath = "/opt/ignite/apache-ignite/work"
15151516
IgniteConfigFileName = "node-configuration.xml"
1516-
IgniteDataVolName = "data"
1517-
IgniteDataDir = "/ignite/data"
15181517
IgniteContainerName = "ignite"
15191518
IgniteConfigDir = "/ignite/config"
15201519
IgniteRestPortName = "rest"

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1784,7 +1784,7 @@ kmodules.xyz/offshoot-api/api/v1
17841784
kmodules.xyz/offshoot-api/api/v1/conversion
17851785
kmodules.xyz/offshoot-api/api/v2
17861786
kmodules.xyz/offshoot-api/util
1787-
# kubedb.dev/apimachinery v0.56.0
1787+
# kubedb.dev/apimachinery v0.56.1-0.20250718121809-af2b0a656c75
17881788
## explicit; go 1.23.0
17891789
kubedb.dev/apimachinery/apis
17901790
kubedb.dev/apimachinery/apis/catalog

0 commit comments

Comments
 (0)