fix(region): account read only (#20344)

This commit is contained in:
屈轩
2024-05-24 10:00:45 +08:00
committed by GitHub
parent ffcdd48943
commit fdc6d25b11
10 changed files with 33 additions and 9 deletions
+2 -2
View File
@@ -89,12 +89,12 @@ require (
k8s.io/cluster-bootstrap v0.19.3
k8s.io/cri-api v0.22.17
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240522122259-80ac13ee20b3
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240523082919-32c77385d0c9
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
yunion.io/x/jsonutils v1.0.1-0.20240203102553-4096f103b401
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
yunion.io/x/pkg v1.10.1-0.20240510032728-8203b24857a2
yunion.io/x/pkg v1.10.1-0.20240523064807-c920e765a118
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
yunion.io/x/sqlchemy v1.1.3-0.20240417115142-4f4271cd8305
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
+4 -4
View File
@@ -1213,8 +1213,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.20240522122259-80ac13ee20b3 h1:YhE9b1sGtyV8jIGAxUG/Ci0yID9J3wDOVRE6qjuTWyI=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240522122259-80ac13ee20b3/go.mod h1:quoJjGTJ2PjAY0+3YeN5JuN136whECKmfkJQwIsXKjM=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240523082919-32c77385d0c9 h1:nkIPma11kmIL6VmP1N6zfUUOvIS8F1ov3tWLUcdONb0=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240523082919-32c77385d0c9/go.mod h1:quoJjGTJ2PjAY0+3YeN5JuN136whECKmfkJQwIsXKjM=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
@@ -1228,8 +1228,8 @@ yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900 h1:Hu/4ERvoWaN6aiFs4h4/yvVB
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900/go.mod h1:0vLkNEhlmA64HViPBAnSTUMrx5QP1CLsxXmxDKQ80tc=
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v1.10.1-0.20240510032728-8203b24857a2 h1:UWVod1oFuoscPf86G3YdKyKaWr0URuA9ubt4mYwhQyY=
yunion.io/x/pkg v1.10.1-0.20240510032728-8203b24857a2/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
yunion.io/x/pkg v1.10.1-0.20240523064807-c920e765a118 h1:0k48mRv/+9uElQr6+OPKsfx20PtzCDhuj7XpsDqyh4M=
yunion.io/x/pkg v1.10.1-0.20240523064807-c920e765a118/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
yunion.io/x/sqlchemy v1.1.3-0.20240417115142-4f4271cd8305 h1:TIXzc634+YSAs2+3A+TyPmKAGd6HtAYU3M4cKwzUuo0=
+3
View File
@@ -521,6 +521,9 @@ func (manager *SCloudaccountManager) validateCreateData(
}
input.IsPublicCloud = providerDriver.IsPublicCloud()
input.IsOnPremise = providerDriver.IsOnPremise()
if providerDriver.IsReadOnly() {
input.ReadOnly = true
}
if !input.SkipDuplicateAccountCheck {
q := manager.Query().Equals("provider", input.Provider)
+2 -2
View File
@@ -1483,7 +1483,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.20240522122259-80ac13ee20b3
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240523082919-32c77385d0c9
## explicit; go 1.18
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
@@ -1580,7 +1580,7 @@ yunion.io/x/log/hooks
yunion.io/x/ovsdb/cli_util
yunion.io/x/ovsdb/schema/ovn_nb
yunion.io/x/ovsdb/types
# yunion.io/x/pkg v1.10.1-0.20240510032728-8203b24857a2
# yunion.io/x/pkg v1.10.1-0.20240523064807-c920e765a118
## explicit; go 1.18
yunion.io/x/pkg/appctx
yunion.io/x/pkg/errors
+5
View File
@@ -203,6 +203,7 @@ type ICloudProviderFactory interface {
ValidateChangeBandwidth(instanceId string, bandwidth int64) error
ValidateCreateCloudaccountData(ctx context.Context, input SCloudaccountCredential) (SCloudaccount, error)
IsReadOnly() bool
ValidateUpdateCloudaccountCredential(ctx context.Context, input SCloudaccountCredential, cloudaccount string) (SCloudaccount, error)
GetSupportedBrands() []string
@@ -712,6 +713,10 @@ func (factory *baseProviderFactory) IsMultiTenant() bool {
return false
}
func (factory *baseProviderFactory) IsReadOnly() bool {
return false
}
func (factory *baseProviderFactory) IsCloudeventRegional() bool {
return false
}
@@ -42,6 +42,10 @@ func (f *SEcloudProviderFactory) IsSupportPrepaidResources() bool {
return true
}
func (f *SEcloudProviderFactory) IsReadOnly() bool {
return true
}
func (f *SEcloudProviderFactory) ValidateCreateCloudaccountData(ctx context.Context, input cloudprovider.SCloudaccountCredential) (cloudprovider.SCloudaccount, error) {
output := cloudprovider.SCloudaccount{}
if len(input.AccessKeyId) == 0 {
@@ -42,6 +42,10 @@ func (f *SJdcloudProviderFactory) IsSupportPrepaidResources() bool {
return true
}
func (f *SJdcloudProviderFactory) IsReadOnly() bool {
return true
}
func (f *SJdcloudProviderFactory) ValidateCreateCloudaccountData(ctx context.Context, input cloudprovider.SCloudaccountCredential) (cloudprovider.SCloudaccount, error) {
output := cloudprovider.SCloudaccount{}
if len(input.AccessKeyId) == 0 {
@@ -37,6 +37,10 @@ func (self *SKsyunProviderFactory) GetName() string {
return ksyun.CLOUD_PROVIDER_KSYUN_CN
}
func (self *SKsyunProviderFactory) IsReadOnly() bool {
return true
}
func (self *SKsyunProviderFactory) ValidateCreateCloudaccountData(ctx context.Context, input cloudprovider.SCloudaccountCredential) (cloudprovider.SCloudaccount, error) {
output := cloudprovider.SCloudaccount{}
if len(input.AccessKeyId) == 0 {
@@ -38,6 +38,10 @@ func (self *SOracleProviderFactory) GetName() string {
return oracle.CLOUD_PROVIDER_ORACLE_CN
}
func (self *SOracleProviderFactory) IsReadOnly() bool {
return true
}
func (self *SOracleProviderFactory) ValidateCreateCloudaccountData(ctx context.Context, input cloudprovider.SCloudaccountCredential) (cloudprovider.SCloudaccount, error) {
output := cloudprovider.SCloudaccount{}
if len(input.OracleTenancyOCID) == 0 {
+1 -1
View File
@@ -316,7 +316,7 @@ func (addr IPV6Addr) String() string {
maxZeroLen = maxZeroEnd - maxZeroStart + 1
}
}
if maxZeroLen > 0 {
if maxZeroLen > 1 {
return strings.Join(hexStrs[:maxZeroStart], ":") + "::" + strings.Join(hexStrs[maxZeroEnd+1:], ":")
} else {
return strings.Join(hexStrs, ":")