Skip to content

Commit

Permalink
feat: ycsb support multiple addr (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengluodb authored May 20, 2024
1 parent 96046d3 commit f0dff72
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions api/v1alpha1/ycsb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type YcsbSpec struct {
MasterName string `json:"masterName,omitempty"`
RedisSentinelUsername string `json:"redisSentinelUsername,omitempty"`
RedisSentinelPassword string `json:"redisSentinelPassword,omitempty"`
RedisAddr string `json:"redisAddr,omitempty"`

BenchCommon `json:",inline"`
}
Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/benchmark.apecloud.io_ycsbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ spec:
default: 10000
minimum: 1
type: integer
redisAddr:
type: string
redisMode:
type: string
redisSentinelPassword:
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/crds/benchmark.apecloud.io_ycsbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ spec:
default: 10000
minimum: 1
type: integer
redisAddr:
type: string
redisMode:
type: string
redisSentinelPassword:
Expand Down
6 changes: 3 additions & 3 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ image:
pullPolicy: IfNotPresent
registry: registry.cn-hangzhou.aliyuncs.com
# Overrides the image tag whose default is the chart appVersion.
tag: "0.0.8"
tag: "0.0.9"

imagePullSecrets: []
nameOverride: ""
Expand Down Expand Up @@ -91,5 +91,5 @@ kubebenchImages:
ycsb: "registry.cn-hangzhou.aliyuncs.com/apecloud/go-ycsb:latest"
fio: "registry.cn-hangzhou.aliyuncs.com/apecloud/fio:latest"
redisbench: "registry.cn-hangzhou.aliyuncs.com/apecloud/redis:7.0.5"
exporter: "registry.cn-hangzhou.aliyuncs.com/apecloud/kubebench:0.0.6"
tools: "registry.cn-hangzhou.aliyuncs.com/apecloud/kubebench:0.0.6"
exporter: "registry.cn-hangzhou.aliyuncs.com/apecloud/kubebench:0.0.9"
tools: "registry.cn-hangzhou.aliyuncs.com/apecloud/kubebench:0.0.9"
7 changes: 6 additions & 1 deletion internal/controller/ycsb_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,12 @@ func NewYcsbMysqlParams(cr *v1alpha1.Ycsb) string {
}

func NewYcsbRedisParams(cr *v1alpha1.Ycsb) string {
result := fmt.Sprintf("-p redis.addr=%s", fmt.Sprintf("%s:%d", cr.Spec.Target.Host, cr.Spec.Target.Port))
result := ""
if cr.Spec.RedisAddr != "" {
result = fmt.Sprintf("-p redis.addr='%s'", cr.Spec.RedisAddr)
} else {
result = fmt.Sprintf("-p redis.addr='%s'", fmt.Sprintf("%s:%d", cr.Spec.Target.Host, cr.Spec.Target.Port))
}
if cr.Spec.Target.User != "" {
result = fmt.Sprintf("%s -p redis.username=%s", result, cr.Spec.Target.User)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/constants/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func init() {
viper.SetDefault(KubebenchEnvYcsb, "registry.cn-hangzhou.aliyuncs.com/apecloud/go-ycsb:latest")
viper.SetDefault(KubebenchEnvFio, "registry.cn-hangzhou.aliyuncs.com/apecloud/fio:latest")
viper.SetDefault(KubebenchEnvRedisBench, "registry.cn-hangzhou.aliyuncs.com/apecloud/redis:7.0.5")
viper.SetDefault(KubebenchExporter, "registry.cn-hangzhou.aliyuncs.com/apecloud/kubebench:0.0.6")
viper.SetDefault(KubebenchTools, "registry.cn-hangzhou.aliyuncs.com/apecloud/kubebench:0.0.6")
viper.SetDefault(KubebenchExporter, "registry.cn-hangzhou.aliyuncs.com/apecloud/kubebench:0.0.9")
viper.SetDefault(KubebenchTools, "registry.cn-hangzhou.aliyuncs.com/apecloud/kubebench:0.0.9")
}

// GetBenchmarkImage get benchmark image
Expand Down

0 comments on commit f0dff72

Please sign in to comment.