Istio envoy filter on sidecar

Hi,

we have Istio running on openshit. We were trying to analyze envoy filters for request and response body logging. During the process we had a test namespace - and create an envoy.lua filter under that.
Following is the code for the envoy filter:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: gm1-sample
namespace: gm-test
spec:
workloadLabels:
app: user-preferences-rs-v1
filters:

  • insertPosition:
    index: FIRST
    listenerMatch:
    listenerType: SIDECAR_INBOUND
    portNumber: 8080
    listenerProtocol: ALL

    filterName: envoy.lua
    filterType: HTTP
    filterConfig:
    inlineCode: |
    – Called on the request path.
    function envoy_on_request(request_handle)
    request_handle:logErr(“REQBODY-SC::::ENTER”)
    end
    – Called on the response path.
    function envoy_on_response(response_handle)
    response_handle:logErr(“RESPBODY-SC::::ENTER”)
    end

After the test is done we deleted the namespace (without out deleting the envoy filter) - assuming all objects in the namespace would be deleted.

Then we were doing other tests - and created another namespace for the same service/label - user-preferences-rs-v1. And we observed that we are still getting the messages in istio proxy logs - RESPBODY-SC::::ENTER

We did a dump of all objects across all the namespace (oc get all --all-namespaces) - but find no references to the envoy filter.

When we do a dump of the istio proxy we see the http filter in the config dump.

“http_filters”: [
{
“name”: “envoy.lua”,
“config”: {
“inlineCode”: “-- Called on the request path.\nfunction envoy_on_request(request_handle)\nrequest_handle:logErr(“REQBODY-SC::::ENTER”)\nend\n-- Called on the response path.\nfunction envoy_on_response(response_handle)\n response_handle:logErr(“response”)\n response_handle:logErr(“RESPBODY-SC::::ENTER”)\n end\n”
}
},

How can i get rid of this ? Also how is it possible that the filter still exists even after deleting the namespace ?

Any help is greatly appreciated.