mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix(region): add proxied for dns record (#22514)
This commit is contained in:
@@ -93,7 +93,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.20250512041816-e0d1de4ee3ad
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250512085204-4c8552cf788d
|
||||
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
|
||||
@@ -1376,8 +1376,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.20250512041816-e0d1de4ee3ad h1:6l2kdc3Hht3Bh81TNR17MPVAx81QKLpDBpN3+1WxONc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250512041816-e0d1de4ee3ad/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250512085204-4c8552cf788d h1:3ofa2X04MnwqHnrGV6bc6nivoU7n4/fi9ckQgTWHXyQ=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250512085204-4c8552cf788d/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256 h1:kLKQ6zbgPDQflRwoHFAjxNChcbhXIFgsUVLkJwiXu/8=
|
||||
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
|
||||
@@ -36,6 +36,7 @@ type DnsRecordCreateInput struct {
|
||||
DnsValue string `json:"dns_value"`
|
||||
TTL int64 `json:"ttl"`
|
||||
MxPriority int64 `json:"mx_priority"`
|
||||
Proxied *bool `json:"proxied"`
|
||||
|
||||
PolicyType string `json:"policy_type"`
|
||||
PolicyValue string `json:"policy_value"`
|
||||
@@ -48,6 +49,7 @@ type DnsRecordUpdateInput struct {
|
||||
DnsValue string `json:"dns_value"`
|
||||
TTL *int64 `json:"ttl"`
|
||||
MxPriority *int64 `json:"mx_priority"`
|
||||
Proxied *bool `json:"proxied"`
|
||||
}
|
||||
|
||||
type DnsRecordDetails struct {
|
||||
|
||||
@@ -76,6 +76,8 @@ type SDnsRecord struct {
|
||||
DnsValue string `width:"256" charset:"ascii" nullable:"false" list:"user" update:"user" create:"required"`
|
||||
TTL int64 `nullable:"false" list:"user" update:"user" create:"required" json:"ttl"`
|
||||
MxPriority int64 `nullable:"false" list:"user" update:"user" create:"optional"`
|
||||
// cloudflare 特有
|
||||
Proxied tristate.TriState `default:"false" list:"user" create:"optional"`
|
||||
|
||||
// 解析线路类型
|
||||
PolicyType string `width:"36" charset:"ascii" nullable:"false" list:"user" update:"user" create:"optional"`
|
||||
@@ -491,6 +493,7 @@ func (self *SDnsRecord) syncWithDnsRecord(ctx context.Context, userCred mcclient
|
||||
diff, err := db.Update(self, func() error {
|
||||
self.Name = ext.GetDnsName()
|
||||
self.Enabled = tristate.NewFromBool(ext.GetEnabled())
|
||||
self.Proxied = tristate.NewFromBool(ext.IsProxied())
|
||||
self.Status = ext.GetStatus()
|
||||
self.TTL = ext.GetTTL()
|
||||
self.MxPriority = ext.GetMxPriority()
|
||||
@@ -525,6 +528,7 @@ func (self *SDnsZone) newFromCloudDnsRecord(ctx context.Context, userCred mcclie
|
||||
record.Name = ext.GetDnsName()
|
||||
record.Status = ext.GetStatus()
|
||||
record.Enabled = tristate.NewFromBool(ext.GetEnabled())
|
||||
record.Proxied = tristate.NewFromBool(ext.IsProxied())
|
||||
record.TTL = ext.GetTTL()
|
||||
record.MxPriority = ext.GetMxPriority()
|
||||
record.DnsType = string(ext.GetDnsType())
|
||||
|
||||
@@ -69,6 +69,7 @@ func (self *DnsRecordCreateTask) OnInit(ctx context.Context, obj db.IStandaloneM
|
||||
Enabled: record.Enabled.Bool(),
|
||||
DnsType: cloudprovider.TDnsType(record.DnsType),
|
||||
DnsValue: record.DnsValue,
|
||||
Proxied: record.Proxied.Bool(),
|
||||
Ttl: record.TTL,
|
||||
MxPriority: record.MxPriority,
|
||||
PolicyType: cloudprovider.TDnsPolicyType(record.PolicyType),
|
||||
|
||||
@@ -76,6 +76,7 @@ func (self *DnsRecordUpdateTask) OnInit(ctx context.Context, obj db.IStandaloneM
|
||||
DnsValue: record.DnsValue,
|
||||
DnsType: cloudprovider.TDnsType(record.DnsType),
|
||||
Enabled: record.Enabled.Bool(),
|
||||
Proxied: record.Proxied.Bool(),
|
||||
Ttl: record.TTL,
|
||||
MxPriority: record.MxPriority,
|
||||
PolicyType: cloudprovider.TDnsPolicyType(record.PolicyType),
|
||||
|
||||
Vendored
+1
-1
@@ -1785,7 +1785,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.20250512041816-e0d1de4ee3ad
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250512085204-4c8552cf788d
|
||||
## explicit; go 1.21
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
+2
-53
@@ -14,59 +14,8 @@
|
||||
|
||||
package compute
|
||||
|
||||
/*
|
||||
|
||||
Architecture For DnsZone
|
||||
|
||||
|
||||
+-----------+ +----------------+ +-----------+
|
||||
| RecordSet | | TrafficPolicy | | RecordSet | +-------------+
|
||||
| (A) | | (Aliyun) | | (TXT) | | Vpc1 |
|
||||
| | | | | | | (Aws) |
|
||||
| | | | | | | |
|
||||
+-----------------------+ | | | | | | +-----------------+ | |
|
||||
API | DnsZone example.com | | RecordSet | | TrafficPolicy | | RecordSet | | DnsZone abc.app | | Vpc2 |
|
||||
| (Public) | ------>| (AAAA) | -----------------> | (Tencent) | <-------------| (CAA) | <-------------| (Private) |-----> | (Tencent) |
|
||||
+-----------------------+ | | | | | | +-----------------+ | |
|
||||
^ | | | | | | ^ | |
|
||||
| | | | | | | | | Vpc3 |
|
||||
| | RecordSet | | TrafficPolicy | | RecordSet | | | (Aws) |
|
||||
| | (NS) | | (Aws) | | (PTR) | | +-------------+
|
||||
| +-----------+ +----------------+ +-----------+ |
|
||||
| |
|
||||
| |
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
| |
|
||||
v |
|
||||
+-----------------+ |
|
||||
| | |
|
||||
| | +----------+ v
|
||||
| example.com <-------------> | Account1 | +----------+ +---------------+
|
||||
| | | (Aliyun) | | Account3 | <-------> | abc.app |
|
||||
| | +----------+ +------------+ | (Aws) | | |
|
||||
| | | Account2 | +----------+ | |
|
||||
| example.com <-------------------------------------------------------> | (Tencent) | | |
|
||||
Cache | | +------------+ | |
|
||||
| | | |
|
||||
| | +----------+ | |
|
||||
| example.com <-------------> | Account4 | <--------------------------------------------------------------------------------> | abc.app |
|
||||
| | | (Aliyun) | | |
|
||||
| | +----------+ +---------------+
|
||||
+-----------------+
|
||||
|
||||
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
************* *************** *************
|
||||
**** **** **** **** **** ****
|
||||
Public Cloud ** Aliyun ** ** Tencent ** ** Aws **
|
||||
**** **** **** **** **** ****
|
||||
************* *************** *************
|
||||
|
||||
|
||||
*/
|
||||
|
||||
const (
|
||||
DNS_ZONE_STATUS_AVAILABLE = "available" // 可用
|
||||
DNS_ZONE_STATUS_UNKNOWN = "unknown" // 未知
|
||||
DNS_ZONE_STATUS_PENDING = "pending"
|
||||
DNS_ZONE_STATUS_UNKNOWN = "unknown" // 未知
|
||||
)
|
||||
|
||||
+1
@@ -539,6 +539,7 @@ type DnsRecord struct {
|
||||
DnsName string
|
||||
DnsType TDnsType
|
||||
DnsValue string
|
||||
Proxied bool
|
||||
|
||||
Enabled bool
|
||||
Ttl int64
|
||||
|
||||
+1
@@ -1338,6 +1338,7 @@ type ICloudDnsRecord interface {
|
||||
|
||||
GetDnsName() string
|
||||
GetStatus() string
|
||||
IsProxied() bool
|
||||
GetEnabled() bool
|
||||
GetDnsType() TDnsType
|
||||
GetDnsValue() string
|
||||
|
||||
+2
@@ -24,6 +24,7 @@ import (
|
||||
|
||||
api "yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/cloudmux/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SDomainRecords struct {
|
||||
@@ -36,6 +37,7 @@ type SDomainRecords struct {
|
||||
|
||||
// https://help.aliyun.com/document_detail/29777.html?spm=a2c4g.11186623.6.666.aa4832307YdopF
|
||||
type SDomainRecord struct {
|
||||
multicloud.SDnsRecordBase
|
||||
domain *SDomain
|
||||
|
||||
DomainId string `json:"DomainId"`
|
||||
|
||||
+3
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
api "yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/cloudmux/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SPvtzRecords struct {
|
||||
@@ -34,6 +35,8 @@ type SPvtzRecords struct {
|
||||
}
|
||||
|
||||
type SPvtzRecord struct {
|
||||
multicloud.SDnsRecordBase
|
||||
|
||||
szone *SPrivateZone
|
||||
Status string `json:"Status"`
|
||||
Value string `json:"Value"`
|
||||
|
||||
+2
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
api "yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/cloudmux/pkg/multicloud"
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/utils"
|
||||
@@ -33,6 +34,7 @@ type SAliasTarget struct {
|
||||
}
|
||||
|
||||
type SDnsRecord struct {
|
||||
multicloud.SDnsRecordBase
|
||||
zone *SDnsZone
|
||||
|
||||
Name string `xml:"Name"`
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package multicloud
|
||||
|
||||
type SDnsRecordBase struct {
|
||||
}
|
||||
|
||||
func (self *SDnsRecordBase) IsProxied() bool {
|
||||
return false
|
||||
}
|
||||
+2
@@ -23,6 +23,7 @@ import (
|
||||
|
||||
api "yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/cloudmux/pkg/multicloud"
|
||||
)
|
||||
|
||||
type SRecordCreateRet struct {
|
||||
@@ -39,6 +40,7 @@ type SRecordCountInfo struct {
|
||||
}
|
||||
|
||||
type SDnsRecord struct {
|
||||
multicloud.SDnsRecordBase
|
||||
domain *SDomian
|
||||
|
||||
Line string `json:"Line"`
|
||||
|
||||
Reference in New Issue
Block a user