mirror of
https://github.com/alibaba/higress.git
synced 2026-03-17 00:40:48 +08:00
add devcontainer for wasm-go plugin developing (#749)
Co-authored-by: Xunzhuo <bitliu@tencent.com>
This commit is contained in:
76
plugins/wasm-go/.devcontainer/gen_config.py
Normal file
76
plugins/wasm-go/.devcontainer/gen_config.py
Normal file
@@ -0,0 +1,76 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
plugin_name = sys.argv[1]
|
||||
|
||||
with open("extensions/"+plugin_name+"/config.json", "r") as f:
|
||||
plugin_config = json.load(f)
|
||||
|
||||
config = f'''static_resources:
|
||||
listeners:
|
||||
- address:
|
||||
socket_address:
|
||||
address: 0.0.0.0
|
||||
port_value: 8080
|
||||
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
|
||||
codec_type: AUTO
|
||||
stat_prefix: ingress_http
|
||||
route_config:
|
||||
name: test
|
||||
virtual_hosts:
|
||||
- name: direct_response_service
|
||||
domains:
|
||||
- "*"
|
||||
routes:
|
||||
- match:
|
||||
prefix: "/"
|
||||
direct_response:
|
||||
status: 200
|
||||
body:
|
||||
inline_string: "hello world\\n"
|
||||
# - match:
|
||||
# prefix: "/"
|
||||
# route:
|
||||
# cluster: service-backend
|
||||
http_filters:
|
||||
- name: {plugin_name}
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/udpa.type.v1.TypedStruct
|
||||
type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
|
||||
value:
|
||||
config:
|
||||
name: wasmdemo
|
||||
vm_config:
|
||||
runtime: envoy.wasm.runtime.v8
|
||||
code:
|
||||
local:
|
||||
filename: ./extensions/{plugin_name}/main.wasm
|
||||
configuration:
|
||||
"@type": "type.googleapis.com/google.protobuf.StringValue"
|
||||
value: '{json.dumps(plugin_config)}'
|
||||
- name: envoy.filters.http.router
|
||||
typed_config:
|
||||
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
|
||||
# clusters:
|
||||
# - name: service-backend
|
||||
# connect_timeout: 600s
|
||||
# type: STATIC
|
||||
# lb_policy: ROUND_ROBIN
|
||||
# load_assignment:
|
||||
# cluster_name: service-backend
|
||||
# endpoints:
|
||||
# - lb_endpoints:
|
||||
# - endpoint:
|
||||
# address:
|
||||
# socket_address:
|
||||
# address: 127.0.0.1
|
||||
# port_value: 8000
|
||||
'''
|
||||
|
||||
with open("extensions/"+plugin_name+"/config.yaml", "w") as f:
|
||||
f.write(config)
|
||||
Reference in New Issue
Block a user