TIS0803 - REPLACE Operation Only Valid for HTTP_FILTER and NETWORK_FILTER
The REPLACE operation is only valid for HTTP_FILTER and NETWORK_FILTER.
REPLACE Operation is Used with Compatible applyTo ValuesTo prevent configuration errors, either remove the REPLACE operation when applyTo is not HTTP_FILTER or NETWORK_FILTER, or change applyTo to a compatible value.
Examples
-
Incorrect
REPLACEOperation withapplyToFieldapiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: invalid-replace-operation
namespace: example-namespace
spec:
configPatches:
- applyTo: ROUTE_CONFIGURATION
match:
context: GATEWAY
patch:
operation: REPLACE
value:
name: "route-config"Explanation: The
EnvoyFilterspecifies aREPLACEoperation withapplyToset toROUTE_CONFIGURATION, butREPLACEis only valid forHTTP_FILTERandNETWORK_FILTER. As a result, the configuration will be ignored.
Recommendation
Remove the REPLACE operation or change the applyTo field to a valid value.
-
Remove the
REPLACEOperationIf replacing the configuration is not necessary, delete the
REPLACEoperation to ensure the configuration is valid.apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: corrected-operation
namespace: example-namespace
spec:
configPatches:
- applyTo: ROUTE_CONFIGURATION
match:
context: GATEWAY
patch:
operation: MERGE
value:
name: "existing-route-config"Explanation: By changing the operation from
REPLACEtoMERGE, the configuration is now valid forapplyTo: ROUTE_CONFIGURATION. -
Change
applyToto a Valid Value forREPLACEIf the intention is to replace a filter, change the
applyTofield to a value that supports theREPLACEoperation.apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: replace-operation-corrected
namespace: example-namespace
spec:
configPatches:
- applyTo: HTTP_FILTER
match:
context: SIDECAR_OUTBOUND
patch:
operation: REPLACE
value:
name: "envoy.filters.http.router"Explanation: Changing
applyTotoHTTP_FILTERallows theREPLACEoperation to be used, as replacing HTTP filters is valid for thisapplyTovalue.