[fix] Removing Stale DNS Entries #1083
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1083 +/- ##
==========================================
+ Coverage 69.23% 69.25% +0.01%
==========================================
Files 71 71
Lines 6566 6589 +23
==========================================
+ Hits 4546 4563 +17
- Misses 1725 1735 +10
+ Partials 295 291 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR improves DNS load balancer record cleanup for LinodeClusters by reconciling earlier during CAPI Machine deletion and by basing stale DNS pruning on the “current desired” DNS entry set (excluding deleting Machines), reducing the chance of leaving stale A/AAAA records behind.
Changes:
- Add a
Machinewatch to the LinodeCluster controller to trigger reconciliation when Machines enter deletion. - Refactor stale DNS cleanup (Linode + Akamai) to use the computed
dnsEntrieslist rather than rebuilding IP lists from LinodeMachine state. - Add a unit test ensuring stale Linode DNS records are deleted for deleting CAPI Machines.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/controller/linodecluster_controller.go | Adds a Machine watch with predicates to trigger LinodeCluster reconciliation during Machine deletion. |
| internal/controller/linodecluster_controller_helpers.go | Adds mapping from Machine events to the corresponding LinodeCluster reconcile request. |
| cloud/services/domains.go | Refactors stale DNS deletion logic to use desired dnsEntries (and removes the older IP-list builder). |
| cloud/services/domains_test.go | Adds a unit test validating stale Linode DNS record deletion when a CAPI Machine is deleting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
The added watch for Machine objects to the LinodeCluster helps improve the timing of DNS record clean ups as the LinodeMachine does not get a call for deletion until the node has been drained. In addition the change to the function for DNS list entries to be removed has been modified to be built off of the state of Machine objects being deleted rather than completely deleted LinodeMachines (where the finalizer has been removed and the object is gone).
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
TODOs: