Skip to content

Examples on upstream/loadbalancer modules #30

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

Closed
rikatz opened this issue Jun 1, 2023 · 6 comments · Fixed by #37 or #36
Closed

Examples on upstream/loadbalancer modules #30

rikatz opened this issue Jun 1, 2023 · 6 comments · Fixed by #37 or #36
Assignees

Comments

@rikatz
Copy link

rikatz commented Jun 1, 2023

Hey folks, thanks for this crate.

I'm looking into testing ngx-rust with ingress-nginx, to replace parts of the code that deals with upstream/balancer (today it uses openresty).

First of all, bare in mind I'm almost null in Rust.

While trying to follow the examples and some module development blogs (in C), I couldn't move forward to implement a LB module for it.

I'm a bit lost on where are the limits of C/bindings and Rust code, and was wondering if it is possible to get an example on a loadbalancer module to check where am I doing the mistakes.

Thank you!

@f5yacobucci
Copy link
Contributor

The coverage varies right now with how much of the total NGINX API this project supports. There are some known gaps and some unknown gaps. This is a good suggestion for an example though. I'll take a look.

@f5yacobucci f5yacobucci self-assigned this Jun 1, 2023
@ivanitskiy
Copy link
Contributor

This is an example of a community C module for LB: https://github.com/gnosek/nginx-upstream-fair, but no recent updates though.

@rikatz
Copy link
Author

rikatz commented Jun 1, 2023

Yeap, I was also reading https://www.evanmiller.org/nginx-modules-guide.html and https://hodo.dev/posts/post-17-nginx-custom-upstream-module/ but not gonna lie I'm having some issues to port the idea to ngx-rust :)

@f5yacobucci
Copy link
Contributor

Status: I'm significantly through an example based on this work: https://github.com/gabihodoroaga/nginx-upstream-module.

The algorithm may change some for example purposes, but the general structure will remain for cross-referencing. I'm hoping to complete and test it soon.

@f5yacobucci
Copy link
Contributor

I opened a WIP PR early to help with your work @rikatz. Hopefully it offers some help before we finalize the structure or annotate it.

@rikatz
Copy link
Author

rikatz commented Jun 26, 2023

Thanks @f5yacobucci it already helps a lot! I will take a look and play with it during the weekend :)

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