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
REPLACE
Operation withapplyTo
FieldapiVersion: 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
EnvoyFilter
specifies aREPLACE
operation withapplyTo
set toROUTE_CONFIGURATION
, butREPLACE
is only valid forHTTP_FILTER
andNETWORK_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
REPLACE
OperationIf replacing the configuration is not necessary, delete the
REPLACE
operation 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
REPLACE
toMERGE
, the configuration is now valid forapplyTo: ROUTE_CONFIGURATION
. -
Change
applyTo
to a Valid Value forREPLACE
If the intention is to replace a filter, change the
applyTo
field to a value that supports theREPLACE
operation.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
applyTo
toHTTP_FILTER
allows theREPLACE
operation to be used, as replacing HTTP filters is valid for thisapplyTo
value.