-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(provider/google): preserve gcp txt ownership #5855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(provider/google): preserve gcp txt ownership #5855
Conversation
The change teaches the Google provider to bundle record-type swaps into a single Cloud DNS change set. It also carries the ownership forward. * Add new `extractTypeSwaps` helper to pair create/delete endpoints by name * Modify `extractTypeSwaps` to skip TXT records * Modify `extractTypeSwaps` to copy owner label of the prior RRset onto the new record before both ends of the swap are appended to the change * Modify `ApplyChanges` to receive the new `extractTypeSwaps` helper's result for one astomic delete+add per type change * Add `TestGoogleApplyChangesTypeSwap` to set up A to CNAME transition * Add tests * Assert helper finds a swap * Verify that zone holds the CNAME * Verify that create endpoint retains original owner label Signed-off-by: Tobias Harnickell <[email protected]>
* Maintain TXT ownership by skipping TXT in type swaps * Carry owner label forward when swapping record types * Add tests for swap logic * Refactor swap extraction for clarity Signed-off-by: Tobias Harnickell <[email protected]>
…-preserve-gcp-txt-ownership Signed-off-by: Tobias Harnickell <[email protected]>
* Fix `TestGoogleExtractTypeSwapsConsumesSingleDelete` flakiness by asserting A-record as the chosen swap source * Remove unused `matchedType` variable * Initialize `remainingDeletes` with `make([]*endpoint.Endpoint, 0, len(deleteEndpoints))` so "no swaps" mirrors the preallocation used for `remainingCreates` * Document invariants and rationale for `extractTypeSwaps` in code comment * Evaluate buckets deterministically by `typeSwapTypePriority`, owner-label preference and stable tie-preakters (leftover deletions also deterministically emitted) Signed-off-by: Tobias Harnickell <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @TobyTheHutt. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Split unnecessarily long lines. Signed-off-by: Tobias Harnickell <[email protected]>
I was working once or twice with GCP, same time AWS and Azure follow same principle record type is immutable. I'm not too sure how exactly this was resolved, but assuming this is not a case for AWS for example, which means, two records with only different record type, actually two distinct records. So if we have RecordA of type A, changes it's type to type AAAA, we currently have
Few questions;
|
How this was resolved for AWS #1867 We may need to introduce a principle or best practice for providers add to contributor docs if we could not force a common interface, on what is the correct order of changes to avoid such cases |
In cases where a record type changes, resulting in a DELETE + CREATE, retaining the TXT record could be considered an improvement that can be applied across all providers. However, implementing changes to TXT records is not straightforward, as it carries multiple risks and quite often project owners involved with final decision. |
What does it do ?
dns.Change
that deletes the old type first and adds the new type second.external-dns/owner
label by copying it from the deleted record to the newly created record.ApplyChanges
to integrate swaps alongside existing create/update/delete flows, keeping behavior deterministic.strings
import for key normalization.Motivation
Fixes the Google Cloud DNS limitation where ExternalDNS could not change a record’s type at the same name without a manual delete.
It's issuing a delete-then-add, therefore atomically resolving API conflicts.
More