fix(region): vendor update for sync mongodb ip addr (#22816)

This commit is contained in:
屈轩
2025-07-03 05:32:34 +08:00
committed by GitHub
parent e01b4e2468
commit 5537fcf7be
6 changed files with 43 additions and 9 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ require (
k8s.io/cri-api v0.22.17
k8s.io/klog/v2 v2.20.0
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250702103535-3b73951ea9d1
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250702132657-37b1f1b0b8bd
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
+2 -2
View File
@@ -1406,8 +1406,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250702103535-3b73951ea9d1 h1:OkXSEynpcz9DmsT7LHbmn+oK7N4B5fOQGxG7S4GQCTI=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250702103535-3b73951ea9d1/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250702132657-37b1f1b0b8bd h1:rSW+0utEdUqU76aD5PjvWPSRqr9bwdLprLb5wIsK8K8=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250702132657-37b1f1b0b8bd/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0 h1:msG4SiDSVU7CrXH06WuHlNEZXIooTcmNbfrIGHuIHBU=
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
+2 -2
View File
@@ -91,13 +91,13 @@ type SElasticSearch struct {
// 存储类型
// example: local_ssd
StorageType string `nullable:"false" list:"user" create:"required"`
StorageType string `width:"16" charset:"utf8" nullable:"false" list:"user" create:"required"`
// 存储大小
// example: 1024
DiskSizeGb int `nullable:"false" list:"user" create:"required"`
// 实例类型
// example: ha
Category string `nullable:"false" list:"user" create:"optional"`
Category string `width:"16" charset:"ascii" nullable:"false" list:"user" create:"optional"`
VpcId string `width:"36" charset:"ascii" nullable:"true" list:"user" create:"optional" json:"vpc_id"`
NetworkId string `width:"36" charset:"ascii" nullable:"true" list:"user" create:"optional" json:"network_id"`
+2 -2
View File
@@ -94,7 +94,7 @@ type SMongoDB struct {
Port int `nullable:"false" list:"user" create:"optional"`
// 实例类型
// example: ha
Category string `nullable:"false" list:"user" create:"optional"`
Category string `width:"16" charset:"ascii" nullable:"false" list:"user" create:"optional"`
// 分片数量
// example: 3
@@ -105,7 +105,7 @@ type SMongoDB struct {
Iops int `nullable:"true" list:"user" create:"optional"`
// 实例IP地址
IpAddr string `nullable:"false" list:"user"`
IpAddr string `width:"32" charset:"ascii" nullable:"true" list:"user"`
// 引擎
// example: MySQL
+1 -1
View File
@@ -1849,7 +1849,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.2.0
## explicit; go 1.12
sigs.k8s.io/yaml
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250702103535-3b73951ea9d1
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250702132657-37b1f1b0b8bd
## explicit; go 1.21
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
+35 -1
View File
@@ -149,7 +149,15 @@ func (self *SMongoDB) GetExpiredAt() time.Time {
}
func (self *SMongoDB) GetIpAddr() string {
return ""
nets, err := self.region.DescribeShardingNetworkAddress(self.DBInstanceId)
if err != nil {
return ""
}
ret := []string{}
for _, n := range nets {
ret = append(ret, n.IPAddress)
}
return strings.Join(ret, ",")
}
func (self *SMongoDB) GetEngine() string {
@@ -508,6 +516,32 @@ func getMongoDBSkuDetails(remark string) struct {
return ret
}
type SMongoDBNetworkAddress struct {
IPAddress string
NetworkAddress string
NetworkType string
Port int
Role string
VpcId string
VswitchId string
}
func (region *SRegion) DescribeShardingNetworkAddress(id string) ([]SMongoDBNetworkAddress, error) {
params := map[string]string{
"DBInstanceId": id,
}
resp, err := region.mongodbRequest("DescribeShardingNetworkAddress", params)
if err != nil {
return nil, errors.Wrapf(err, "DescribeAvailableResource")
}
ret := []SMongoDBNetworkAddress{}
err = resp.Unmarshal(&ret, "NetworkAddresses", "NetworkAddress")
if err != nil {
return nil, err
}
return ret, nil
}
func (self *SRegion) GetMongoDBAvailableResource() (*SMongoDBAvaibaleResource, error) {
params := map[string]string{}
resp, err := self.mongodbRequest("DescribeAvailableResource", params)