Skip to content

Commit 3eb8828

Browse files
committed
rename zone to loadBalancedZone
Signed-off-by: Andre Aguas <[email protected]>
1 parent 0832d27 commit 3eb8828

28 files changed

+111
-1634
lines changed

chart/k8gb/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ k8gb-{{ index (split ":" (index (split ";" (include "k8gb.dnsZonesString" .)) "_
9393
{{- $entries := list -}}
9494
{{- range .Values.k8gb.dnsZones }}
9595
{{- $dnsZoneNegTTL := toString (.dnsZoneNegTTL | default "300") }}
96-
{{- $entry := printf "%s:%s:%s" .parentZone .zone $dnsZoneNegTTL }}
96+
{{- $entry := printf "%s:%s:%s" .parentZone .loadBalancedZone $dnsZoneNegTTL }}
9797
{{- $entries = append $entries $entry }}
9898
{{- end }}
9999
{{- join ";" $entries }}

chart/k8gb/templates/coredns/cm.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ data:
1212
{{- $dnsZones := split ";" $dnsZonesRaw }}
1313
{{- range $dnsZones }}
1414
{{- $parts := split ":" . }}
15-
{{- $zone := index $parts "_1" }}
15+
{{- $loadBalancedZone := index $parts "_1" }}
1616
{{- $dnsZoneNegTTL := index $parts "_2" }}
17-
{{ $zone }}:5353 {
17+
{{ $loadBalancedZone }}:5353 {
1818
errors
1919
health
2020
{{- if $.Values.k8gb.coredns.extra_plugins }}

chart/k8gb/values-extdns.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ k8gb:
22
clusterGeoTag: "us"
33
extGslbClustersGeoTags: "eu"
44
dnsZones:
5-
- zone: "k8gb.io"
6-
domain: "cloud.k8gb.io"
5+
- parentZone: "k8gb.io"
6+
loadBalancedZone: "cloud.k8gb.io"
77
dnsZoneNegTTL: 30
88

99
extdns:

chart/k8gb/values.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@
422422
"k8gbDnsZone": {
423423
"type": "object",
424424
"properties": {
425-
"zone": {
425+
"loadBalancedZone": {
426426
"type": "string",
427427
"format": "idn-hostname"
428428
},
@@ -437,7 +437,7 @@
437437
}
438438
},
439439
"required": [
440-
"zone",
440+
"loadBalancedZone",
441441
"parentZone"
442442
]
443443
},

chart/k8gb/values.yaml

Lines changed: 2 additions & 2 deletions
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-
- 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)
21+
- parentZone: "example.com" # -- parent zone which would contain gslb zone to delegate (same meaning as the old edgeDNSZone)
22+
loadBalancedZone: "cloud.example.com" # -- zone controlled by gslb (same meaning as the old 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

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
type DelegationZones []*DelegationZoneInfo
3030

3131
type DelegationZoneInfo struct {
32-
Zone string // cloud.example.com
32+
LoadBalancedZone string // cloud.example.com
3333
ParentZone string // example.com
3434
NegativeTTL int
3535
ClusterNSName string
@@ -39,9 +39,9 @@ type DelegationZoneInfo struct {
3939

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

4747
zones := config.dnsZones
@@ -79,7 +79,12 @@ 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{parentZone: strings.Trim(touple[0], " "), zone: strings.Trim(touple[1], " "), negTTL: strings.Trim(touple[2], " ")})
82+
tuples = append(tuples,
83+
info{
84+
parentZone: strings.Trim(touple[0], " "),
85+
loadBalancedZone: strings.Trim(touple[1], " "),
86+
negTTL: strings.Trim(touple[2], " "),
87+
})
8388
}
8489
return tuples, nil
8590
}
@@ -96,17 +101,17 @@ func parseDelegationZones(config *Config) ([]*DelegationZoneInfo, error) {
96101
return dzi, fmt.Errorf("invalid value of delegation zones: %s", zones)
97102
}
98103
zoneInfo := &DelegationZoneInfo{
99-
Zone: inf.zone,
100-
ParentZone: inf.parentZone,
101-
NegativeTTL: negTTL,
102-
ClusterNSName: getNsName(config.ClusterGeoTag, inf.zone, inf.parentZone),
104+
LoadBalancedZone: inf.loadBalancedZone,
105+
ParentZone: inf.parentZone,
106+
NegativeTTL: negTTL,
107+
ClusterNSName: getNsName(config.ClusterGeoTag, inf.loadBalancedZone, inf.parentZone),
103108
ExtClusterNSNames: func(zone, edge string) map[string]string {
104109
m := map[string]string{}
105110
for _, tag := range config.extClustersGeoTags {
106111
m[tag] = getNsName(tag, zone, edge)
107112
}
108113
return m
109-
}(inf.zone, inf.parentZone),
114+
}(inf.loadBalancedZone, inf.parentZone),
110115
}
111116
dzi = append(dzi, zoneInfo)
112117
}
@@ -132,7 +137,7 @@ func (z *DelegationZoneInfo) GetNSServerList() []string {
132137

133138
// GetExternalDNSEndpointName returns name of endpoint sitting in k8gb namespace
134139
func (z *DelegationZoneInfo) GetExternalDNSEndpointName() string {
135-
var suffix = strings.Trim(strings.ReplaceAll(z.Zone, ".", "-"), " ")
140+
var suffix = strings.Trim(strings.ReplaceAll(z.LoadBalancedZone, ".", "-"), " ")
136141
return fmt.Sprintf("k8gb-ns-extdns-%s", suffix)
137142
}
138143

@@ -167,14 +172,14 @@ func (d *DelegationZones) ContainsZone(host string) bool {
167172
func (d *DelegationZones) ListZones() []string {
168173
var zones []string
169174
for _, z := range *d {
170-
zones = append(zones, z.Zone)
175+
zones = append(zones, z.LoadBalancedZone)
171176
}
172177
return zones
173178
}
174179

175180
func (d *DelegationZones) getZone(host string) *DelegationZoneInfo {
176181
for _, z := range *d {
177-
if strings.Contains(host, z.Zone) {
182+
if strings.Contains(host, z.LoadBalancedZone) {
178183
return z
179184
}
180185
}

controllers/depresolver/depresolver_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,10 +1314,10 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc3.eee`
13141314
assert: func(zoneInfo []*DelegationZoneInfo, err error) {
13151315
assert.NoError(t, err)
13161316
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1317-
return info.ParentZone == "example.com" && info.Zone == "cloud.example.com"
1317+
return info.ParentZone == "example.com" && info.LoadBalancedZone == "cloud.example.com"
13181318
}))
13191319
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1320-
return info.ParentZone == "example.io" && info.Zone == "cloud.example.io"
1320+
return info.ParentZone == "example.io" && info.LoadBalancedZone == "cloud.example.io"
13211321
}))
13221322
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
13231323
return info.ClusterNSName == "gslb-ns-us-cloud.example.com" &&
@@ -1347,10 +1347,10 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc3.eee`
13471347
assert: func(zoneInfo []*DelegationZoneInfo, err error) {
13481348
assert.NoError(t, err)
13491349
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1350-
return info.ParentZone == "example.com" && info.Zone == "cloud.example.com"
1350+
return info.ParentZone == "example.com" && info.LoadBalancedZone == "cloud.example.com"
13511351
}))
13521352
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1353-
return info.ParentZone == "example.com" && info.Zone == "pair.example.com"
1353+
return info.ParentZone == "example.com" && info.LoadBalancedZone == "pair.example.com"
13541354
}))
13551355
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
13561356
return info.ClusterNSName == "gslb-ns-us-cloud.example.com" &&
@@ -1380,10 +1380,10 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc3.eee`
13801380
assert: func(zoneInfo []*DelegationZoneInfo, err error) {
13811381
assert.NoError(t, err)
13821382
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1383-
return info.ParentZone == "example.com" && info.Zone == "cloud.example.com"
1383+
return info.ParentZone == "example.com" && info.LoadBalancedZone == "cloud.example.com"
13841384
}))
13851385
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1386-
return info.ParentZone == "example.io" && info.Zone == "cloud.example.io"
1386+
return info.ParentZone == "example.io" && info.LoadBalancedZone == "cloud.example.io"
13871387
}))
13881388
},
13891389
},
@@ -1399,10 +1399,10 @@ cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc3.eee`
13991399
assert: func(zoneInfo []*DelegationZoneInfo, err error) {
14001400
assert.NoError(t, err)
14011401
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1402-
return info.ParentZone == "example.com" && info.Zone == "cloud.example.com"
1402+
return info.ParentZone == "example.com" && info.LoadBalancedZone == "cloud.example.com"
14031403
}))
14041404
assert.True(t, contains(zoneInfo, func(info *DelegationZoneInfo) bool {
1405-
return info.ParentZone == "example.io" && info.Zone == "cloud.example.io"
1405+
return info.ParentZone == "example.io" && info.LoadBalancedZone == "cloud.example.io"
14061406
}))
14071407
},
14081408
},

0 commit comments

Comments
 (0)