Skip to content

Commit 68730ef

Browse files
add validation for route cache action
Signed-off-by: Sibasish Behera <[email protected]>
1 parent fa2db6a commit 68730ef

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

api/v1alpha1/ext_proc_types.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@ type ExtProcProvider struct {
4949

5050
// RouteCacheAction describes the route cache action to be taken when an
5151
// external processor response is received in response to request headers.
52-
// The default behavior is "FromResponse" which will only clear the route cache when
53-
// an external processing response has the clear_route_cache field set.
54-
// Envoy: Supported
52+
// If not specified, the Envoy default value of "FromResponse" will be used, which only clears
53+
// the route cache when an external processing response has the clear_route_cache field set.
54+
// Envoy: Supported (default: FromResponse)
5555
// Agentgateway: Not Supported (ignored)
5656
// +optional
5757
// +kubebuilder:validation:Enum=FromResponse;Clear;Retain
58-
// +kubebuilder:default=FromResponse
5958
RouteCacheAction ExtProcRouteCacheAction `json:"routeCacheAction,omitempty"`
6059

6160
// MetadataOptions allows configuring metadata namespaces to forwarded or received from the external

install/helm/kgateway-crds/templates/gateway.kgateway.dev_gatewayextensions.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,12 @@ spec:
548548
type: string
549549
type: object
550550
routeCacheAction:
551-
default: FromResponse
552551
description: |-
553552
RouteCacheAction describes the route cache action to be taken when an
554553
external processor response is received in response to request headers.
555-
The default behavior is "FromResponse" which will only clear the route cache when
556-
an external processing response has the clear_route_cache field set.
557-
Envoy: Supported
554+
If not specified, the Envoy default value of "FromResponse" will be used, which only clears
555+
the route cache when an external processing response has the clear_route_cache field set.
556+
Envoy: Supported (default: FromResponse)
558557
Agentgateway: Not Supported (ignored)
559558
enum:
560559
- FromResponse

pkg/agentgateway/plugins/traffic_plugin.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,8 +973,9 @@ func validateExtProcProvider(provider *v1alpha1.ExtProcProvider) error {
973973
errs = append(errs, fmt.Errorf("statPrefix field in ExtProcProvider is not supported for agentgateway"))
974974
}
975975

976-
// TODO: RouteCacheAction has a kubebuilder default so we don't validate it here
977-
// to avoid false positives when the default is automatically applied.
976+
if provider.RouteCacheAction != "" {
977+
errs = append(errs, fmt.Errorf("routeCacheAction field in ExtProcProvider is not supported for agentgateway"))
978+
}
978979

979980
if provider.MetadataOptions != nil {
980981
errs = append(errs, fmt.Errorf("metadataOptions field in ExtProcProvider is not supported for agentgateway"))

0 commit comments

Comments
 (0)