Skip to content

Commit

Permalink
fix(region): sync aliyun gtm and aws traffic policy address (#21102)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Aug 26, 2024
1 parent 3300a20 commit d1f363b
Show file tree
Hide file tree
Showing 17 changed files with 448 additions and 19 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ 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.20240807034246-120e189bb1a0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240826095153-54fc3ccf2f76
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.20240812013427-0163ba9c86b1
yunion.io/x/pkg v1.10.1-0.20240826001854-ac73b70d75b7
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
yunion.io/x/sqlchemy v1.1.3-0.20240624023332-82a08f917568
yunion.io/x/sqlchemy v1.1.3-0.20240823033059-be6fe90dab22
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
)

Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1308,8 +1308,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.20240807034246-120e189bb1a0 h1:yRnv4rMQGdhvlfwlMWqv9GdxdOoDuk7gZUqy1CaDEjo=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240807034246-120e189bb1a0/go.mod h1:iLoBHVR2Eur/1WJSGcbZaEwpzh/iqXvbFCsX9/xt8CI=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240826095153-54fc3ccf2f76 h1:aA6sxo36AnvX7D7GyhtHnpiZolEgkj3ShNbuQMbz20E=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240826095153-54fc3ccf2f76/go.mod h1:iLoBHVR2Eur/1WJSGcbZaEwpzh/iqXvbFCsX9/xt8CI=
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=
Expand All @@ -1323,11 +1323,11 @@ 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.20240812013427-0163ba9c86b1 h1:UJ5mmoZWrO3golljJaMchFQNzSZdRWGM32Xf3lI5YVk=
yunion.io/x/pkg v1.10.1-0.20240812013427-0163ba9c86b1/go.mod h1:0Bwxqd9MA3ACi119/l02FprY/o9gHahmYC2bsSbnVpM=
yunion.io/x/pkg v1.10.1-0.20240826001854-ac73b70d75b7 h1:ceNLYp6CKYccbFw/ug9ohSaUbEk5THipaA4K+SAHEKc=
yunion.io/x/pkg v1.10.1-0.20240826001854-ac73b70d75b7/go.mod h1:0Bwxqd9MA3ACi119/l02FprY/o9gHahmYC2bsSbnVpM=
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.20240624023332-82a08f917568 h1:Ytz3G6z3/U+yzkM3KM/am1ndPWHB0nDlOLi9OJWduPc=
yunion.io/x/sqlchemy v1.1.3-0.20240624023332-82a08f917568/go.mod h1:5W8ghvJ4TNt/r2yDjjD3i4QsZgIiJX45dhRQBGWPHsQ=
yunion.io/x/sqlchemy v1.1.3-0.20240823033059-be6fe90dab22 h1:H+lxDpb8e2y2DwMRvo6Ujq3NK1zbR0gfVS9tdvjG4X0=
yunion.io/x/sqlchemy v1.1.3-0.20240823033059-be6fe90dab22/go.mod h1:5W8ghvJ4TNt/r2yDjjD3i4QsZgIiJX45dhRQBGWPHsQ=
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c h1:QuLab2kSRECZRxo4Lo2KcYn6XjQFDGaZ1+x0pYDVVwQ=
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
11 changes: 11 additions & 0 deletions pkg/compute/models/dnsrecords.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

"yunion.io/x/cloudmux/pkg/cloudprovider"
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/tristate"
"yunion.io/x/pkg/util/compare"
Expand Down Expand Up @@ -78,6 +79,9 @@ type SDnsRecord struct {
PolicyType string `width:"36" charset:"ascii" nullable:"false" list:"user" update:"user" create:"optional"`
// 解析线路
PolicyValue string `width:"256" charset:"ascii" nullable:"false" list:"user" update:"user" create:"optional"`

// 目前存储阿里云GTM设置地址及AWS TrafficPolicy端点地址, 仅支持同步
ExtraAddresses []string `width:"512" charset:"utf8" nullable:"true" list:"user"`
}

func (manager *SDnsRecordManager) EnableGenerateName() bool {
Expand Down Expand Up @@ -492,6 +496,12 @@ func (self *SDnsRecord) syncWithDnsRecord(ctx context.Context, userCred mcclient
self.DnsValue = ext.GetDnsValue()
self.PolicyType = string(ext.GetPolicyType())
self.PolicyValue = string(ext.GetPolicyValue())
extraAddresses, err := ext.GetExtraAddresses()
if err != nil {
log.Errorf("GetExtraAddresses for record %s error: %v", self.Name, err)
return nil
}
self.ExtraAddresses = extraAddresses
return nil
})
if err != nil {
Expand Down Expand Up @@ -520,6 +530,7 @@ func (self *SDnsZone) newFromCloudDnsRecord(ctx context.Context, userCred mcclie
record.ExternalId = ext.GetGlobalId()
record.PolicyType = string(ext.GetPolicyType())
record.PolicyValue = string(ext.GetPolicyValue())
record.ExtraAddresses, _ = ext.GetExtraAddresses()

err := DnsRecordManager.TableSpec().Insert(ctx, record)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,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.20240807034246-120e189bb1a0
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20240826095153-54fc3ccf2f76
## explicit; go 1.18
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
Expand Down Expand Up @@ -1787,7 +1787,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.20240812013427-0163ba9c86b1
# yunion.io/x/pkg v1.10.1-0.20240826001854-ac73b70d75b7
## explicit; go 1.18
yunion.io/x/pkg/appctx
yunion.io/x/pkg/errors
Expand Down Expand Up @@ -1842,7 +1842,7 @@ yunion.io/x/pkg/utils
# yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
## explicit; go 1.12
yunion.io/x/s3cli
# yunion.io/x/sqlchemy v1.1.3-0.20240624023332-82a08f917568
# yunion.io/x/sqlchemy v1.1.3-0.20240823033059-be6fe90dab22
## explicit; go 1.17
yunion.io/x/sqlchemy
yunion.io/x/sqlchemy/backends
Expand Down
1 change: 1 addition & 0 deletions vendor/yunion.io/x/cloudmux/pkg/cloudprovider/resources.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 111 additions & 0 deletions vendor/yunion.io/x/cloudmux/pkg/multicloud/aliyun/gtm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions vendor/yunion.io/x/cloudmux/pkg/multicloud/aliyun/gtm3.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d1f363b

Please sign in to comment.