kubernetes / ingress-nginx

Ingress-NGINX Controller for Kubernetes
https://kubernetes.github.io/ingress-nginx/
Apache License 2.0
17.26k stars 8.21k forks source link

Use NGINX Go Parser to generate configs #9960

Open rikatz opened 1 year ago

rikatz commented 1 year ago

Today we do some fancy template replacements, generating our config and sometimes failing at it.

F5 has a port of their crossplane library to Go: https://github.com/nginxinc/nginx-go-crossplane/tree/main

We can think on replacing that template generator for this library, so we can even marshall/unmarshall and compare structs when we need to reconfigure something, as an example.

This may also allow us to escape some directive configs, and when generating the configuration, things like quotes, {}, etc will be escaped by this parser

rikatz commented 1 year ago

/triage accepted

rikatz commented 1 year ago

Some proposed tests that we need to do:

rikatz commented 1 year ago

Started to test here using benchmark, but already got stuck on the fact that the parser skips directives it doesn't understand.

lua_package_path for instance is not recognized and skipped, then parsing fails.

So while we use outside directives, it won't be able to use it. Maybe once the parser supports additional directives configurations we can come back to it

/lifecycle frozen

k8s-triage-robot commented 4 months ago

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

grounded042 commented 1 month ago

One thing to consider as this work is being done is that currently the docs call out the ability to customize the nginx.conf template: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/custom-template/