kuadrant-operator icon indicating copy to clipboard operation
kuadrant-operator copied to clipboard

Changing gateway listener with DNSPolicy attached results in orphaned DNS records

Open azgabur opened this issue 1 year ago • 3 comments

It is the same issue: https://github.com/Kuadrant/multicluster-gateway-controller/issues/601

After changing Gateway listener from domain specified in Managed zone to a domain specified in different Managed zone the previous DNS record wont get cleaned up and stays in DNS provider.

Steps to reproduce

  1. Have two Managed zones.
  2. Create correctly Gateway, HttpRoute and DnsPolicy.
  3. Edit the Gateway listener so the domain is now under different managed zone.
  4. The DnsPolicy should have status:
'DNSPolicy has encountered some issues: policy is not enforced on any dns record: no routes attached for listeners'

HttpRoute has status:

no hostnames matched parent hostname

DNSRecord CR is deleted and DNS record on provider is NOT deleted. 5. Edit the HttpRoute so it matches the Gateway new listener. 6. Everything reconciles successfully and new hostname works. New DNSRecord CR gets created. 7. Doing DNS lookup on the old hostname will still work.

azgabur avatar Aug 01 '24 12:08 azgabur

I found simpler way to reproduce this with just one ManagedZone.

  1. Create Gateway and HttpPolicy to have same hostname (no wildcards)
  2. Create DNSPolicy
  3. Edit Gateway listener to different hostname
  4. Observe the errors in HttpPolicy and DNSPolicy (same as in first post). Observe the DNSRecord gets deleted.
  5. Edit HttpPolicy to the new hostname
  6. Everything reconciles successfuly
  7. DNS query for old hostname still resturns a result.

azgabur avatar Aug 05 '24 08:08 azgabur

This should be fixed as part of the managed zone removal https://github.com/Kuadrant/dns-operator/pull/203

mikenairn avatar Aug 12 '24 12:08 mikenairn

This should be fixed as part of the managed zone removal Kuadrant/dns-operator#203

Will be looked into after Kuadrant/dns-operator#203 as we will probably mark the rootHost filed as immutable and delete and re-create the DNSRecord resource in the kuadrant operator instead of handling rootHost changes in the dnsrecord controller.

mikenairn avatar Aug 13 '24 10:08 mikenairn

Yes I can confirm the managed zone removal did not fix this bug.

azgabur avatar Aug 26 '24 12:08 azgabur