fix(region): hcs vpc emulated (#15478)

This commit is contained in:
屈轩
2022-12-02 10:08:44 +08:00
committed by GitHub
parent 6c10a39bb3
commit 380037f19c
11 changed files with 26 additions and 6 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ require (
k8s.io/client-go v0.19.3
k8s.io/cluster-bootstrap v0.19.3
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221130104643-41851efdcf63
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221201121456-cf1db7634925
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656
yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd
yunion.io/x/log v1.0.0
+2 -2
View File
@@ -1176,8 +1176,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.20221130104643-41851efdcf63 h1:8XDImQk0JY5KTJ6ZCscjTxXAM0rwSZ2Qu9OYtiPMjdk=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221130104643-41851efdcf63/go.mod h1:drc/WDD65r6wI1tSejk19xcl9QwmzZlgJGXN7a9o2KQ=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221201121456-cf1db7634925 h1:Su0puwQV2d/SBAdGz4MfY6NcQR6wXfo2Nwf0m+hC294=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221201121456-cf1db7634925/go.mod h1:drc/WDD65r6wI1tSejk19xcl9QwmzZlgJGXN7a9o2KQ=
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656 h1:0zlZD5uhZoIHgLVAWCz2aHaYk2ZrNsACCYD7R6EIBII=
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
+8
View File
@@ -73,6 +73,9 @@ type SCapabilities struct {
ContainerBrands []string `json:",allowempty"`
DisabledContainerBrands []string `json:",allowempty"`
VpcPeerBrands []string `json:",allowempty"`
DisabledVpcPeerBrands []string `json:",allowempty"`
ReadOnlyBrands []string `json:",allowempty"`
ReadOnlyDisabledBrands []string `json:",allowempty"`
ReadOnlyComputeEngineBrands []string `json:",allowempty"`
@@ -106,6 +109,9 @@ type SCapabilities struct {
ReadOnlyContainerBrands []string `json:",allowempty"`
ReadOnlyDisabledContainerBrands []string `json:",allowempty"`
ReadOnlyVpcPeerBrands []string `json:",allowempty"`
ReadOnlyDisabledVpcPeerBrands []string `json:",allowempty"`
ResourceTypes []string `json:",allowempty"`
StorageTypes []string `json:",allowempty"` // going to remove on 2.14
DataStorageTypes []string `json:",allowempty"` // going to remove on 2.14
@@ -432,6 +438,8 @@ func getBrands(region *SCloudregion, zone *SZone, domainId string, capa *SCapabi
appendBrand(&capa.CdnBrands, &capa.DisabledCdnBrands, &capa.ReadOnlyCdnBrands, &capa.ReadOnlyDisabledCdnBrands, brand, capability, enabled, readOnly)
case cloudprovider.CLOUD_CAPABILITY_CONTAINER:
appendBrand(&capa.ContainerBrands, &capa.DisabledContainerBrands, &capa.ReadOnlyContainerBrands, &capa.ReadOnlyDisabledContainerBrands, brand, capability, enabled, readOnly)
case cloudprovider.CLOUD_CAPABILITY_VPC_PEER:
appendBrand(&capa.VpcPeerBrands, &capa.DisabledVpcPeerBrands, &capa.ReadOnlyVpcPeerBrands, &capa.ReadOnlyDisabledVpcPeerBrands, brand, capability, enabled, readOnly)
default:
}
}
+1 -1
View File
@@ -1439,7 +1439,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.20221130104643-41851efdcf63
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20221201121456-cf1db7634925
## explicit; go 1.18
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
+1
View File
@@ -54,6 +54,7 @@ const (
CLOUD_CAPABILITY_IPV6_GATEWAY = "ipv6_gateway" // IPv6网关
CLOUD_CAPABILITY_TABLESTORE = "tablestore" // 表格存储
CLOUD_CAPABILITY_MODELARTES = "modelarts"
CLOUD_CAPABILITY_VPC_PEER = "vpcpeer" // 对等连接
CLOUD_CAPABILITY_MISC = "misc"
)
+1
View File
@@ -563,6 +563,7 @@ func (self *SAwsClient) GetCapabilities() []string {
cloudprovider.CLOUD_CAPABILITY_DNSZONE,
cloudprovider.CLOUD_CAPABILITY_SAML_AUTH,
cloudprovider.CLOUD_CAPABILITY_WAF,
cloudprovider.CLOUD_CAPABILITY_VPC_PEER,
}
return caps
}
+5 -2
View File
@@ -283,7 +283,7 @@ func (self *SRegion) GetInstancePortId(instanceId string) (string, error) {
}
// https://support.huaweicloud.com/api-vpc/zh-cn_topic_0020090596.html
func (self *SRegion) AllocateEIP(name string, bwMbps int, chargeType TInternetChargeType, bgpType, subnetId string, projectId string) (*SEip, error) {
func (self *SRegion) AllocateEIP(name, ip string, bwMbps int, chargeType TInternetChargeType, bgpType, subnetId string, projectId string) (*SEip, error) {
publicip := map[string]interface{}{
"type": bgpType,
"ip_version": 4,
@@ -292,6 +292,9 @@ func (self *SRegion) AllocateEIP(name string, bwMbps int, chargeType TInternetCh
if len(subnetId) > 0 {
publicip["subnet_id"] = subnetId
}
if len(ip) > 0 {
publicip["ip_address"] = ip
}
params := map[string]interface{}{
"bandwidth": map[string]interface{}{
"name": name,
@@ -445,7 +448,7 @@ func (self *SRegion) CreateEIP(eip *cloudprovider.SEip) (cloudprovider.ICloudEIP
eip.Name = eip.Name[:64]
}
ieip, err := self.AllocateEIP(eip.Name, eip.BandwidthMbps, ctype, eip.BGPType, eip.NetworkExternalId, eip.ProjectId)
ieip, err := self.AllocateEIP(eip.Name, eip.IP, eip.BandwidthMbps, ctype, eip.BGPType, eip.NetworkExternalId, eip.ProjectId)
ieip.region = self
if err != nil {
return nil, err
+4
View File
@@ -58,6 +58,10 @@ func (self *SExternalVpc) Refresh() error {
return nil
}
func (self *SExternalVpc) IsEmulated() bool {
return true
}
func (self *SExternalVpc) GetRegion() cloudprovider.ICloudRegion {
return self.region
}
+1
View File
@@ -740,6 +740,7 @@ func (self *SHcsClient) GetCapabilities() []string {
cloudprovider.CLOUD_CAPABILITY_RDS,
cloudprovider.CLOUD_CAPABILITY_LOADBALANCER,
cloudprovider.CLOUD_CAPABILITY_NAT,
cloudprovider.CLOUD_CAPABILITY_VPC_PEER,
}
// huawei objectstore is shared across projects(subscriptions)
// to avoid multiple project access the same bucket
+1
View File
@@ -484,6 +484,7 @@ func (self *SHuaweiClient) GetCapabilities() []string {
cloudprovider.CLOUD_CAPABILITY_NAT,
cloudprovider.CLOUD_CAPABILITY_NAS,
cloudprovider.CLOUD_CAPABILITY_MODELARTES,
cloudprovider.CLOUD_CAPABILITY_VPC_PEER,
}
// huawei objectstore is shared across projects(subscriptions)
// to avoid multiple project access the same bucket
+1
View File
@@ -775,6 +775,7 @@ func (self *SHuaweiClient) GetCapabilities() []string {
cloudprovider.CLOUD_CAPABILITY_NAS,
cloudprovider.CLOUD_CAPABILITY_QUOTA + cloudprovider.READ_ONLY_SUFFIX,
cloudprovider.CLOUD_CAPABILITY_MODELARTES,
cloudprovider.CLOUD_CAPABILITY_VPC_PEER,
}
// huawei objectstore is shared across projects(subscriptions)
// to avoid multiple project access the same bucket