Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
howardjohn committed Jun 27, 2024
1 parent b20c529 commit 3153f3e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
3 changes: 3 additions & 0 deletions pilot/pkg/networking/core/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"istio.io/istio/pkg/log"
"istio.io/istio/pkg/security"
netutil "istio.io/istio/pkg/util/net"
"istio.io/istio/pkg/util/protomarshal"
"istio.io/istio/pkg/util/sets"
)

Expand Down Expand Up @@ -378,6 +379,8 @@ func (p clusterPatcher) patch(hosts []host.Name, c *cluster.Cluster) *discovery.
if cluster == nil {
return nil
}
v, _ := protomarshal.MarshalIndent(c, " ")
log.Errorf("howardjohn: %v", string(v))
return &discovery.Resource{Name: cluster.Name, Resource: protoconv.MessageToAny(cluster)}
}

Expand Down
12 changes: 7 additions & 5 deletions pilot/pkg/networking/core/cluster_tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ var hboneTransportSocket = &cluster.Cluster_TransportSocketMatch{
TransportSocket: internalUpstreamSocket,
}

var hboneOrPlaintextSocket = []*cluster.Cluster_TransportSocketMatch{
hboneTransportSocket,
defaultTransportSocketMatch(),
func hboneOrPlaintextSocket() []*cluster.Cluster_TransportSocketMatch {
return []*cluster.Cluster_TransportSocketMatch{
hboneTransportSocket,
defaultTransportSocketMatch(),
}
}

// applyUpstreamTLSSettings applies upstream tls context to the cluster
Expand Down Expand Up @@ -358,7 +360,7 @@ func (cb *ClusterBuilder) applyHBONETransportSocketMatches(c *cluster.Cluster, t
istioAutoDetectedMtls bool,
) {
if tls == nil {
c.TransportSocketMatches = hboneOrPlaintextSocket
c.TransportSocketMatches = hboneOrPlaintextSocket()
return
}
// For headless service, discovery type will be `Cluster_ORIGINAL_DST`
Expand All @@ -379,7 +381,7 @@ func (cb *ClusterBuilder) applyHBONETransportSocketMatches(c *cluster.Cluster, t
}
} else {
if c.TransportSocket == nil {
c.TransportSocketMatches = hboneOrPlaintextSocket
c.TransportSocketMatches = hboneOrPlaintextSocket()
} else {
ts := c.TransportSocket
c.TransportSocket = nil
Expand Down
2 changes: 1 addition & 1 deletion pilot/pkg/networking/core/cluster_traffic_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ func (cb *ClusterBuilder) applyUpstreamProxyProtocol(
Name: "envoy.transport_sockets.upstream_proxy_protocol",
ConfigType: &core.TransportSocket_TypedConfig{TypedConfig: protoconv.MessageToAny(&proxyprotocol.ProxyProtocolUpstreamTransport{
Config: &core.ProxyProtocolConfig{Version: core.ProxyProtocolConfig_Version(proxyProtocol.Version)},
TransportSocket: util.RawBufferTransport,
TransportSocket: util.RawBufferTransport(),
})},
}
return
Expand Down
2 changes: 1 addition & 1 deletion pilot/pkg/networking/core/cluster_waypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (cb *ClusterBuilder) buildWaypointInboundVIPCluster(
clusterMode: DefaultClusterMode,
direction: model.TrafficDirectionInboundVIP,
}
transportSocket := util.RawBufferTransport
transportSocket := util.RawBufferTransport()
if tlsContext := buildWaypointTLSContext(opts, tls); tlsContext != nil {
transportSocket = &core.TransportSocket{
Name: "internal_upstream",
Expand Down
10 changes: 6 additions & 4 deletions pilot/pkg/networking/util/internal_upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ var TunnelHostMetadata = []*internalupstream.InternalUpstreamTransport_MetadataV
},
}

var RawBufferTransport = &core.TransportSocket{
Name: "raw_buffer",
ConfigType: &core.TransportSocket_TypedConfig{TypedConfig: protoconv.MessageToAny(&rawbuffer.RawBuffer{})},
func RawBufferTransport() *core.TransportSocket {
return &core.TransportSocket{
Name: "raw_buffer",
ConfigType: &core.TransportSocket_TypedConfig{TypedConfig: protoconv.MessageToAny(&rawbuffer.RawBuffer{})},
}
}

var DefaultInternalUpstreamTransportSocket = &core.TransportSocket{
Name: "internal_upstream",
ConfigType: &core.TransportSocket_TypedConfig{TypedConfig: protoconv.MessageToAny(&internalupstream.InternalUpstreamTransport{
TransportSocket: RawBufferTransport,
TransportSocket: RawBufferTransport(),
})},
}

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/ambient/baseline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1432,9 +1432,9 @@ spec:
}, originateTLSTmpl).ApplyOrFail(t)
src.CallOrFail(t, echo.CallOptions{
To: dst,
Port: dst.PortForName("http"),
Port: ports.HTTPWithProxy,
Scheme: scheme.HTTP,
//NewConnectionPerRequest: true,
// NewConnectionPerRequest: true,
})
})
}
Expand Down

0 comments on commit 3153f3e

Please sign in to comment.