EnvoyFilterUsesReplaceOperationIncorrectly

Message NameEnvoyFilterUsesReplaceOperationIncorrectly
Message CodeIST0152
DescriptionThe REPLACE operation is only valid for HTTP_FILTER and NETWORK_FILTER.
LevelError

This message occurs when an EnvoyFilter uses the REPLACE operation and ApplyTo is set to HTTP_FILTER or NETWORK_FILTER. This will cause the REPLACE operation to be ignored as HTTP_FILTER and NETWORK_FILTER are not valid for REPLACE.

An example

Consider an EnvoyFilter with the patch operation of REPLACE where this EnvoyFilter will just be ignored:

  1. apiVersion: networking.istio.io/v1alpha3
  2. kind: EnvoyFilter
  3. metadata:
  4. name: test-replace-2
  5. namespace: bookinfo
  6. spec:
  7. workloadSelector:
  8. labels:
  9. app: reviews2
  10. priority: 10
  11. configPatches:
  12. # The first patch adds the Lua filter to the listener/http connection manager
  13. - applyTo: HTTP_FILTER
  14. match:
  15. context: SIDECAR_INBOUND
  16. listener:
  17. portNumber: 8080
  18. filterChain:
  19. filter:
  20. name: "envoy.filters.network.http_connection_manager"
  21. subFilter:
  22. name: "envoy.filters.http.router"
  23. patch:
  24. operation: REPLACE
  25. value: # Lua filter specification
  26. name: envoy.lua
  27. typed_config:
  28. "@type": "type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua"
  29. inlineCode: |
  30. function envoy_on_request(request_handle)
  31. -- Make an HTTP call to an upstream host with the following headers, body, and timeout.
  32. local headers, body = request_handle:httpCall(
  33. "lua_cluster",
  34. {
  35. [":method"] = "POST",
  36. [":path"] = "/acl",
  37. [":authority"] = "internal.org.net"
  38. },
  39. "authorize call",
  40. 5000)
  41. end