特使lua本地脚本文件
我正在尝试将LUA脚本实现到EVNOY配置文件中 我想要的是在本地lua文件中写下我的lua代码,然后在特使配置文件中将我的脚本文件定为
我的脚本文件这是我的yaml文件:
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
'@type': "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
stat_prefix: http_proxy
route_config:
name: all
virtual_hosts:
- name: allbackend_cluster
domains:
- '*'
routes:
- match: { prefix: "/"}
route:
cluster: cluster_wackopicko
http_filters:
- name: envoy.filters.http.router
- name: envoy.lua
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
inline_code: |
function envoy_on_response(response_handle)
body_size = response_handle:body():length()
response_handle:headers():add("response-body-size", tostring(body_size))
response_handle:headers():add("foo", "bar")
end
clusters:
- name: cluster_wackopicko
connect_timeout: 1s
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: cluster_wackopicko
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 8081
我需要更改此配置文件以将lua代码导出到外部文件中,该文件将位于我的Ubuntu服务器上的/Envoy/Lua/脚本/文件夹中?
I am trying to implement lua script into an evnoy configuration file
What I want is to write my lua code within a local lua file and then scpecify my script file inside the envoy configuration file
This is my yaml file:
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
'@type': "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
stat_prefix: http_proxy
route_config:
name: all
virtual_hosts:
- name: allbackend_cluster
domains:
- '*'
routes:
- match: { prefix: "/"}
route:
cluster: cluster_wackopicko
http_filters:
- name: envoy.filters.http.router
- name: envoy.lua
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
inline_code: |
function envoy_on_response(response_handle)
body_size = response_handle:body():length()
response_handle:headers():add("response-body-size", tostring(body_size))
response_handle:headers():add("foo", "bar")
end
clusters:
- name: cluster_wackopicko
connect_timeout: 1s
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: cluster_wackopicko
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 8081
What I need to change in this config file to export the lua code to external file which will be located in /envoy/lua/scripts/ folder on my ubuntu server ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Envoy> = 1.23.0
以来,Envoy V1.23.0( and this pr ),您可以在
default_source_code
中定义脚本。参见文档。示例:
Envoy≪ 1.23.0
带有较旧版本的版本,您可以使用
source_codes
带有fileName
。 See但是,您必须添加
inline_code
。 这是一个已知的问题。例子:
Envoy >= 1.23.0
Since Envoy v1.23.0 (and this PR), you can define your script in
default_source_code
. See documentation.Example:
Envoy < 1.23.0
With older versions, you can use
source_codes
withfilename
. See documentation.However, you have to add
inline_code
. This is a known issue.Example: