Steps
- Create a service with 3 POST endpoints. LDS, RDS and CDS
- Update istio-pilot deployment by adding the following args to the "discovery" container --webhookEndpoint http://luawebhook:5000/
- Deploy the webhook service by kubectl apply -n istio-system -f luawebhook.yaml
- Use luawebhook config map to mount file.
At present the config is not refreshed automatically if you update the lua script. Pilot maintains a cache of the generated config which is recalculated only when there is a change in the environment.
macbookpro:src $ curl -I http://httpbin/status/207
HTTP/1.1 207 Multi-Status
server: envoy
date: Fri, 23 Feb 2018 21:41:22 GMT
content-type: text/html; charset=utf-8
access-control-allow-origin: *
access-control-allow-credentials: true
content-length: 0
x-envoy-upstream-service-time: 6
x-envoy-upstream-service-time: 6
x-lua-resp-header: httpbin-57db476f4d-svs9h.default
x-lua-resp-header: istio-ingress-784f979b9b-jpdzv.istio-system