mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix(region): account read only (#20343)
This commit is contained in:
@@ -94,12 +94,12 @@ require (
|
||||
k8s.io/cri-api v0.22.17
|
||||
k8s.io/klog/v2 v2.2.0
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240522122256-f1cfcde605d0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240523082917-4977738de7e0
|
||||
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
|
||||
|
||||
@@ -1307,8 +1307,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.20240522122256-f1cfcde605d0 h1:gPqgT/h2ojoBwf0152LPxc9NXT0fk24OXF00eRdORBc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240522122256-f1cfcde605d0/go.mod h1:quoJjGTJ2PjAY0+3YeN5JuN136whECKmfkJQwIsXKjM=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240523082917-4977738de7e0 h1:svVqtfhchyqOUjLOasxRR4v5hYDsM5tZiqEAvR7R2jU=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240523082917-4977738de7e0/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=
|
||||
@@ -1322,8 +1322,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=
|
||||
|
||||
@@ -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)
|
||||
|
||||
Vendored
+2
-2
@@ -1684,7 +1684,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.20240522122256-f1cfcde605d0
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240523082917-4977738de7e0
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
@@ -1781,7 +1781,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
@@ -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
|
||||
}
|
||||
|
||||
+4
@@ -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 {
|
||||
|
||||
+4
@@ -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 {
|
||||
|
||||
+4
@@ -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 {
|
||||
|
||||
+4
@@ -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
@@ -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, ":")
|
||||
|
||||
Reference in New Issue
Block a user