DNS: Don't try to apply empty changesets

For GCE this was resulting in confusing error messages.
This commit is contained in:
Justin SB 2020-02-03 10:18:43 -05:00
parent ef5c0de500
commit 520474468d
2 changed files with 9 additions and 1 deletions

View File

@ -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)

View File

@ -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()
@ -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