Skip to content

Commit

Permalink
backport of commit 16d59ad
Browse files Browse the repository at this point in the history
  • Loading branch information
ndhanushkodi committed Aug 19, 2024
1 parent d565ea4 commit f7c03fc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
9 changes: 6 additions & 3 deletions agent/structs/config_entry_mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ type MeshConfigEntry struct {
// MutualTLSMode=permissive in either service-defaults or proxy-defaults.
AllowEnablingPermissiveMutualTLS bool `json:",omitempty" alias:"allow_enabling_permissive_mutual_tls"`

// ValidateClusters is false by default and configures whether Envoy proxies will validate clusters in a route. If
// set to true and any clusters in the route do not exist, the route table will not load. If set to false, the route
// table will load and routing to a non-existent cluster will result in a 404.
// ValidateClusters controls whether the clusters the route table refers to are validated. The default value is
// false. When set to false and a route refers to a cluster that does not exist, the route table loads and routing
// to a non-existent cluster results in a 404. When set to true and the route is set to a cluster that do not exist,
// the route table will not load. For more information, refer to
// [HTTP route configuration in the Envoy docs](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route.proto#envoy-v3-api-field-config-route-v3-routeconfiguration-validate-clusters)
// for more details.
ValidateClusters bool `json:",omitempty" alias:"validate_clusters"`

TLS *MeshTLSConfig `json:",omitempty"`
Expand Down
6 changes: 2 additions & 4 deletions agent/xds/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,8 @@ func (s *ResourceGenerator) routesForMeshGateway(cfgSnap *proxycfg.ConfigSnapsho
Name: uid.EnvoyID(),
VirtualHosts: []*envoy_route_v3.VirtualHost{virtualHost},
}
if mesh := cfgSnap.MeshConfig(); mesh != nil {
if mesh.ValidateClusters {
route.ValidateClusters = response.MakeBoolValue(true)
}
if meshValidateClusters(cfgSnap) {
route.ValidateClusters = response.MakeBoolValue(true)
}
resources = append(resources, route)
}
Expand Down
9 changes: 6 additions & 3 deletions api/config_entry_mesh.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ type MeshConfigEntry struct {
// MutualTLSMode=permissive in either service-defaults or proxy-defaults.
AllowEnablingPermissiveMutualTLS bool `json:",omitempty" alias:"allow_enabling_permissive_mutual_tls"`

// ValidateClusters is false by default and configures whether Envoy proxies will validate clusters in a route. If
// set to true and any clusters in the route do not exist, the route table will not load. If set to false, the route
// table will load and routing to a non-existent cluster will result in a 404.
// ValidateClusters controls whether the clusters the route table refers to are validated. The default value is
// false. When set to false and a route refers to a cluster that does not exist, the route table loads and routing
// to a non-existent cluster results in a 404. When set to true and the route is set to a cluster that do not exist,
// the route table will not load. For more information, refer to
// [HTTP route configuration in the Envoy docs](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route.proto#envoy-v3-api-field-config-route-v3-routeconfiguration-validate-clusters)
// for more details.
ValidateClusters bool `json:",omitempty" alias:"validate_clusters"`

TLS *MeshTLSConfig `json:",omitempty"`
Expand Down
11 changes: 11 additions & 0 deletions website/content/docs/connect/config-entries/mesh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,17 @@ Note that the Kubernetes example does not include a `partition` field. Configura
description:
'Controls whether `MutualTLSMode=permissive` can be set in the `proxy-defaults` and `service-defaults` configuration entries. '
},
{
name: 'ValidateClusters',
type: 'bool: false',
description:
`Controls whether the clusters the route table refers to are validated. The default value is false. When set to
false and a route refers to a cluster that does not exist, the route table loads and routing to a non-existent
cluster results in a 404. When set to true and the route is set to a cluster that do not exist, the route table
will not load. For more information, refer to
[HTTP route configuration in the Envoy docs](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route.proto#envoy-v3-api-field-config-route-v3-routeconfiguration-validate-clusters)
for more details. `,
},
{
name: 'TLS',
type: 'TLSConfig: <optional>',
Expand Down

0 comments on commit f7c03fc

Please sign in to comment.