Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
rds/ingress: remove WASM mesh headers
Browse files Browse the repository at this point in the history
This is a follow-up to b333f45 where the internal
mesh headers added to the HTTP response for ingress
are removed, so mesh information such as pod names
are not leaked externally.

Signed-off-by: Shashank Ram <[email protected]>
  • Loading branch information
shashankram committed Aug 6, 2021
1 parent 2e3f008 commit ee994dd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pkg/envoy/rds/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewResponse(cataloger catalog.MeshCataloger, proxy *envoy.Proxy, discoveryR
ingressTrafficPolicies = trafficpolicy.MergeInboundPolicies(catalog.AllowPartialHostnamesMatch, ingressTrafficPolicies, ingressPolicy.HTTPRoutePolicies...)
}
if len(ingressTrafficPolicies) > 0 {
ingressRouteConfig := route.BuildIngressConfiguration(ingressTrafficPolicies, proxy, cfg)
ingressRouteConfig := route.BuildIngressConfiguration(ingressTrafficPolicies)
rdsResources = append(rdsResources, ingressRouteConfig)
}

Expand Down
13 changes: 1 addition & 12 deletions pkg/envoy/rds/route/route_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func BuildRouteConfiguration(inbound []*trafficpolicy.InboundTrafficPolicy, outb
}

// BuildIngressConfiguration constructs the Envoy constructs ([]*xds_route.RouteConfiguration) for implementing ingress routes
func BuildIngressConfiguration(ingress []*trafficpolicy.InboundTrafficPolicy, proxy *envoy.Proxy, cfg configurator.Configurator) *xds_route.RouteConfiguration {
func BuildIngressConfiguration(ingress []*trafficpolicy.InboundTrafficPolicy) *xds_route.RouteConfiguration {
if len(ingress) == 0 {
return nil
}
Expand All @@ -115,17 +115,6 @@ func BuildIngressConfiguration(ingress []*trafficpolicy.InboundTrafficPolicy, pr
ingressRouteConfig.VirtualHosts = append(ingressRouteConfig.VirtualHosts, virtualHost)
}

if featureFlags := cfg.GetFeatureFlags(); featureFlags.EnableWASMStats {
for k, v := range proxy.StatsHeaders() {
ingressRouteConfig.ResponseHeadersToAdd = append(ingressRouteConfig.ResponseHeadersToAdd, &core.HeaderValueOption{
Header: &core.HeaderValue{
Key: k,
Value: v,
},
})
}
}

return ingressRouteConfig
}

Expand Down
9 changes: 1 addition & 8 deletions pkg/envoy/rds/route/route_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ func TestBuildRouteConfiguration(t *testing.T) {
}

func TestBuildIngressRouteConfiguration(t *testing.T) {
mockCtrl := gomock.NewController(t)
mockCfg := configurator.NewMockConfigurator(mockCtrl)

testCases := []struct {
name string
ingressPolicies []*trafficpolicy.InboundTrafficPolicy
Expand Down Expand Up @@ -214,11 +211,7 @@ func TestBuildIngressRouteConfiguration(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
assert := tassert.New(t)

mockCfg.EXPECT().GetFeatureFlags().Return(v1alpha1.FeatureFlags{
EnableWASMStats: false,
}).AnyTimes()
actual := BuildIngressConfiguration(tc.ingressPolicies, nil, mockCfg)
actual := BuildIngressConfiguration(tc.ingressPolicies)

if tc.expectedRouteConfigFields == nil {
assert.Nil(actual)
Expand Down

0 comments on commit ee994dd

Please sign in to comment.