Skip to content

Commit a0288bd

Browse files
authored
bug(split horizon): Domains with split horizons not working (#3895)
Fixes #3894 # Issue * Split horizon DNS broke in 4.28.0 * Insufficient automated testing to detect this in the future # Resolution * domain.PostProcess() was called twice. The first time the tag was properly parsed, removing the tag from DomainConfig.Name and putting it in DomainConfig.Tag. The second time DomainConfig.Name no longer had the tag and .Tag was set to "". * The JSON output of DomainConfig doesn't output .UniqueName. If it had, this bug would have been noticed prior to release. Test updated to include that field.
1 parent 11e9fd1 commit a0288bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+172
-89
lines changed

commands/ppreviewPush_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func Test_whichZonesToProcess(t *testing.T) {
2222
dcTaggedEmpty,
2323
}
2424

25+
// This is needed since we aren't calling js.ExecuteJavaScript().
2526
for _, dc := range allDC {
2627
dc.PostProcess()
2728
}

commands/printIR.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ func ExecuteDSL(args ExecuteDSLArgs) (*models.DNSConfig, error) {
129129
return nil, fmt.Errorf("executing %s: %w", args.JSFile, err)
130130
}
131131

132-
err = dnsConfig.PostProcess()
133-
if err != nil {
134-
return nil, err
135-
}
136-
137132
return dnsConfig, nil
138133
}
139134

models/domain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type DomainConfig struct {
2424
NameUnicode string `json:"-"` // name in Unicode format
2525

2626
Tag string `json:"tag,omitempty"` // Split horizon tag.
27-
UniqueName string `json:"-"` // .Name + "!" + .Tag
27+
UniqueName string `json:"uniquename"` // .Name + "!" + .Tag (no !tag added if tag is "")
2828

2929
RegistrarName string `json:"registrar"`
3030
DNSProviderNames map[string]int `json:"dnsProviders"`

pkg/js/parse_tests/001-basic.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"type": "A"
2424
}
2525
],
26-
"registrar": "Third-Party"
26+
"registrar": "Third-Party",
27+
"uniquename": "foo.com"
2728
}
2829
],
2930
"registrars": [

pkg/js/parse_tests/002-ttl.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"type": "A"
2424
}
2525
],
26-
"registrar": "Third-Party"
26+
"registrar": "Third-Party",
27+
"uniquename": "foo.com"
2728
}
2829
],
2930
"registrars": [

pkg/js/parse_tests/003-meta.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"type": "A"
2020
}
2121
],
22-
"registrar": "Cloudflare"
22+
"registrar": "Cloudflare",
23+
"uniquename": "foo.com"
2324
}
2425
],
2526
"registrars": [

pkg/js/parse_tests/004-ips.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"type": "A"
3838
}
3939
],
40-
"registrar": "Third-Party"
40+
"registrar": "Third-Party",
41+
"uniquename": "foo.com"
4142
}
4243
],
4344
"registrars": [

pkg/js/parse_tests/005-ignored-records.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"name": "foo.com",
1010
"records": [],
1111
"registrar": "none",
12+
"uniquename": "foo.com",
1213
"unmanaged": [
1314
{
1415
"label_pattern": "testignore",
@@ -60,6 +61,7 @@
6061
"name": "diff2.com",
6162
"records": [],
6263
"registrar": "none",
64+
"uniquename": "diff2.com",
6365
"unmanaged": [
6466
{
6567
"label_pattern": "mylabel",

pkg/js/parse_tests/006-transforms.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"type": "A"
4747
}
4848
],
49-
"registrar": "Third-Party"
49+
"registrar": "Third-Party",
50+
"uniquename": "foo.com"
5051
}
5152
],
5253
"registrars": [

pkg/js/parse_tests/007-importTransformTTL.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"type": "A"
2424
}
2525
],
26-
"registrar": "reg"
26+
"registrar": "reg",
27+
"uniquename": "foo1.com"
2728
},
2829
{
2930
"dnsProviders": {},
@@ -47,7 +48,8 @@
4748
"type": "A"
4849
}
4950
],
50-
"registrar": "reg"
51+
"registrar": "reg",
52+
"uniquename": "inny"
5153
},
5254
{
5355
"dnsProviders": {},
@@ -71,7 +73,8 @@
7173
"type": "A"
7274
}
7375
],
74-
"registrar": "reg"
76+
"registrar": "reg",
77+
"uniquename": "com.inny"
7578
}
7679
],
7780
"registrars": []

0 commit comments

Comments
 (0)