Skip to content

Commit

Permalink
External dns ownership fix (#32)
Browse files Browse the repository at this point in the history
* Extend dnsendpoint tests with IP array

* Tentative fix for externald ownership mismatch

We faced ` [] because owner id does not match, found: \"\", required: \"default\""`
during updates of gslb controlled dns entries.
To fix that:
* Update to latest 5.18 external-dns release
* Explicitly set `txt-ownership-id` to avoid mismatch
  • Loading branch information
ytsarev authored Jan 22, 2020
1 parent e4a2f2f commit e085c69
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions chart/ohmyglb/templates/external-dns/external-dns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ spec:
- --source=crd
- --provider=coredns
- --log-level=debug # debug only
- --txt-owner-id="ohmyglb"
env:
- name: ETCD_URLS
value: http://etcd-cluster-client:2379
2 changes: 1 addition & 1 deletion chart/ohmyglb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ohmyglb:
extGslbClusters: "" # comma-separated list of FQDNs pointing to external Gslb enabled clusters to work with

externaldns:
image: registry.opensource.zalan.do/teapot/external-dns:latest
image: eu.gcr.io/k8s-artifacts-prod/external-dns/external-dns:v0.5.18

etcd-operator:
customResources:
Expand Down
16 changes: 10 additions & 6 deletions pkg/controller/gslb/gslb_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,14 @@ func TestGslbController(t *testing.T) {

t.Run("Gslb creates DNSEndpoint CR for healthy ingress hosts", func(t *testing.T) {

ingressIP := corev1.LoadBalancerIngress{
IP: "10.0.0.1",
ingressIPs := []corev1.LoadBalancerIngress{
{IP: "10.0.0.1"},
{IP: "10.0.0.2"},
{IP: "10.0.0.3"},
}
ingress.Status.LoadBalancer.Ingress = append(ingress.Status.LoadBalancer.Ingress, ingressIP)

ingress.Status.LoadBalancer.Ingress = append(ingress.Status.LoadBalancer.Ingress, ingressIPs...)

err := cl.Status().Update(context.TODO(), ingress)
if err != nil {
t.Fatalf("Failed to update gslb Ingress Address: (%v)", err)
Expand All @@ -215,12 +219,12 @@ func TestGslbController(t *testing.T) {
DNSName: "localtargets.app3.cloud.example.com",
RecordTTL: 30,
RecordType: "A",
Targets: externaldns.Targets{"10.0.0.1"}},
Targets: externaldns.Targets{"10.0.0.1", "10.0.0.2", "10.0.0.3"}},
{
DNSName: "app3.cloud.example.com",
RecordTTL: 30,
RecordType: "A",
Targets: externaldns.Targets{"10.0.0.1"}},
Targets: externaldns.Targets{"10.0.0.1", "10.0.0.2", "10.0.0.3"}},
}

prettyGot := prettyPrint(got)
Expand All @@ -236,7 +240,7 @@ func TestGslbController(t *testing.T) {
// code so I will keep it this way for a time being
t.Run("DNS Record reflection in status", func(t *testing.T) {
got := gslb.Status.HealthyRecords
want := map[string][]string{"app3.cloud.example.com": {"10.0.0.1"}}
want := map[string][]string{"app3.cloud.example.com": {"10.0.0.1", "10.0.0.2", "10.0.0.3"}}
if !reflect.DeepEqual(got, want) {
t.Errorf("got:\n %s healthyRecords status,\n\n want:\n %s", got, want)
}
Expand Down

0 comments on commit e085c69

Please sign in to comment.