how to use haproxy-ingress controller with lua script.
I want to use haproxy-ingress controller with lua-script. it will be great help if anyone has implemented or has any document on the same
Hi @yashmujumdar15 Lua usage is not currently available but this can be considered for future releases. can you share more details about your use-case of LUA usage?
in our case mostly to support CORS. example https://github.com/haproxytech/haproxy-lua-cors/blob/master/example/haproxy/cors.lua
What is the timeline for this? I also think k this would be a great feature we use lua scripts to decode jwt tokens for more detailed logging.
I need the exact same thing - to decode JWT :)
Same here, I'd like to add https://doc.crowdsec.net/docs/next/bouncers/haproxy/ to my ingress controller
we ended up having to fork the base image and build our haproxy IC image like follows:
FROM haproxytech/kubernetes-ingress:1.9.5 AS common
ENV LUA_VERSION 5.3
# Install packages necessary for Lua, Luarocks
RUN apk update
RUN apk add build-base
RUN apk add lua${LUA_VERSION} lua${LUA_VERSION}-dev luarocks${LUA_VERSION}
RUN apk add openssl openssl-dev
RUN apk add git
RUN luarocks-${LUA_VERSION} install luaossl
RUN luarocks-${LUA_VERSION} install luasocket
# Collection of useful Lua utilities, namely https://stevedonovan.github.io/Penlight/api/libraries/pl.tablex.html#merge
# which I use to merge `pg_notify` JSON updates into the global `auth_data` table in memory.
RUN luarocks-${LUA_VERSION} install penlight
... etc. ...
we ended up having to fork the base image and build our haproxy IC image like follows:
FROM haproxytech/kubernetes-ingress:1.9.5 AS common ENV LUA_VERSION 5.3 # Install packages necessary for Lua, Luarocks RUN apk update RUN apk add build-base RUN apk add lua${LUA_VERSION} lua${LUA_VERSION}-dev luarocks${LUA_VERSION} RUN apk add openssl openssl-dev RUN apk add git RUN luarocks-${LUA_VERSION} install luaossl RUN luarocks-${LUA_VERSION} install luasocket # Collection of useful Lua utilities, namely https://stevedonovan.github.io/Penlight/api/libraries/pl.tablex.html#merge # which I use to merge `pg_notify` JSON updates into the global `auth_data` table in memory. RUN luarocks-${LUA_VERSION} install penlight ... etc. ...
Doesn't seem too complicated, maybe you could PR it?
Doesn't seem too complicated, maybe you could PR it?
Huh? Like make the base Dockerfile configurable to install lua/luarocks in the image?
Doesn't seem too complicated, maybe you could PR it?
Huh? Like make the base Dockerfile configurable to install lua/luarocks in the image?
One very weird/surprising thing I have noticed with this approach is that HAProxy is always built w/ Lua 5.3.
This is surprising because the base alpine image hardcoded in the ingress controller Dockerfile here is using haproxy-alpine:2.6, which in turn seems to build haproxy with Lua 5.4.
However, when my IC starts, haproxy reports having been built with 5.3, not 5.4:
/usr/local/share/lua/5.4 $ haproxy -vv | grep Lua
Built with Lua version : Lua 5.3.6
Somehow both 5.3 and 5.4 are installed in the container:
/usr/local/share/lua/5.4 $ ls /usr/lib/lua5.3
liblua-5.3.so.0 liblua-5.3.so.0.0.0
/usr/local/share/lua/5.4 $ ls /usr/lib/lua5.4
liblua-5.4.so.0 liblua-5.4.so.0.0.0 liblua.a liblua.so
Anyone know what's going on here?
Resolved a while ago: https://github.com/haproxytech/kubernetes-ingress/issues/552