Title: Floating-point numbers in filter configuration does not get read correctly for dynamic modules and Go filters
Description:
Dynamic modules (or Go Filters) must use type.googleapis.com/google.protobuf.Struct when configuring a filter. Example:
http_filters:
- name: myfilter
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.dynamic_modules.v3.DynamicModuleFilter
dynamic_module_config:
name: composer
do_not_close: true
filter_config:
"@type": "type.googleapis.com/google.protobuf.Struct"
value:
body:
maxSize: 5000
filter_name: myfilter
The above config works only if maxSize is a integer type. However, the issue that I am observing here is that if maxSize is a floating-point number then Envoy will always read it as a string, see here.
Repro steps:
Assuming that we have the following config structure for a dynamic module:
type Config struct {
Body BodyConfig `json:"body"`
}
type BodyConfig struct {
MaxSize *uint64 `json:"maxSize"`
}
and our filter factory looks like this:
func (p *filterConfigFactory) Create(handle shared.HttpFilterConfigHandle, unparsedConfig []byte) (shared.HttpFilterFactory, error) {
config := &Config{}
if err := json.Unmarshal(unparsedConfig, config); err != nil {
return nil, err
}
return &filterFactory{config: config}, nil
}
Then the following config cannot be parsed because Envoy sees maxSize as a string:
http_filters:
- name: myfilter
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.dynamic_modules.v3.DynamicModuleFilter
dynamic_module_config:
name: composer
do_not_close: true
filter_config:
"@type": "type.googleapis.com/google.protobuf.Struct"
value:
body:
maxSize: 5000.0
filter_name: myfilter
Title: Floating-point numbers in filter configuration does not get read correctly for dynamic modules and Go filters
Description:
Dynamic modules (or Go Filters) must use
type.googleapis.com/google.protobuf.Structwhen configuring a filter. Example:The above config works only if
maxSizeis a integer type. However, the issue that I am observing here is that ifmaxSizeis a floating-point number then Envoy will always read it as a string, see here.Repro steps:
Assuming that we have the following config structure for a dynamic module:
and our filter factory looks like this:
Then the following config cannot be parsed because Envoy sees
maxSizeas a string: