fix: safely handle concurrent DNS-01 challenges in Present and Cleanup#166
Open
fix: safely handle concurrent DNS-01 challenges in Present and Cleanup#166
Conversation
added 3 commits
February 24, 2026 13:23
… selection Added scenarios for: - Idempotency and record appending during challenges - Proper propagation of TTL configuration - Service Account vs. Auth Token authentication selection - Failure handling during RRSet creation and updates - Robustness against empty record sets
by adding checks whether the challenge key is already existing in the recordset and if not, appending it to it
- delete RRSet if challengeKey is the only record, or there are no records - remove the record if theres more records - do nothing if challengeKey is not existing in the RRSet
2 tasks
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.
Problem:
When
cert-managerprocesses multiple DNS-01 challenges concurrently for the same DNS record, the webhook was suffering from race conditions:Present()was completely overwriting existing TXT records instead of appending new challenge keys.CleanUp()was using a sledgehammer approach, deleting the entire RRSet even if other concurrent challenges were still relying on other TXT keys in that set.This caused challenges to fail or get permanently stuck in a
pendingstate.Solution:
Refactored the DNS record management to properly handle multiple TXT values as a list:
Present(): Now fetches the existing RRSet and appends the new challenge key to the array if it is not already present, preserving existing keys.CleanUp(): filters out only the specific challenge key requested bycert-managerand deletes RRSet only if empty.