Skip to content

Commit 90d58d5

Browse files
committed
rename domain -> zone; zone -> parentZone
Based on the discussion started in: k8gb-io#1876 (comment) Signed-off-by: Andre Aguas <[email protected]>
1 parent 7238805 commit 90d58d5

29 files changed

+111
-111
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ deploy-k8gb-with-helm:
261261
--set $(call get-helm-args,$(CLUSTER_ID)) \
262262
--set k8gb.reconcileRequeueSeconds=10 \
263263
--set k8gb.dnsZones[0].dnsZoneNegTTL=10 \
264-
--set k8gb.dnsZones[0].zone="example.com" \
265-
--set k8gb.dnsZones[0].domain="cloud.example.com" \
264+
--set k8gb.dnsZones[0].zone="cloud.example.com" \
265+
--set k8gb.dnsZones[0].parentZone="example.com" \
266266
--set k8gb.imageTag=${VERSION:"stable"=""} \
267267
--set k8gb.log.format=$(LOG_FORMAT) \
268268
--set k8gb.log.level=$(LOG_LEVEL) \

chart/k8gb/templates/_helpers.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ k8gb-{{ index (split ":" (index (split ";" (include "k8gb.dnsZonesString" .)) "_
100100
{{- $entries := list -}}
101101
{{- range .Values.k8gb.dnsZones }}
102102
{{- $dnsZoneNegTTL := toString (.dnsZoneNegTTL | default "300") }}
103-
{{- $entry := printf "%s:%s:%s" .zone .domain $dnsZoneNegTTL }}
103+
{{- $entry := printf "%s:%s:%s" .parentZone .zone $dnsZoneNegTTL }}
104104
{{- $entries = append $entries $entry }}
105105
{{- end }}
106106
{{- join ";" $entries }}

chart/k8gb/templates/coredns/cm.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data:
1212
{{- $dnsZones := split ";" $dnsZonesRaw }}
1313
{{- range $dnsZones }}
1414
{{- $parts := split ":" . }}
15-
{{- $domain := index $parts "_1" }}
15+
{{- $zone := index $parts "_1" }}
1616
{{- $dnsZoneNegTTL := index $parts "_2" }}
1717
{{ $domain }}:5353 {
1818
errors

chart/k8gb/templates/external-dns/external-dns.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ spec:
2626
{{- $dnsZones := split ";" $dnsZonesRaw }}
2727
{{- range $dnsZones }}
2828
{{- $parts := split ":" . }}
29-
{{- $zone := index $parts "_0" }}
30-
- --domain-filter={{ $zone }} # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
29+
{{- $parentZone := index $parts "_0" }}
30+
- --domain-filter={{ $parentZone }} # will make ExternalDNS see only the hosted zones matching provided domain, omit to process all available hosted zones
3131
{{- end }}
3232
- --policy=sync # enable full synchronization including record removal
3333
- --log-level=debug # debug only

chart/k8gb/values.schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@
425425
"type": "string",
426426
"format": "idn-hostname"
427427
},
428-
"domain": {
428+
"parentZone": {
429429
"type": "string",
430430
"format": "idn-hostname"
431431
},
@@ -437,7 +437,7 @@
437437
},
438438
"required": [
439439
"zone",
440-
"domain"
440+
"parentZone"
441441
]
442442
},
443443
"Ns1": {

chart/k8gb/values.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ k8gb:
1818
#
1919
# -- array of dns zones controlled by gslb
2020
dnsZones:
21-
- zone: "example.com" # -- main zone which would contain gslb zone to delegate (same meaning as to edgeDNSZone)
22-
domain: "cloud.example.com" # -- domain controlled by gslb (same meaning as to dnsZone)
21+
- parentZone: "example.com" # -- parent zone which would contain gslb zone to delegate (same meaning as to edgeDNSZone)
22+
zone: "cloud.example.com" # -- zone controlled by gslb (same meaning as to dnsZone)
2323
dnsZoneNegTTL: 30 # -- Negative TTL for SOA record# -- host/ip[:port] format is supported here where port defaults to 53
2424
edgeDNSServers:
2525
# -- use this DNS server as a main resolver to enable cross k8gb DNS based communication

controllers/depresolver/depresolver_domaininfo.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import (
2929
type DelegationZones []*DelegationZoneInfo
3030

3131
type DelegationZoneInfo struct {
32-
Domain string // cloud.example.com
33-
Zone string // example.com
32+
Zone string // cloud.example.com
33+
ParentZone string // example.com
3434
NegativeTTL int
3535
ClusterNSName string
3636
ExtClusterNSNames map[string]string
@@ -39,18 +39,18 @@ type DelegationZoneInfo struct {
3939

4040
func parseDelegationZones(config *Config) ([]*DelegationZoneInfo, error) {
4141
type info struct {
42-
domain string
43-
zone string
44-
negTTL string
42+
zone string
43+
parentZone string
44+
negTTL string
4545
}
4646

4747
zones := config.dnsZones
4848

49-
getNsName := func(tag, zone, edge string) string {
49+
getNsName := func(tag, zone, parentZone string) string {
5050
const prefix = "gslb-ns"
51-
d := strings.TrimSuffix(zone, "."+edge)
52-
domainX := strings.ReplaceAll(d, ".", "-")
53-
return fmt.Sprintf("%s-%s-%s.%s", prefix, tag, domainX, edge)
51+
d := strings.TrimSuffix(zone, "."+parentZone)
52+
zoneX := strings.ReplaceAll(d, ".", "-")
53+
return fmt.Sprintf("%s-%s-%s.%s", prefix, tag, zoneX, parentZone)
5454
}
5555

5656
validateRFC1035 := func(zoneInfo *DelegationZoneInfo) error {
@@ -79,7 +79,7 @@ func parseDelegationZones(config *Config) ([]*DelegationZoneInfo, error) {
7979
if len(touple) != 3 {
8080
return tuples, fmt.Errorf("invalid format of delegation zones: %s", z)
8181
}
82-
tuples = append(tuples, info{zone: strings.Trim(touple[0], " "), domain: strings.Trim(touple[1], " "), negTTL: strings.Trim(touple[2], " ")})
82+
tuples = append(tuples, info{parentZone: strings.Trim(touple[0], " "), zone: strings.Trim(touple[1], " "), negTTL: strings.Trim(touple[2], " ")})
8383
}
8484
return tuples, nil
8585
}
@@ -96,17 +96,17 @@ func parseDelegationZones(config *Config) ([]*DelegationZoneInfo, error) {
9696
return dzi, fmt.Errorf("invalid value of delegation zones: %s", zones)
9797
}
9898
zoneInfo := &DelegationZoneInfo{
99-
Domain: inf.domain,
10099
Zone: inf.zone,
100+
ParentZone: inf.parentZone,
101101
NegativeTTL: negTTL,
102-
ClusterNSName: getNsName(config.ClusterGeoTag, inf.domain, inf.zone),
102+
ClusterNSName: getNsName(config.ClusterGeoTag, inf.zone, inf.parentZone),
103103
ExtClusterNSNames: func(zone, edge string) map[string]string {
104104
m := map[string]string{}
105105
for _, tag := range config.extClustersGeoTags {
106106
m[tag] = getNsName(tag, zone, edge)
107107
}
108108
return m
109-
}(inf.domain, inf.zone),
109+
}(inf.zone, inf.parentZone),
110110
}
111111
dzi = append(dzi, zoneInfo)
112112
}
@@ -132,7 +132,7 @@ func (z *DelegationZoneInfo) GetNSServerList() []string {
132132

133133
// GetExternalDNSEndpointName returns name of endpoint sitting in k8gb namespace
134134
func (z *DelegationZoneInfo) GetExternalDNSEndpointName() string {
135-
var suffix = strings.Trim(strings.ReplaceAll(z.Domain, ".", "-"), " ")
135+
var suffix = strings.Trim(strings.ReplaceAll(z.Zone, ".", "-"), " ")
136136
return fmt.Sprintf("k8gb-ns-extdns-%s", suffix)
137137
}
138138

controllers/depresolver/depresolver_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -1312,10 +1312,10 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc3.eee`
13121312
assert: func(zoneInfo []*DelegationZoneInfo, err error) {
13131313
assert.NoError(t, err)
13141314
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1315-
return info.Zone == "example.com" && info.Domain == "cloud.example.com"
1315+
return info.ParentZone == "example.com" && info.Zone == "cloud.example.com"
13161316
}))
13171317
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1318-
return info.Zone == "example.io" && info.Domain == "cloud.example.io"
1318+
return info.ParentZone == "example.io" && info.Zone == "cloud.example.io"
13191319
}))
13201320
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
13211321
return info.ClusterNSName == "gslb-ns-us-cloud.example.com" &&
@@ -1345,10 +1345,10 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc3.eee`
13451345
assert: func(zoneInfo []*DelegationZoneInfo, err error) {
13461346
assert.NoError(t, err)
13471347
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1348-
return info.Zone == "example.com" && info.Domain == "cloud.example.com"
1348+
return info.ParentZone == "example.com" && info.Zone == "cloud.example.com"
13491349
}))
13501350
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1351-
return info.Zone == "example.com" && info.Domain == "pair.example.com"
1351+
return info.ParentZone == "example.com" && info.Zone == "pair.example.com"
13521352
}))
13531353
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
13541354
return info.ClusterNSName == "gslb-ns-us-cloud.example.com" &&
@@ -1378,10 +1378,10 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc3.eee`
13781378
assert: func(zoneInfo []*DelegationZoneInfo, err error) {
13791379
assert.NoError(t, err)
13801380
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1381-
return info.Zone == "example.com" && info.Domain == "cloud.example.com"
1381+
return info.ParentZone == "example.com" && info.Zone == "cloud.example.com"
13821382
}))
13831383
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1384-
return info.Zone == "example.io" && info.Domain == "cloud.example.io"
1384+
return info.ParentZone == "example.io" && info.Zone == "cloud.example.io"
13851385
}))
13861386
},
13871387
},
@@ -1397,10 +1397,10 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc3.eee`
13971397
assert: func(zoneInfo []*DelegationZoneInfo, err error) {
13981398
assert.NoError(t, err)
13991399
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1400-
return info.Zone == "example.com" && info.Domain == "cloud.example.com"
1400+
return info.ParentZone == "example.com" && info.Zone == "cloud.example.com"
14011401
}))
14021402
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1403-
return info.Zone == "example.io" && info.Domain == "cloud.example.io"
1403+
return info.ParentZone == "example.io" && info.Zone == "cloud.example.io"
14041404
}))
14051405
},
14061406
},

controllers/gslb_controller_reconciliation_test.go.canceled

+8-8
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ var predefinedConfig = depresolver.Config{
102102
},
103103
DelegationZones: []depresolver.DelegationZoneInfo{
104104
{
105-
Domain: "cloud.example.com",
106-
Zone: "example.com",
105+
Zone: "cloud.example.com",
106+
ParentZone: "example.com",
107107
ClusterNSName: "localhost",
108108
ExtClusterNSNames: map[string]string{"eu": "localhost"},
109109
},
@@ -877,8 +877,8 @@ func TestDetectsIngressHostnameMismatch(t *testing.T) {
877877
customConfig := predefinedConfig
878878
customConfig.DelegationZones = depresolver.DelegationZones{
879879
{
880-
Domain: "cloud.example.com",
881-
Zone: "otherdnszone.com",
880+
Zone: "cloud.example.com",
881+
ParentZone: "otherdnszone.com",
882882
},
883883
}
884884
predefinedSettings.config = customConfig
@@ -954,8 +954,8 @@ func TestCreatesDNSNSRecordsForExtDNS(t *testing.T) {
954954
customConfig.ClusterGeoTag = "eu"
955955
customConfig.DelegationZones = depresolver.DelegationZones{
956956
{
957-
Domain: dnsZone,
958-
Zone: "example.com",
957+
Zone: dnsZone,
958+
ParentZone: "example.com",
959959
ClusterNSName: "gslb-ns-eu-cloud.example.com",
960960
ExtClusterNSNames: map[string]string{"us": "gslb-ns-us-cloud.example.com", "za": "gslb-ns-za-cloud.example.com"},
961961
},
@@ -1039,8 +1039,8 @@ func TestCreatesDNSNSRecordsForLoadBalancer(t *testing.T) {
10391039
customConfig.ClusterGeoTag = "eu"
10401040
customConfig.DelegationZones = depresolver.DelegationZones{
10411041
{
1042-
Domain: dnsZone,
1043-
Zone: "example.com",
1042+
Zone: dnsZone,
1043+
ParentZone: "example.com",
10441044
ClusterNSName: "gslb-ns-eu-cloud.example.com",
10451045
ExtClusterNSNames: map[string]string{"eu": "gslb-ns-us-cloud.example.com", "za": "gslb-ns-za-cloud.example.com"},
10461046
},

controllers/providers/dns/external.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (p *ExternalDNSProvider) CreateZoneDelegation(zoneInfo *depresolver.Delegat
6666
}
6767

6868
func (p *ExternalDNSProvider) Finalize(zoneInfo *depresolver.DelegationZoneInfo) error {
69-
log.Info().Msgf("Domain %s will be deleted by removing delegation DNSEndpoint %s", zoneInfo.Domain, zoneInfo.GetExternalDNSEndpointName())
69+
log.Info().Msgf("Domain %s will be deleted by removing delegation DNSEndpoint %s", zoneInfo.Zone, zoneInfo.GetExternalDNSEndpointName())
7070
return nil
7171
}
7272

controllers/providers/dns/external_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ func TestCreateZoneDelegation(t *testing.T) {
9797
NSRecordTTL: 60,
9898
DelegationZones: []*depresolver.DelegationZoneInfo{
9999
{
100-
Domain: "cloud.example.com",
101-
Zone: "example.com",
100+
Zone: "cloud.example.com",
101+
ParentZone: "example.com",
102102
NegativeTTL: 60,
103103
IPs: []string{"10.0.0.1", "10.0.0.2"},
104104
ClusterNSName: "gslb-ns-eu-k8gb-test-gslb.cloud.example.com",
@@ -118,8 +118,8 @@ func TestCreateZoneDelegation(t *testing.T) {
118118
NSRecordTTL: 60,
119119
DelegationZones: []*depresolver.DelegationZoneInfo{
120120
{
121-
Domain: "cloud.example.com",
122-
Zone: "example.com",
121+
Zone: "cloud.example.com",
122+
ParentZone: "example.com",
123123
NegativeTTL: 60,
124124
IPs: []string{"10.0.0.1", "10.0.0.2"},
125125
ClusterNSName: "gslb-ns-eu-k8gb-test-gslb.cloud.example.com",
@@ -139,8 +139,8 @@ func TestCreateZoneDelegation(t *testing.T) {
139139
NSRecordTTL: 60,
140140
DelegationZones: []*depresolver.DelegationZoneInfo{
141141
{
142-
Domain: "cloud.example.com",
143-
Zone: "example.com",
142+
Zone: "cloud.example.com",
143+
ParentZone: "example.com",
144144
NegativeTTL: 60,
145145
IPs: []string{"10.0.0.1", "10.0.0.2"},
146146
ClusterNSName: "gslb-ns-eu-k8gb-test-gslb.cloud.example.com",
@@ -149,8 +149,8 @@ func TestCreateZoneDelegation(t *testing.T) {
149149
},
150150
},
151151
{
152-
Domain: "cloud.example.org",
153-
Zone: "example.org",
152+
Zone: "cloud.example.org",
153+
ParentZone: "example.org",
154154
NegativeTTL: 60,
155155
IPs: []string{"10.0.0.1", "10.0.0.2"},
156156
ClusterNSName: "gslb-ns-eu-k8gb-test-gslb.cloud.example.org",

controllers/providers/dns/infoblox.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (p *InfobloxProvider) CreateZoneDelegation(zoneInfo *depresolver.Delegation
6161
if err != nil {
6262
return err
6363
}
64-
findZone, err := p.getZoneDelegated(objMgr, zoneInfo.Domain)
64+
findZone, err := p.getZoneDelegated(objMgr, zoneInfo.Zone)
6565
if err != nil {
6666
return err
6767
}
@@ -74,12 +74,12 @@ func (p *InfobloxProvider) CreateZoneDelegation(zoneInfo *depresolver.Delegation
7474

7575
if findZone == nil {
7676
log.Info().
77-
Str("DNSZone", zoneInfo.Domain).
77+
Str("DNSZone", zoneInfo.Zone).
7878
Msg("Creating delegated zone")
7979
log.Debug().
8080
Interface("records", delegateTo).
8181
Msg("Delegated records")
82-
_, err = p.createZoneDelegated(objMgr, zoneInfo.Domain, delegateTo)
82+
_, err = p.createZoneDelegated(objMgr, zoneInfo.Zone, delegateTo)
8383
if err != nil {
8484
return err
8585
}
@@ -95,7 +95,7 @@ func (p *InfobloxProvider) CreateZoneDelegation(zoneInfo *depresolver.Delegation
9595
Interface("records", findZone.DelegateTo).
9696
Msg("Found delegated zone records")
9797
log.Info().
98-
Str("DNSZone", zoneInfo.Domain).
98+
Str("DNSZone", zoneInfo.Zone).
9999
Interface("serverList", currentList).
100100
Msg("Updating delegated zone with the server list")
101101
_, err = p.updateZoneDelegated(objMgr, findZone.Ref, currentList)
@@ -108,7 +108,7 @@ func (p *InfobloxProvider) CreateZoneDelegation(zoneInfo *depresolver.Delegation
108108
}
109109

110110
func (p *InfobloxProvider) Finalize(zoneInfo *depresolver.DelegationZoneInfo) error {
111-
log.Info().Msgf("Domain %s must deleted by manually in Infoblox", zoneInfo.Domain)
111+
log.Info().Msgf("Zone %s must deleted by manually in Infoblox", zoneInfo.Zone)
112112
return nil
113113
}
114114

controllers/providers/dns/infoblox_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ func TestCreateZoneDelegationInfoblox(t *testing.T) {
4646
NSRecordTTL: 30,
4747
DelegationZones: []*depresolver.DelegationZoneInfo{
4848
{
49-
Zone: "example.com",
50-
Domain: "cloud.example.com",
49+
ParentZone: "example.com",
50+
Zone: "cloud.example.com",
5151
ClusterNSName: "gslb-ns-eu-cloud.example.com",
5252
IPs: []string{"10.0.0.1", "10.0.0.2"},
5353
NegativeTTL: 30,
@@ -102,8 +102,8 @@ func TestCreateZoneDelegationInfoblox(t *testing.T) {
102102
NSRecordTTL: 30,
103103
DelegationZones: []*depresolver.DelegationZoneInfo{
104104
{
105-
Zone: "example.com",
106-
Domain: "cloud.example.com",
105+
ParentZone: "example.com",
106+
Zone: "cloud.example.com",
107107
ClusterNSName: "gslb-ns-eu-cloud.example.com",
108108
IPs: []string{"10.0.0.1", "10.0.0.2"},
109109
NegativeTTL: 30,
@@ -147,8 +147,8 @@ func TestCreateZoneDelegationInfoblox(t *testing.T) {
147147
NSRecordTTL: 30,
148148
DelegationZones: []*depresolver.DelegationZoneInfo{
149149
{
150-
Zone: "example.com",
151-
Domain: "cloud.example.com",
150+
ParentZone: "example.com",
151+
Zone: "cloud.example.com",
152152
ClusterNSName: "gslb-ns-eu-cloud.example.com",
153153
IPs: []string{"10.0.0.1", "10.0.0.2"},
154154
NegativeTTL: 30,
@@ -221,8 +221,8 @@ func TestCreateZoneDelegationInfoblox(t *testing.T) {
221221
NSRecordTTL: 30,
222222
DelegationZones: []*depresolver.DelegationZoneInfo{
223223
{
224-
Zone: "example.com",
225-
Domain: "cloud.example.com",
224+
ParentZone: "example.com",
225+
Zone: "cloud.example.com",
226226
ClusterNSName: "gslb-ns-eu-cloud.example.com",
227227
IPs: []string{"10.0.0.1", "10.0.0.2"},
228228
NegativeTTL: 30,

0 commit comments

Comments
 (0)