You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am trying to deploy a filter directly into istio ingress-gateway but it does not seem to be working.
I don't get any errors, but I also don't get updated response headers as requested in the filter.
To Reproduce
Create a new tinygo filter
# select tinygo and istio options
wasme init ./test-filter
Make an HTTP request that goes through Istio ingress gateway.
Expected behavior
In the response, I would expect a header with key hello and value world
However, notice that the header in the response is not present.
Additional context
Istio version:
client version: 1.9.1
control plane version: 1.9.1
data plane version: 1.9.1 (45 proxies)
Here is the code for the filter:
main.go
package main
import (
"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm""github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm/types"
)
// Other examples can be found at https://github.com/tetratelabs/proxy-wasm-go-sdk/tree/v0.1.1/examplesfuncmain() {
proxywasm.SetNewRootContext(newRootContext)
}
typehttpHeadersstruct {
// we must embed the default context so that you need not to reimplement all the methods by yourself
proxywasm.DefaultHttpContextcontextIDuint32
}
typerootContextstruct {
// You'd better embed the default root context// so that you don't need to reimplement all the methods by yourself.
proxywasm.DefaultRootContext
}
funcnewRootContext(uint32) proxywasm.RootContext { return&rootContext{} }
// Override DefaultRootContext.func (*rootContext) NewHttpContext(contextIDuint32) proxywasm.HttpContext {
return&httpHeaders{contextID: contextID}
}
// Override DefaultHttpContext.func (ctx*httpHeaders) OnHttpRequestHeaders(numHeadersint, endOfStreambool) types.Action {
hs, err:=proxywasm.GetHttpRequestHeaders()
iferr!=nil {
proxywasm.LogCriticalf("failed to get request headers: %v", err)
}
for_, h:=rangehs {
proxywasm.LogInfof("request header: %s: %s", h[0], h[1])
}
returntypes.ActionContinue
}
// Override DefaultHttpContext.func (ctx*httpHeaders) OnHttpResponseHeaders(numHeadersint, endOfStreambool) types.Action {
iferr:=proxywasm.SetHttpResponseHeader("hello", "world"); err!=nil {
proxywasm.LogCriticalf("failed to set response header: %v", err)
}
returntypes.ActionContinue
}
// Override DefaultHttpContext.func (ctx*httpHeaders) OnHttpStreamDone() {
proxywasm.LogInfof("%d finished", ctx.contextID)
}
Hello,
I have similar problem.
I need to deploy a wasm filter on gateway, but I receive an error, it cannot find the file system: /var/local/lib/wasme-cache
From my understanding the sidecar is able to mount that FS thanks to these annotations:
sidecar.istio.io/userVolume: '[{"hostPath":{"path":"/var/local/lib/wasme-cache"},"name":"cache-dir"}]'
sidecar.istio.io/userVolumeMount: '[{"mountPath":"/var/local/lib/wasme-cache","name":"cache-dir"}]'
and it seems that the same annotations don't have the same result on the gateway.
Hi @kratosmat, you are correct - the gateway needs to have the volume mounted so that it has access to the cache. Since it's not a sidecar, the istio sidecar annotations won't work here.
We'll take a look at documenting this better, as well as potential enhancements to the wasme CLI that could remove the need to add the volume mount manually.
Describe the bug
I am trying to deploy a filter directly into istio
ingress-gateway
but it does not seem to be working.I don't get any errors, but I also don't get updated response headers as requested in the filter.
To Reproduce
tinygo
filter# select tinygo and istio options wasme init ./test-filter
Expected behavior
In the response, I would expect a header with key
hello
and valueworld
However, notice that the header in the response is not present.
Additional context
Istio version:
Here is the code for the filter:
main.go
runtime-config.json
The text was updated successfully, but these errors were encountered: