Skip to content
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

feat: add hetzner cloud provider #167

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Thunderbottom
Copy link

adds a provider for hetzner cloud that does:

  • filter instances by label selector and datacenter location
  • fetch public/private IP address based on provided address type
  • checks for associated floating IPs in case of blocked public/private IP addresses
  • accepts API token as environment variable: HCLOUD_TOKEN

Enhancement over: #159
Closes: #73

@hashicorp-cla
Copy link

hashicorp-cla commented Feb 15, 2021

CLA assistant check
All committers have signed the CLA.

provider/hcloud/hcloud_discover.go Outdated Show resolved Hide resolved
provider/hcloud/hcloud_discover.go Outdated Show resolved Hide resolved
provider/hcloud/hcloud_discover_test.go Show resolved Hide resolved
Copy link

@VoyTechnology VoyTechnology left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@svenstaro
Copy link

Could we get this merged?

@laukaichung
Copy link

laukaichung commented Apr 6, 2021

While waiting for it to be merged, is there any way for now to automatically get a list of private IPs for the retry_join field without hardcoding a list of IPs? I'm planning to run a consul cluster on Hetzner Cloud with private network. It seems that GetPrivateIPs from go-sockaddr, e,g retry_join={{ GetPrivateIPs }} would work but I''m not sure how to use it in the config.

@dnephin
Copy link
Contributor

dnephin commented Apr 6, 2021

I don't think there is any support for that yet, but hashicorp/consul#9100 is a proposal that should make it possible.

@vitamindit
Copy link

While waiting for it to be merged, is there any way for now to automatically get a list of private IPs for the retry_join field without hardcoding a list of IPs? ...

I'm waiting for it too :) ... here is my approach:

You get private IP addresses once the server is assigned to a network or subnet.

Then you should use e.g. the hcloud server-info API. This will return the available servers including their private IP addresses for available interfaces.

From this server-info response you can then construct the list of desired private cluster IP addresses.

@KevinGimbel
Copy link

What's blocking this PR from being merged? I'm currently evaluating Consul for work and I'd love to use/try the auto-discovery feature as part of this PoC.

@gardion
Copy link

gardion commented Jun 17, 2021

Please merge, it would massively help adopting Consul for our platform.

@tomschlenkhoff
Copy link

Any help needed? Any blockers left? If not please (with sugar on top) merge, would be a boost for Consul/Hetzner adoption in Germany/EU.

@Thunderbottom
Copy link
Author

I believe there's no blockers, although the repo hasn't been updated since last year. So I'm not sure if it'll be merged any time soon.

ronaldburns added a commit to HBGames/go-discover that referenced this pull request Feb 27, 2022
commit 7623bb6
Author: Chinmay D. Pai <[email protected]>
Date:   Tue Feb 16 03:56:04 2021 +0530

    doc: add documentation for hcloud

    Signed-off-by: Chinmay D. Pai <[email protected]>

commit 297a1f5
Author: Chinmay D. Pai <[email protected]>
Date:   Tue Feb 16 03:54:08 2021 +0530

    ci: add tests for hcloud provider

    * add terraform files for hcloud server setup
    * add tests for public IPv4, IPv6, and private IPv4
    * add test to check for location filter
    * add circleci entry for hcloud provider

    Signed-off-by: Chinmay D. Pai <[email protected]>

commit 49c8fb3
Author: Chinmay D. Pai <[email protected]>
Date:   Tue Feb 16 03:51:44 2021 +0530

    feat: add hcloud to providers map and update go modules

    * adds hcloud provider to providers map
    * adds go module entry for hcloud, updates go mod sum

    Signed-off-by: Chinmay D. Pai <[email protected]>

commit 0ea43fc
Author: Chinmay D. Pai <[email protected]>
Date:   Tue Feb 16 03:43:18 2021 +0530

    feat: add hetzner cloud (hcloud) provider

    adds a provider for hetzner cloud that does:

    * filter instances by label selector and datacenter location
    * fetch public/private IP address based on provided address type
    * checks for associated floating IPs in case of blocked public/private IP addresses
    * accepts API token as environment variable: HCLOUD_TOKEN

    Signed-off-by: Chinmay D. Pai <[email protected]>
provider/hcloud/hcloud_discover.go Outdated Show resolved Hide resolved
@ronaldburns
Copy link

ronaldburns commented Feb 27, 2022

This is a feature we need for our infrastructure. It doesn't appear like it's going to be committed anytime soon.
We've forked this and made a fix or two.

go-discover
consul

If you'd like to immediately use this implementation, binaries have been added for the latest releases.

Consul 1.11.3 (hcloud)

Consul 1.11.4 (hcloud)

Consul 1.12.0-beta1 (hcloud)

@devnet-io
Copy link

What are the blockers on getting this merged? This will be very useful for my org. Happy to assist with what is needed.

@KrakenMare
Copy link

Echoing the above. It would be fantastic to see this merged or insight into what is needed for a merge.

@pugnacity
Copy link

any news here?

@marco-m
Copy link

marco-m commented Nov 3, 2022

Hello @dnephin, @riddhi89, @alvin-huang,
we were almost there with #159 :-), then after a while @Thunderbottom dared to summon the skeleton (just past-Halloween pun) and did this second attempt.
I understand very well that you are fully loaded, but if you could spare a moment to review this PR many of us would be happy. Thanks again!
@Thunderbottom would you have time to resolve the conflicts, to ease the work of the HashiCorp reviewers? Merci!

test/tf/hcloud/versions.tf Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@acaloiaro
Copy link

FYI @Thunderbottom I can't imagine you're enthusiastic to do more work on this PR since it hasn't been re-reviewed yet, but in case you are -- a merge conflict has occurred.

@Thunderbottom
Copy link
Author

Hi, haven't gotten the time to check GitHub that often anymore. I have fixed all the issues and rebased to the latest master. let me know if anything else needs to be done.

@svenstaro
Copy link

@riddhi89 Any chance we could get this merged?

@Neyury
Copy link

Neyury commented Jul 8, 2023

Any updates?

adds a provider for hetzner cloud that does:

* filter instances by label selector and datacenter location
* fetch public/private IP address based on provided address type
* checks for associated floating IPs in case of blocked public/private IP addresses
* accepts API token as environment variable: HCLOUD_TOKEN

Signed-off-by: Chinmay D. Pai <[email protected]>
* adds hcloud provider to providers map
* adds go module entry for hcloud, updates go mod sum

Signed-off-by: Chinmay D. Pai <[email protected]>
* add terraform files for hcloud server setup
* add tests for public IPv4, IPv6, and private IPv4
* add test to check for location filter
* add circleci entry for hcloud provider

Signed-off-by: Chinmay D. Pai <[email protected]>
@Neyury
Copy link

Neyury commented Jul 12, 2023

Hello! @alvin-huang any chance you could review this PR? Or do you have somebody else from HashiCorp to suggest? I really want to see Hetzner Cloud in go-discovery so that Сonsul and Nomad could use auto-join. Thanks!

@acaloiaro
Copy link

acaloiaro commented Jul 12, 2023

@Neyury If you're desperate to use @Thunderbottom's patch, you can do what I did and fork nomad and add a replace to its go.mod as I've done here: hashicorp/nomad@332c3e4

Then my server.server_join stanza looks like:

  server_join {
    retry_join = [ "provider=hcloud label_selector=nomad-server apiToken=${hetzner_compute_access_token}" ]
  }

Note: You'll want to label your nomad server compute nodes with nomad-server to use the above.

I've been running a hetzner nomad cluster this way for over 6 months. I do recommend pinning your fork to a tagged version of nomad, however.

I have a 1.4.x nomad build with patched go-discover here: https://github.com/acaloiaro/nomad/releases/tag/v1.4.x

You really should not use binaries from unknown strangers on the internet. But feel free to use it in a dev/test environment if you feel that it's sufficiently isolated from the rest of your infrastructure

@tagirb
Copy link

tagirb commented Jul 14, 2023 via email

Copy link

@apricote apricote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Julian here from the @hetznercloud Integrations team. This looks fine regarding the usage of hcloud-go, I can not speak about go-discover.

Happy to help if you got any questions.

provider/hcloud/hcloud_discover.go Outdated Show resolved Hide resolved
@acaloiaro
Copy link

acaloiaro commented Aug 25, 2023

Hashicorp are "semi-actively moving our repos to https://github.com/hashicorp/go-netaddr".

I emailed a member of their team to learn about the status of this repository. Those are the words of one individual, but you can see from the project activity that the project is not under heavy development.

Anyone waiting for this or other features to land in go-discover should probably not hold their breath about them being added to go-discover. It sounds like this project has become too brittle and difficult to maintain, motivating the migration to go-netaddr. An understandable move given this project's dependencies.

With that said, I don't see how go-netaddr replaces go-discover's cloud host-aware functionality. go-netaddr seems like a nice complement to, but not replacement for go-discover.

@kaspergrubbe
Copy link

Hello from 2024, I also hit this in my own setup, and would have loved for go-discover to support hcloud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Hetzner