-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor endpoint handling and reconcilliation #21
Refactor endpoint handling and reconcilliation #21
Conversation
As part of the Go 1.20 release it seems like the default for `CGO_ENABLED` is no longer carried over from the tools. This leads to linking issues on systems that use different versions of glibc from what the base image uses. See golang/go#58550 for more details. This change should fix cosmonic-labs#16
Use `scratch` as a base image since we're generating a static binary anyway. Also be more explicity about the platform and target OS during the build.
DRAFT With the release of Nomad 1.6 it's possible to get the network address of the allocation from Nomad. The change to enable this is only in the client library and does not require updating the Nomad server. The IP was sent back by older Nomad versions, it just wasn't available in the client. This enables refactoring the endpoint reconcilliation to make use of the IP address to identify the endpoint within Cilium. There is no longer a dependency on Consul for policies. Additional, endpoints are now labelled with the task group and task information as services can be created at those levels.
Remove unused flags from the readme and command line and refactor the code to allow for testing.
✅ Deploy Preview for netreap canceled.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only needs a few small changes related to the Dockerfile, but other than that it looks good to go to me!
Thanks a ton for the contribution and helping us remove the dependency on Consul!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deverton-godaddy Great work here! This is almost ready to merge, I just had one more follow up question around some code that was removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good to go! Thank you
Feature or Problem
With the release of Nomad 1.6 it's possible to get the network address of the allocation from Nomad. The change to enable this is only in the client library and does not require updating the Nomad server. The IP was sent back by older Nomad versions, it just wasn't available in the client.
This enables refactoring the endpoint reconcilliation to make use of the IP address to identify the endpoint within Cilium. There is no longer a dependency on Consul for policy reconcilliaton. Additionally, endpoints are now labelled with the task group and task information as services can be created at those levels.
On startup of netreap the reconciliation process is as follows:
There's no need to delete endpoints (as far as I can tell) as Nomad should be deleting the endpoints as part of its integration with the CNI plugin.
For event processing netreap will now monitor the Allocation topic as the
AllocationUpdated
event from that topic contains the network details associated with the allocation. The process is now:AllocationUpdated
event.network
configuration won't) ignore it.This should be fairly scalable as the number of calls to the Nomad API will be one per-endpoint allocation.
One other change is patch the endpoint with an endpoint change request event. This triggers Cilium to remove the
reserved:init
label from the endpoints as it considers the endpoints labelled properly at that point. This change is based on how the Cilium Docker network plugin works.Note that it is no longer possible to filter out services by tags. I'm not sure that feature makes sense with the refactored code as you would always want to apply labels to Cilium endpoints.
Related Issues
Potentially fixes #20 and #9