Skip to content

Commit

Permalink
DNS: Don't try to apply empty changesets
Browse files Browse the repository at this point in the history
For GCE this was resulting in confusing error messages.
  • Loading branch information
justinsb committed Feb 3, 2020
1 parent d70cc9e commit c22b4e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions dns-controller/pkg/dns/dnscontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ func (c *DNSController) runOnce() error {
}

for key, changeset := range op.changesets {
if changeset.IsEmpty() {
continue
}

klog.V(2).Infof("applying DNS changeset for zone %s", key)
if err := changeset.Apply(); err != nil {
klog.Warningf("error applying DNS changeset for zone %s: %v", key, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ func (c *ResourceRecordChangeset) Upsert(rrset dnsprovider.ResourceRecordSet) dn
}

func (c *ResourceRecordChangeset) Apply() error {
if c.IsEmpty() {
return nil
}

rrsets := c.rrsets

service := rrsets.zone.zones.interface_.service.Changes()
Expand Down Expand Up @@ -115,7 +119,7 @@ func (c *ResourceRecordChangeset) Apply() error {
}

func (c *ResourceRecordChangeset) IsEmpty() bool {
return len(c.additions) == 0 && len(c.removals) == 0
return len(c.additions) == 0 && len(c.removals) == 0 && len(c.upserts) == 0
}

// ResourceRecordSets returns the parent ResourceRecordSets
Expand Down

0 comments on commit c22b4e9

Please sign in to comment.