From 84add961bd7aabe9851ea664179e1419d9d600d1 Mon Sep 17 00:00:00 2001 From: huabing zhao Date: Wed, 25 Oct 2023 19:57:04 +0800 Subject: [PATCH] add TODO to refactor string match types Signed-off-by: huabing zhao --- api/v1alpha1/envoyproxy_metric_types.go | 4 ++-- api/v1alpha1/ratelimitfilter_types.go | 2 +- api/v1alpha1/securitypolicy_types.go | 3 ++- .../generated/gateway.envoyproxy.io_securitypolicies.yaml | 5 +++-- site/content/en/latest/api/extension_types.md | 6 +++--- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/api/v1alpha1/envoyproxy_metric_types.go b/api/v1alpha1/envoyproxy_metric_types.go index 170a1686b004..6cf486ac4b60 100644 --- a/api/v1alpha1/envoyproxy_metric_types.go +++ b/api/v1alpha1/envoyproxy_metric_types.go @@ -60,7 +60,7 @@ type ProxyPrometheusProvider struct { } // Match defines the stats match configuration. -type Match struct { +type Match struct { // TODO: zhaohuabing this type should be renamed to StatsMatch // MatcherType defines the stats matcher type // // +kubebuilder:validation:Enum=RegularExpression;Prefix;Suffix @@ -70,7 +70,7 @@ type Match struct { type MatcherType string -const ( +const ( // TODO: zhaohuabing the const types should be prefixed with StatsMatch Prefix MatcherType = "Prefix" RegularExpression MatcherType = "RegularExpression" Suffix MatcherType = "Suffix" diff --git a/api/v1alpha1/ratelimitfilter_types.go b/api/v1alpha1/ratelimitfilter_types.go index 44a24ef935ec..5ee825d3b3c1 100644 --- a/api/v1alpha1/ratelimitfilter_types.go +++ b/api/v1alpha1/ratelimitfilter_types.go @@ -130,7 +130,7 @@ type SourceMatch struct { } // HeaderMatch defines the match attributes within the HTTP Headers of the request. -type HeaderMatch struct { +type HeaderMatch struct { // TODO: zhaohuabing this type could be replaced with a general purpose StringMatch type. // Type specifies how to match against the value of the header. // // +optional diff --git a/api/v1alpha1/securitypolicy_types.go b/api/v1alpha1/securitypolicy_types.go index 2ec4e969d2a0..593d1b6de4e1 100644 --- a/api/v1alpha1/securitypolicy_types.go +++ b/api/v1alpha1/securitypolicy_types.go @@ -61,7 +61,8 @@ type CORS struct { } // StringMatch defines how to match any strings. -// TODO: zhaohuabing make this a shared type for all APIs +// This is a general purpose match condition that can be used by other EG APIs +// that need to match against a string. type StringMatch struct { // Type specifies how to match against a string. // diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml index b031093b7bb5..b44567917618 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_securitypolicies.yaml @@ -62,8 +62,9 @@ spec: description: AllowOrigins defines the origins that are allowed to make requests. items: - description: 'StringMatch defines how to match any strings. - TODO: zhaohuabing make this a shared type for all APIs' + description: StringMatch defines how to match any strings. This + is a general purpose match condition that can be used by other + EG APIs that need to match against a string. properties: caseSensitive: default: "False" diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 28069b5670c0..840cb583844f 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -835,7 +835,7 @@ _Appears in:_ -HeaderMatch defines the match attributes within the HTTP Headers of the request. +HeaderMatch defines the match attributes within the HTTP Headers of the request. TODO: zhaohuabing this type could be replaced with a general purpose StringMatch type. _Appears in:_ - [RateLimitSelectCondition](#ratelimitselectcondition) @@ -1040,7 +1040,7 @@ _Appears in:_ -Match defines the stats match configuration. +Match defines the stats match configuration. TODO: zhaohuabing this type should be renamed to StatsMatch _Appears in:_ - [ProxyMetrics](#proxymetrics) @@ -1617,7 +1617,7 @@ _Appears in:_ -StringMatch defines how to match any strings. TODO: zhaohuabing make this a shared type for all APIs +StringMatch defines how to match any strings. This is a general purpose match condition that can be used by other EG APIs that need to match against a string. _Appears in:_ - [CORS](#cors)