From fc2b8cace4b3a8fdafcd2dd524e3c7fd649ea6f8 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 | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/api/v1alpha1/envoyproxy_metric_types.go b/api/v1alpha1/envoyproxy_metric_types.go index 170a1686b00..6cf486ac4b6 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 44a24ef935e..5ee825d3b3c 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 2ec4e969d2a..593d1b6de4e 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 b031093b7bb..b4456791761 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 28069b5670c..4633520a4e0 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -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)