Uh oh!
There was an error while loading. Please reload this page.
MAJOR: service discovery: Add support for Nomad - #267
Conversation
To test this locally, the easiest way is to run a local nomad agent (instructions here: https://gist.github.com/mr-karan/b1bb4f65ae31d91985e6a64451b79f6e) This config file can be used to connect dataplane to Nomad: service_discovery {
nomads=[
{
Address ="http://127.0.0.1"
Description ="Nomad test system"
Enabled =true
ID ="b40eb63b-2fb2-4996-b870-20f50ca173de"
Name ="my-nomad-service"
Namespace ="*"
Port =4646
RetryTimeout =15
SecretID =""
ServerSlotsBase =10
ServerSlotsGrowthIncrement =10
ServerSlotsGrowthType ="linear"
},
]
}A sample Nomad job can be run using job"doggo" {
datacenters=["dc1"]
type="service"namespace="doggo"group"app" {
count=2network {
port"http" {
to=8080
}
}
task"web" {
driver="docker"service {
provider="nomad"name="doggo-web"tags=["doggo", "web"]
port="http"
}
config {
image="ghcr.io/mr-karan/doggo-api:latest"ports=["http"]
}
resources {
cpu=200memory=200
}
}
}
}When This is how the HAProxy file looks: |
mjuraga
commented
Sep 20, 2022
Hi @mr-karan, thank you for the PR and sorry for delay, I will review this and get back to you. |
mjuraga
commented
Sep 21, 2022
I have a just small comment, can you split the fix to the go-generate stuff into a separate commit to have a cleaner commit history? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mr-karan
commented
Sep 21, 2022
@mjuraga Done! |
mjuraga
commented
Sep 21, 2022
Hi, just a small comment, can we have |
mr-karan
commented
Sep 21, 2022
@mjuraga fixed :) |
mr-karan
commented
Sep 30, 2022
@mjuraga Hey, just checking in if there are any blockers for this to get merged 😅 |
mjuraga
commented
Sep 30, 2022
Hi @mr-karan, sorry for the delay again, we are currently preparing 2.7 version of the dataplaneapi, and we haven't had the chance to properly test this. Saying that we don't want to merge something like this (a new feature) so close to the release without proper testing. On the other side, by just looking at this it looks fine, and will probably get merged right after the release once we have a deeper look and test this. |
mr-karan
commented
Sep 30, 2022
Sure thing, understandable. Thanks for letting me know! |
mjuraga
commented
Sep 30, 2022
Thank you for the patience, I will come back to this as soon as possible, and let you know. |
mr-karan
commented
Jun 22, 2023
@mjuraga Hi! Possible to share an update here? ^_^ |
mjuraga
commented
Jun 26, 2023
Hi @mr-karan sorry for the too long delay, we've been busy with the latest release. I think your PR is OK, but we had to remove all usages of hashicorp libraries, like this here: https://github.com/haproxytech/dataplaneapi/pull/267/files#diff-01f037ab922981e5205173ea883804d526580df1e51a7ac2e45028dd20d1dc27 Unfortunately there is a licensing conflict between our project and their license so we needed to remove it. We can still consider your PR, but we would need to remove this import here. For example, you can check how we achieved that for consul service discovery support here: 4ad3136 Would you still be willing to work on this PR? |
mr-karan
commented
Jun 27, 2023
@mjuraga Noted. Yeah that makes sense! I'll add this to my backlog for now but eager to contribute! 😅 |
Adds support for service discovery via Nomad services.
Nomad recently launched support for registering services for the tasks it's running. It's possible to retrieve the list of services using HTTP API with the Go SDK that it provides. In functionality terms it is very similar to Consul SDK.
The models for Nomad are generated in
client-nativeand I've sent a PR for it: haproxytech/client-native#90Also fixes an issue with
go-generateas discussed here: #266