fix(api): Improve error handling for invalid domains #18
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.
Updating or deleting DNS records fails if some service is configured with an invalid domain name.
To reproduce the problem, assume that a user has created a domain
test1234.runs.on.stackit.cloud
, and has set up two loadbalancer services in the cluster. Service A is configured to use domainservice.test1234.runs.on.stackit.cloud
, and Service B uses domainservice.test1234-invalid.runs.on.stackit.cloud
(notice the-invalid
). Wait until the DNS records of service A are created by external DNS in the test1234 domain. Then remove Service A. Notice that the DNS record is not removed as long as Service B with the invalid domain exists.This is a result of the error handling in
StackitDNSProvider.ApplyChanges
which exits on the first error. As a result an invalid domain will block all Update / Delete operations. To address the problem, I've changed the code to collect all changeTasks first and execute all of them at once. This design is also used by some in-tree extension of external-dns and ensures that an invalid domain cannot block other operations.