remove gogo nullable extension from repeated fields (#7669)

Due to a seg fault issue with the gogo protobuf library
[https://github.com/gogo/protobuf/issues/568], non nullable repeated
fields in a proto will cause proto.Merge(dst, src) to panic.

The nullable field setting was first added by @kyessenov when he was
re-organizing the protos. Unfortunately, people have been copy pasting it
across several areas in the Envoy proto. To keep the impact radius to a minimum,
I have updated only the fields that are currently causing the segfault
(in go-control-plane) for us.

Its also partly against proto principles. You should be able to determine if
a field is set or not. This non-nullable setting in gogo will insist on initializing
the field to default values.

Risk Level: to go control plane users

Signed-off-by: Shriram Rajagopalan <rshriram@tetrate.io>

Mirrored from https://github.com/envoyproxy/envoy @ b22d2b5cf09f779962cfedaaab24969f384cbc48
pull/620/head
data-plane-api(CircleCI) 5 years ago
parent fbae81c941
commit a6c781867c
  1. 27
      envoy/admin/v2alpha/config_dump.proto
  2. 7
      envoy/api/v2/cds.proto
  3. 3
      envoy/api/v2/core/address.proto
  4. 4
      envoy/api/v2/discovery.proto
  5. 2
      envoy/api/v2/eds.proto
  6. 2
      envoy/api/v2/endpoint/endpoint.proto
  7. 6
      envoy/api/v2/lds.proto
  8. 2
      envoy/api/v2/listener/listener.proto
  9. 5
      envoy/api/v2/rds.proto
  10. 4
      envoy/api/v2/route/route.proto
  11. 6
      envoy/config/bootstrap/v2/bootstrap.proto
  12. 3
      envoy/config/common/tap/v2alpha/common.proto
  13. 6
      envoy/config/filter/network/dubbo_proxy/v2alpha1/route.proto
  14. 8
      envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.proto
  15. 4
      envoy/config/filter/network/redis_proxy/v2/redis_proxy.proto
  16. 6
      envoy/config/filter/network/thrift_proxy/v2alpha1/route.proto

@ -33,7 +33,7 @@ message ConfigDump {
// * *clusters*: :ref:`ClustersConfigDump <envoy_api_msg_admin.v2alpha.ClustersConfigDump>`
// * *listeners*: :ref:`ListenersConfigDump <envoy_api_msg_admin.v2alpha.ListenersConfigDump>`
// * *routes*: :ref:`RoutesConfigDump <envoy_api_msg_admin.v2alpha.RoutesConfigDump>`
repeated google.protobuf.Any configs = 1 [(gogoproto.nullable) = false];
repeated google.protobuf.Any configs = 1;
}
// This message describes the bootstrap configuration that Envoy was started with. This includes
@ -41,7 +41,7 @@ message ConfigDump {
// the static portions of an Envoy configuration by reusing the output as the bootstrap
// configuration for another Envoy.
message BootstrapConfigDump {
envoy.config.bootstrap.v2.Bootstrap bootstrap = 1 [(gogoproto.nullable) = false];
envoy.config.bootstrap.v2.Bootstrap bootstrap = 1;
// The timestamp when the BootstrapConfig was last updated.
google.protobuf.Timestamp last_updated = 2;
@ -81,23 +81,23 @@ message ListenersConfigDump {
}
// The statically loaded listener configs.
repeated StaticListener static_listeners = 2 [(gogoproto.nullable) = false];
repeated StaticListener static_listeners = 2;
// The dynamically loaded active listeners. These are listeners that are available to service
// data plane traffic.
repeated DynamicListener dynamic_active_listeners = 3 [(gogoproto.nullable) = false];
repeated DynamicListener dynamic_active_listeners = 3;
// The dynamically loaded warming listeners. These are listeners that are currently undergoing
// warming in preparation to service data plane traffic. Note that if attempting to recreate an
// Envoy configuration from a configuration dump, the warming listeners should generally be
// discarded.
repeated DynamicListener dynamic_warming_listeners = 4 [(gogoproto.nullable) = false];
repeated DynamicListener dynamic_warming_listeners = 4;
// The dynamically loaded draining listeners. These are listeners that are currently undergoing
// draining in preparation to stop servicing data plane traffic. Note that if attempting to
// recreate an Envoy configuration from a configuration dump, the draining listeners should
// generally be discarded.
repeated DynamicListener dynamic_draining_listeners = 5 [(gogoproto.nullable) = false];
repeated DynamicListener dynamic_draining_listeners = 5;
}
// Envoy's cluster manager fills this message with all currently known clusters. Cluster
@ -134,17 +134,17 @@ message ClustersConfigDump {
}
// The statically loaded cluster configs.
repeated StaticCluster static_clusters = 2 [(gogoproto.nullable) = false];
repeated StaticCluster static_clusters = 2;
// The dynamically loaded active clusters. These are clusters that are available to service
// data plane traffic.
repeated DynamicCluster dynamic_active_clusters = 3 [(gogoproto.nullable) = false];
repeated DynamicCluster dynamic_active_clusters = 3;
// The dynamically loaded warming clusters. These are clusters that are currently undergoing
// warming in preparation to service data plane traffic. Note that if attempting to recreate an
// Envoy configuration from a configuration dump, the warming clusters should generally be
// discarded.
repeated DynamicCluster dynamic_warming_clusters = 4 [(gogoproto.nullable) = false];
repeated DynamicCluster dynamic_warming_clusters = 4;
}
// Envoy's RDS implementation fills this message with all currently loaded routes, as described by
@ -175,10 +175,10 @@ message RoutesConfigDump {
}
// The statically loaded route configs.
repeated StaticRouteConfig static_route_configs = 2 [(gogoproto.nullable) = false];
repeated StaticRouteConfig static_route_configs = 2;
// The dynamically loaded route configs.
repeated DynamicRouteConfig dynamic_route_configs = 3 [(gogoproto.nullable) = false];
repeated DynamicRouteConfig dynamic_route_configs = 3;
}
// Envoy's scoped RDS implementation fills this message with all currently loaded route
@ -214,11 +214,10 @@ message ScopedRoutesConfigDump {
}
// The statically loaded scoped route configs.
repeated InlineScopedRouteConfigs inline_scoped_route_configs = 1 [(gogoproto.nullable) = false];
repeated InlineScopedRouteConfigs inline_scoped_route_configs = 1;
// The dynamically loaded scoped route configs.
repeated DynamicScopedRouteConfigs dynamic_scoped_route_configs = 2
[(gogoproto.nullable) = false];
repeated DynamicScopedRouteConfigs dynamic_scoped_route_configs = 2;
}
// Envoys SDS implementation fills this message with all secrets fetched dynamically via SDS.

@ -127,11 +127,8 @@ message Cluster {
EdsClusterConfig eds_cluster_config = 3;
// The timeout for new network connections to hosts in the cluster.
google.protobuf.Duration connect_timeout = 4 [
(validate.rules).duration.gt = {},
(gogoproto.stdduration) = true,
(gogoproto.nullable) = false
];
google.protobuf.Duration connect_timeout = 4
[(validate.rules).duration.gt = {}, (gogoproto.stdduration) = true];
// Soft limit on size of the clusters connections read and write buffers. If
// unspecified, an implementation defined default is applied (1MiB).

@ -83,8 +83,7 @@ message TcpKeepalive {
message BindConfig {
// The address to bind to when creating a socket.
SocketAddress source_address = 1
[(validate.rules).message.required = true, (gogoproto.nullable) = false];
SocketAddress source_address = 1 [(validate.rules).message.required = true];
// Whether to set the *IP_FREEBIND* option when creating the socket. When this
// flag is set to true, allows the :ref:`source_address

@ -65,7 +65,7 @@ message DiscoveryResponse {
string version_info = 1;
// The response resources. These resources are typed and depend on the API being called.
repeated google.protobuf.Any resources = 2 [(gogoproto.nullable) = false];
repeated google.protobuf.Any resources = 2;
// [#not-implemented-hide:]
// Canary is used to support two Envoy command line flags:
@ -196,7 +196,7 @@ message DeltaDiscoveryResponse {
// The response resources. These are typed resources, whose types must match
// the type_url field.
repeated Resource resources = 2 [(gogoproto.nullable) = false];
repeated Resource resources = 2;
// field id 3 IS available!

@ -59,7 +59,7 @@ message ClusterLoadAssignment {
string cluster_name = 1 [(validate.rules).string.min_bytes = 1];
// List of endpoints to load balance to.
repeated endpoint.LocalityLbEndpoints endpoints = 2 [(gogoproto.nullable) = false];
repeated endpoint.LocalityLbEndpoints endpoints = 2;
// Map of named endpoints that can be referenced in LocalityLbEndpoints.
map<string, endpoint.Endpoint> named_endpoints = 5;

@ -94,7 +94,7 @@ message LocalityLbEndpoints {
core.Locality locality = 1;
// The group of endpoints belonging to the locality specified.
repeated LbEndpoint lb_endpoints = 2 [(gogoproto.nullable) = false];
repeated LbEndpoint lb_endpoints = 2;
// Optional: Per priority/region/zone/sub_zone weight; at least 1. The load
// balancing weight for a locality is divided by the sum of the weights of all

@ -54,7 +54,7 @@ message Listener {
// The address that the listener should listen on. In general, the address must be unique, though
// that is governed by the bind rules of the OS. E.g., multiple listeners can listen on port 0 on
// Linux as the actual port will be allocated by the OS.
core.Address address = 2 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
core.Address address = 2 [(validate.rules).message.required = true];
// A list of filter chains to consider for this listener. The
// :ref:`FilterChain <envoy_api_msg_listener.FilterChain>` with the most specific
@ -63,7 +63,7 @@ message Listener {
//
// Example using SNI for filter chain selection can be found in the
// :ref:`FAQ entry <faq_how_to_setup_sni>`.
repeated listener.FilterChain filter_chains = 3 [(gogoproto.nullable) = false];
repeated listener.FilterChain filter_chains = 3;
// If a connection is redirected using *iptables*, the port on which the proxy
// receives it might be different from the original destination address. When this flag is set to
@ -129,7 +129,7 @@ message Listener {
// :ref:`protocol <envoy_api_field_core.SocketAddress.protocol>` is :ref:'UDP
// <envoy_api_field_core.Protocol.UDP>`.
// UDP listeners currently support a single filter.
repeated listener.ListenerFilter listener_filters = 9 [(gogoproto.nullable) = false];
repeated listener.ListenerFilter listener_filters = 9;
// The timeout to wait for all listener filters to complete operation. If the timeout is reached,
// the accepted socket is closed without a connection being created. Specify 0 to disable the

@ -173,7 +173,7 @@ message FilterChain {
// connections established with the listener. Order matters as the filters are
// processed sequentially as connection events happen. Note: If the filter
// list is empty, the connection will close by default.
repeated Filter filters = 3 [(gogoproto.nullable) = false];
repeated Filter filters = 3;
// Whether the listener should expect a PROXY protocol V1 header on new
// connections. If this option is enabled, the listener will assume that that

@ -69,7 +69,7 @@ message RouteConfiguration {
string name = 1;
// An array of virtual hosts that make up the route table.
repeated route.VirtualHost virtual_hosts = 2 [(gogoproto.nullable) = false];
repeated route.VirtualHost virtual_hosts = 2;
// An array of virtual hosts will be dynamically loaded via the VHDS API.
// Both *virtual_hosts* and *vhds* fields will be used when present. *virtual_hosts* can be used
@ -131,6 +131,5 @@ message RouteConfiguration {
// [#not-implemented-hide:]
message Vhds {
// Configuration source specifier for VHDS.
envoy.api.v2.core.ConfigSource config_source = 1
[(validate.rules).message.required = true, (gogoproto.nullable) = false];
envoy.api.v2.core.ConfigSource config_source = 1 [(validate.rules).message.required = true];
}

@ -58,7 +58,7 @@ message VirtualHost {
// The list of routes that will be matched, in order, for incoming requests.
// The first route that matches will be used.
repeated Route routes = 3 [(gogoproto.nullable) = false];
repeated Route routes = 3;
enum TlsRequirementType {
// No TLS requirement for the virtual host.
@ -164,7 +164,7 @@ message Route {
string name = 14;
// Route matching parameters.
RouteMatch match = 1 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
RouteMatch match = 1 [(validate.rules).message.required = true];
oneof action {
option (validate.required) = true;

@ -37,7 +37,7 @@ message Bootstrap {
message StaticResources {
// Static :ref:`Listeners <envoy_api_msg_Listener>`. These listeners are
// available regardless of LDS configuration.
repeated envoy.api.v2.Listener listeners = 1 [(gogoproto.nullable) = false];
repeated envoy.api.v2.Listener listeners = 1;
// If a network based configuration source is specified for :ref:`cds_config
// <envoy_api_field_config.bootstrap.v2.Bootstrap.DynamicResources.cds_config>`, it's necessary
@ -45,11 +45,11 @@ message Bootstrap {
// how to speak to the management server. These cluster definitions may not
// use :ref:`EDS <arch_overview_dynamic_config_eds>` (i.e. they should be static
// IP or DNS-based).
repeated envoy.api.v2.Cluster clusters = 2 [(gogoproto.nullable) = false];
repeated envoy.api.v2.Cluster clusters = 2;
// These static secrets can be used by :ref:`SdsSecretConfig
// <envoy_api_msg_auth.SdsSecretConfig>`
repeated envoy.api.v2.auth.Secret secrets = 3 [(gogoproto.nullable) = false];
repeated envoy.api.v2.auth.Secret secrets = 3;
}
// Statically specified resources.
StaticResources static_resources = 2;

@ -20,8 +20,7 @@ message CommonExtensionConfig {
// [#not-implemented-hide:]
message TapDSConfig {
// Configuration for the source of TapDS updates for this Cluster.
envoy.api.v2.core.ConfigSource config_source = 1
[(validate.rules).message.required = true, (gogoproto.nullable) = false];
envoy.api.v2.core.ConfigSource config_source = 1 [(validate.rules).message.required = true];
// Tap config to request from XDS server.
string name = 2 [(validate.rules).string.min_bytes = 1];

@ -37,16 +37,16 @@ message RouteConfiguration {
// The list of routes that will be matched, in order, against incoming requests. The first route
// that matches will be used.
repeated Route routes = 5 [(gogoproto.nullable) = false];
repeated Route routes = 5;
}
// [#comment:next free field: 3]
message Route {
// Route matching parameters.
RouteMatch match = 1 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
RouteMatch match = 1 [(validate.rules).message.required = true];
// Route request to some upstream cluster.
RouteAction route = 2 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
RouteAction route = 2 [(validate.rules).message.required = true];
}
// [#comment:next free field: 3]

@ -428,8 +428,7 @@ message HttpConnectionManager {
message Rds {
// Configuration source specifier for RDS.
envoy.api.v2.core.ConfigSource config_source = 1
[(validate.rules).message.required = true, (gogoproto.nullable) = false];
envoy.api.v2.core.ConfigSource config_source = 1 [(validate.rules).message.required = true];
// The name of the route configuration. This name will be passed to the RDS
// API. This allows an Envoy configuration with multiple HTTP listeners (and
@ -529,8 +528,7 @@ message ScopedRoutes {
// Configuration source specifier for RDS.
// This config source is used to subscribe to RouteConfiguration resources specified in
// ScopedRouteConfiguration messages.
envoy.api.v2.core.ConfigSource rds_config_source = 3
[(validate.rules).message.required = true, (gogoproto.nullable) = false];
envoy.api.v2.core.ConfigSource rds_config_source = 3 [(validate.rules).message.required = true];
oneof config_specifier {
option (validate.required) = true;
@ -554,7 +552,7 @@ message ScopedRoutes {
message ScopedRds {
// Configuration source specifier for scoped RDS.
envoy.api.v2.core.ConfigSource scoped_rds_config_source = 1
[(validate.rules).message.required = true, (gogoproto.nullable) = false];
[(validate.rules).message.required = true];
}
message HttpFilter {

@ -144,7 +144,7 @@ message RedisProxy {
}
// List of prefix routes.
repeated Route routes = 1 [(gogoproto.nullable) = false];
repeated Route routes = 1;
// Indicates that prefix matching should be case insensitive.
bool case_insensitive = 2;
@ -190,7 +190,7 @@ message RedisProxy {
// See the :ref:`configuration section
// <arch_overview_redis_configuration>` of the architecture overview for recommendations on
// configuring the backing clusters.
PrefixRoutes prefix_routes = 5 [(gogoproto.nullable) = false];
PrefixRoutes prefix_routes = 5;
// Authenticate Redis client connections locally by forcing downstream clients to issue a 'Redis
// AUTH command <https://redis.io/commands/auth>`_ with this password before enabling any other

@ -25,16 +25,16 @@ message RouteConfiguration {
// The list of routes that will be matched, in order, against incoming requests. The first route
// that matches will be used.
repeated Route routes = 2 [(gogoproto.nullable) = false];
repeated Route routes = 2;
}
// [#comment:next free field: 3]
message Route {
// Route matching parameters.
RouteMatch match = 1 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
RouteMatch match = 1 [(validate.rules).message.required = true];
// Route request to some upstream cluster.
RouteAction route = 2 [(validate.rules).message.required = true, (gogoproto.nullable) = false];
RouteAction route = 2 [(validate.rules).message.required = true];
}
// [#comment:next free field: 5]

Loading…
Cancel
Save