Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.13] multi-network: fix eastwest gateway endpoint filtering (#38762) #39275

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions pilot/pkg/xds/endpoint_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ func NewEndpointBuilder(clusterName string, proxy *model.Proxy, push *model.Push
port: port,
}

passthroughMode := model.IsDNSSrvSubsetKey(clusterName)
// We need this for multi-network, or for clusters meant for use with AUTO_PASSTHROUGH.
if features.EnableAutomTLSCheckPolicies ||
b.push.NetworkManager().IsMultiNetworkEnabled() || model.IsDNSSrvSubsetKey(clusterName) {
b.mtlsChecker = newMtlsChecker(push, port, dr)
b.push.NetworkManager().IsMultiNetworkEnabled() || passthroughMode {
b.mtlsChecker = newMtlsChecker(push, port, dr, passthroughMode)
}
return b
}
Expand Down Expand Up @@ -435,19 +436,26 @@ type mtlsChecker struct {
rootPolicyMode *networkingapi.ClientTLSSettings_TLSmode
}

func newMtlsChecker(push *model.PushContext, svcPort int, dr *config.Config) *mtlsChecker {
func newMtlsChecker(push *model.PushContext, svcPort int, dr *config.Config, passthroughMode bool) *mtlsChecker {
var rootPolicyMode *networkingapi.ClientTLSSettings_TLSmode
var drSpec *networkingapi.DestinationRule
if dr != nil {
drSpec = dr.Spec.(*networkingapi.DestinationRule)

// tcp passthrough gateways don't care about client settings
if !passthroughMode {
rootPolicyMode = mtlsModeForDefaultTrafficPolicy(dr, svcPort)
if dr != nil {
drSpec = dr.Spec.(*networkingapi.DestinationRule)
}
}

return &mtlsChecker{
push: push,
svcPort: svcPort,
destinationRule: drSpec,
mtlsDisabledHosts: map[string]struct{}{},
peerAuthDisabledMTLS: map[string]bool{},
subsetPolicyMode: map[string]*networkingapi.ClientTLSSettings_TLSmode{},
rootPolicyMode: mtlsModeForDefaultTrafficPolicy(dr, svcPort),
rootPolicyMode: rootPolicyMode,
}
}

Expand Down
7 changes: 7 additions & 0 deletions releasenotes/notes/38704.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: release-notes/v2
kind: bug-fix
area: traffic-management
issue: [38704]
releaseNotes:
- |
**Fixed** improper filtering of endpoints from East-West Gateway caused by `DestinationRule` TLS settings.