Skip to content

Commit

Permalink
DNS: Skip deleting records that were not published.
Browse files Browse the repository at this point in the history
pkg/operator/controller/dns/controller.go:
When deleting DNS records from the provider, only delete records that
have been successfully published by the provider. This resolves
BZ#1916401, in which an ingress controller created with a domain
that refers to a non-existent zone cannot be deleted. If the provider
failed to publish the DNS record, it will also fail to delete it.
It is safe to delete a DNSRecord resource in the cluster when the record
does not exist in the provider, since no upstream record needs to be
deleted first.
  • Loading branch information
sgreene570 committed Jan 14, 2021
1 parent 3bb8ed5 commit 4b0fc1e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/operator/controller/dns/controller.go
Expand Up @@ -322,6 +322,11 @@ func (r *reconciler) delete(record *iov1.DNSRecord) error {
var errs []error
for i := range record.Status.Zones {
zone := record.Status.Zones[i].DNSZone
// If the record is currently not published in a zone,
// skip deleting it for that zone.
if !recordIsAlreadyPublishedToZone(record, &zone) {
continue
}
err := r.dnsProvider.Delete(record, zone)
if err != nil {
errs = append(errs, err)
Expand Down

0 comments on commit 4b0fc1e

Please sign in to comment.