Closed RonVider closed 4 years ago
Interesting bug! Thanks for bringing this up @RonVider.
Get this, it turns out that the problem is because of this embedded lua comment:
-- load all plugins that'll be used here
Crossplane has really basic support for OpenResty's Lua module because it uses embedded code that's not technically supported by the vanilla NGINX syntax.
Not supporting OpenResty caused us a few headaches though, so we added some basic handling into crossplane that would just grab all of the embedded code and treat it like one big string. In order to do that, we needed to count bracket depth to get the end of the *_by_lua_block
block, and we needed to make sure that none of the {
or }
characters were inside lua strings. This very basic handling caused a bug here, because crossplane has no concept of lua comments, and thought that the '
character in the comment was the beginning of a lua string. This threw the whole parser off.
So if you need an immediate fix before this gets patched, try removing the '
character in the lua comment.
Describe the bug I’ve created basic Kubernetes Nginx ingress controller following a tutorial from Kubernetes official site (https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/) and then I tried to parse it within crossplan Nginx parser which failed due to not allowed directive.
To Reproduce Steps to reproduce the behavior:
kubectl exec -n kube-system `kubectl get pods -n kube-system | grep ingress-nginx-controller | cut -d" " -f1` cat /etc/nginx/nginx.conf > nginx.conf
crossplane parse nginx.conf
Expected behavior The configuration has no issues and should be parsed successfully.
Your environment
Additional context Attached configuration for example nginx.txt