Skip to content

Commit

Permalink
fix(dbm-services): 模拟执行拉起8.0MySQL,修改默认认证插件 TencentBlueKing#8060
Browse files Browse the repository at this point in the history
  • Loading branch information
ymakedaq committed Nov 21, 2024
1 parent 481f440 commit d517543
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
10 changes: 9 additions & 1 deletion dbm-services/mysql/db-simulation/app/service/kubernets.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ func (k *DbPodSets) getCreateClusterSqls() []string {
return ss
}

// getClusterPodContanierSpec create cluster pod container spec
// nolint
func (k *DbPodSets) getClusterPodContanierSpec() []v1.Container {
return []v1.Container{
{
Expand All @@ -135,6 +137,8 @@ func (k *DbPodSets) getClusterPodContanierSpec() []v1.Container {
"--log_bin_trust_function_creators",
"--port=20000",
"--max_allowed_packet=1073741824",
"--default-authentication-plugin=mysql_native_password",
"--sql-mode=",
fmt.Sprintf("--character-set-server=%s",
k.BaseInfo.Charset),
"--user=mysql"},
Expand Down Expand Up @@ -351,7 +355,11 @@ func (k *DbPodSets) gettdbctlResourceLimit() v1.ResourceRequirements {

// CreateMySQLPod create mysql pod
func (k *DbPodSets) CreateMySQLPod() (err error) {
startArgs := []string{"--defaults-file=/etc/my.cnf", "--skip-log-bin", "--max_allowed_packet=1073741824",
startArgs := []string{
"--defaults-file=/etc/my.cnf",
"--skip-log-bin",
"--max_allowed_packet=1073741824",
"--default-authentication-plugin=mysql_native_password",
fmt.Sprintf("--character-set-server=%s", k.BaseInfo.Charset)}
startArgs = append(startArgs, k.BaseInfo.Args...)
startArgs = append(startArgs, "--user=mysql")
Expand Down
14 changes: 10 additions & 4 deletions dbm-services/mysql/db-simulation/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ type Response struct {

// CreateClusterParam 创建临时的spider的集群参数
type CreateClusterParam struct {
Pwd string `json:"pwd"`
PodName string `json:"podname"`
SpiderVersion string `json:"spider_version"`
Pwd string `json:"pwd"`
PodName string `json:"podname"`
SpiderVersion string `json:"spider_version"`
BackendVersion string `json:"backend_version"`
}

// CreateTmpSpiderPodCluster 创建临时的spider的集群,多用于测试,debug
Expand All @@ -55,7 +56,12 @@ func CreateTmpSpiderPodCluster(r *gin.Context) {
RootPwd: param.Pwd,
Charset: "utf8mb4",
}
ps.DbImage = config.GAppConfig.Image.Tendb57Img
var err error
ps.DbImage, err = getImgFromMySQLVersion(param.BackendVersion)
if err != nil {
logger.Error(err.Error())
return
}
ps.SpiderImage, ps.TdbCtlImage = getSpiderAndTdbctlImg(param.SpiderVersion, LatestVersion)
if err := ps.CreateClusterPod(); err != nil {
logger.Error(err.Error())
Expand Down

0 comments on commit d517543

Please sign in to comment.