-
Notifications
You must be signed in to change notification settings - Fork 397
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
GCLOUD: Fix issue on creating/deleting/updating TXT records #3011
Conversation
Ping @riyadhalnur, the maintainer of the Google Cloud DNS provider. |
@ingwarsw thanks for the PR. I'll review this soon |
Interesting bug! Do you think you could construct an integration test that detects this situation?
Hey, @blackshadev! You're my ordering guru. Any thoughts? |
I dont think its possible.. |
I don't fully understand the problem here. I tried deduce the problem from the code and description. But it really doesn't come through to me. Could you maybe provide a record set diff which fails and one which succeed to examplify the issue? Regarding the ordering let me explain what is possible. DNSControl can order your change sets based on dependencies. But than DNSControl need to know the dependent record. You can take a look at record.go:458, TXT records generally do not have such dependencies. So I am not sure how this would help you. Second thing to note is the fact that DNSControl sorts change sets only. So the diff2 package ByRecordSet clusters the changes between record set and the ordering happen between the RecordSet clusters, not within the RecordSet. If you need that, you would need another diff2 method. I hope this information helps you, and you can possible give me an example, maybe we can solve this issue within the DNSControl ordering itself. |
So to rephrase.. And to delete record you need to send EXACTLY same content of the record (including order of rrds). And DNSControl sorts the rrds here. So if you have in GCLOUD record thats But if we will take original order it will pass properly. |
BTW.. Im not sure why Maybe my poor man
And now del throws errors because as you clearly see what we send as del was different as what we got from GCLOUD.. |
Ok, now I understand. GCloud expects the recordset referenced to be exactly the same as how it is reported by itself. In that case, your approach of using the original records seems very logical and valid. We could alter the way DNSControl reorders records within a record set, but let's be honest, if we fix how google expects it, some other provider will break. One thing that would intrest me: There is a flag to disable sorting: |
I dont know what happened but today google returns TXT RRDs always sorted.. So Im not sure if my PR is still needed (I still think its safe to always send what GCLOUD returned).. |
That's good news! I'm guessing that people complained and they took action.
I'm ambivalent. However, if we do adopt this PR, I recommend a different implementation. The PR currently uses the "existing" record to determine what the order should be. That could have problems if "existing" gets mutated. Instead, it should record the result of the API call in RecordConfig.Original, then refer to that. It's probably the same data, but .Original is guaranteed to be correct because (1) it is never modified, (2) it is a pointer to the data that we know is correct. That change would look something like:
A good example to copy is ROUTE53:
|
excellent! (and much more simple) |
P.S. Excellent detective work on this one! Such an obscure bug! I don't know how you figured it out! Great job! |
Our pipeline had been failing constantly over last few months.. and when everyone was mad enough it happened we just leaved it unapplied and I spend few h trying to debug issue.. |
Fixes the issue with updating/deleting TXT (maybe others too) record types from GCLOUD.
Under the hood DNS had TXT resources that was not sorted and
diff2.ByRecordSet
returns changes that have sorted values so we tried to send request with proper values but sorted differently, and seems like google is picky about ordering.Maybe it was possible to pass
compFunc
but I didnt get how to do that..Taking the original records was way easier, and should always return proper order.
Easiest reproduction case.
Add any TXT record with entries not sorted alphabetically (manually), and do any change/delete via dnscontrol.