HETZNER_V2: Add provider for Hetzner DNS API#3837
HETZNER_V2: Add provider for Hetzner DNS API#3837tlimoncelli merged 12 commits intoStackExchange:mainfrom
Conversation
|
Thanks for sharing this! Looks good so far! Yes, creating a new provider is often best when SDKs change radically. We had to do with with GANDI_V5 (replaced GANDI), and CLOUDFLARE_API (replaced CLOUDFLARE). One bit of feedback: Please keep names consistent. Go doesn't like hyphens or underlines in names, so let's avoid that (the Gandi and Cloudflare examples above have trouble with this reguard). Everything should be either hetzner2 or HETZNER2. For example:
|
|
Thanks for the feedback, Tom.
I've used the same pattern as the Gandi provider: Go package
I would be fine with making the change for |
|
@das7pad Thanks for the feedback, I really appreciate it.
This is expected, you should fetch the zone again after the action completed, there is no way around this. My take away is that more documentation would have been helpful to better understand how to use the SDK/API with regards to actions.
We do no want to assume how a client want to behave, waiting for actions ourselves would assume too much of the user application's behavior. We could indeed build a layer on top, to provide the user with such convenience features, I'll take the feedback with me and see what we can do.
You can decouple calling the API and waiting for the returned actions. This should cut the waiting time by a lot. I'll add more comment about this in the PR review it self. Let me know if after this improvement, you still think a batch processing API is needed?
Yes, this is a pattern that we follow to prevent future breaking changes if we ever want to add a field to the Create/Delete operations. This is expected. I'll address more of the feedback in the pull request review. |
jooola
left a comment
There was a problem hiding this comment.
It is no longer possible to remove your provided name servers from the root/apex. Use-case: dual-home/multi-home zone with fewer than three servers from Hetzner. I'm operating one of these and cannot migrate over until this is fixed.
But this could still work if you keep all three existing NS, and add your additional NS on top of that? Is there a problem with requiring to use all 3 existing Hetzner name servers?
Co-authored-by: "Jonas L." <[email protected]>
Co-authored-by: "Jonas L." <[email protected]>
Co-authored-by: "Jonas L." <[email protected]>
|
I'm going to discuss the naming issue at the monthly video call today: #3798
|
We discussed this. We have a lot of inconsistent naming and the discussion was about whether we should try to fix the old names and what should we do with future names. Our conclusion was:
|
👍 Done in 7bcc943. The integration tests are passing after merging main. |
tlimoncelli
left a comment
There was a problem hiding this comment.
The code looks excellent! Only one minor comment.
Some other things:
.github/workflows/pr_integration_tests.yml: Please add HETZNERV2 to thePROVIDERSlist..goreleaser.yml: Search forProvider-specific changesand add hetznerv2
Thanks!
Tom
Awesome, thanks for the feedback!
Done in daaba36. @jooola Can you provide us/Tom with test credentials for running in CI? |
My registrar used to limit the number of custom nameservers to 5. Trying this again today, it looks like that limitation no longer exists. 7 NS entries is a little excessive, but it will be fine. 😅 |
|
All the points should be addressed now. @jooola Do you want to take another look before we merge this? |
|
@das7pad, regarding test credentials: You should be able to simply register yourself and generate the credentials on your own :) As DNS is free, you won't be charged anything. |
LKaemmerling
left a comment
There was a problem hiding this comment.
Looks good from my perspective, i did not check the code in depth but the documentation and found a few missing ✅
|
Aside from the idna encode on the record names question, this looks good to me 🚀 |
Co-authored-by: "Lukas Kämmerling" <[email protected]>
|
(Force pushed to fix attribution with Umlaut)
As far as I can tell, API tokens cannot be scoped to a (free) product, here DNS. Hence I would prefer for you to provide a token. |
|
The integration tests are passing with We are good to merge this. The credentials for CI can be provided later, preferably by Hetzner. |
|
Thanks for contributing this! Let's discuss the credentials via email. We have a secure way to send secrets. Contact me at tlimoncelli at stack over flow dot com for details. Tom |
|
Thanks for this feature! Any idea when the next release of dnscontrol will be out? |
|
Hopefully this week. I want to merge #3879 first, then it should ship within 24 hours. |
This gives us the latest release of dnscontrol which supports the Hetzner v2 provider. StackExchange/dnscontrol#3837 NixOS/nixpkgs#469113
|
For those watching this issue and wondering if their distro ships this feature yet: It was released as part of 4.28.1: https://github.com/StackExchange/dnscontrol/releases/tag/v4.28.1 Thanks for your work here, @tlimoncelli ! |
Closes #3787
This PR is adding a
HETZNER_V2provider for the "new" Hetzner DNS API.Testing:
preview(see diff for existing zone)preview --populate-on-preview(see full diff for newly created zone)push(see full diff; no diff after push)push(see full diff; no diff after push to newly created zone -- i.e. single pass and done)Details
Feedback for @jooola and @LKaemmerling:
resultvalues are not "up-to-date" after waiting for anAction, e.g.Zone.AuthoritativeNameservers.Assignedis not set whenClient.Zone.Create()returns and the following "wait" will not update it.Actionwith a separate SDK call does not seem very natural to me. Does the SDK-user need to know that you are processing operations asynchronous? (Which seems like an implementation detail to me, something that the SDK could abstrct over.) CanClient.Zone.Create()return the finalZoneinstead of the intermediate result?create 2*100 + delete 2*100 = 400API calls. Previously, these werecreate 1 + delete 100 = 101API calls. Are you planning on adding batch processing again?diff2.CREATEvsdiff2.CHANGEand two calls indiff2.CHANGEfor updating the TTL vs records).Action(e.g.Zone.ChangeRRSetTTL()), others wrap theActionin a struct (Client.Zone.CreateRRSet()) -- even when the struct has a single field (ZoneRRSetDeleteResult).