Skip to content

Commit

Permalink
fix(kuma-cp): do not change ip to ZoneEgress address (#4193)
Browse files Browse the repository at this point in the history
Signed-off-by: Łukasz Dziedziak <[email protected]>
  • Loading branch information
lukidzi authored Apr 19, 2022
1 parent 65378e5 commit 11b966d
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/xds/topology/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func fillIngressOutbounds(
// ignore
// If zone egresses present, we want to pass the traffic:
// dp -> zone egress -> zone ingress -> dp
if len(zoneEgresses) > 0 {
if mesh.ZoneEgressEnabled() && len(zoneEgresses) > 0 {
for _, ze := range zoneEgresses {
zeNetworking := ze.Spec.GetNetworking()
zeAddress := zeNetworking.GetAddress()
Expand Down
94 changes: 94 additions & 0 deletions pkg/xds/topology/outbound_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,100 @@ var _ = Describe("TrafficRoute", func() {
},
},
}),
Entry("service in zone2 available through ingress when zoneEgress disabled but zoneEgress instances available", testCase{
dataplanes: []*core_mesh.DataplaneResource{
{
Meta: &test_model.ResourceMeta{Mesh: defaultMeshName},
Spec: &mesh_proto.Dataplane{
Networking: &mesh_proto.Dataplane_Networking{
Address: "192.168.0.1",
Inbound: []*mesh_proto.Dataplane_Networking_Inbound{
{
Tags: map[string]string{mesh_proto.ServiceTag: "redis", "version": "v1"},
Port: 6379,
ServicePort: 16379,
},
},
},
},
},
},
externalServices: []*core_mesh.ExternalServiceResource{
{
Meta: &test_model.ResourceMeta{Mesh: defaultMeshName},
Spec: &mesh_proto.ExternalService{
Networking: &mesh_proto.ExternalService_Networking{
Address: "httpbin.org:80",
},
Tags: map[string]string{mesh_proto.ServiceTag: "httpbin"},
},
},
},
zoneIngresses: []*core_mesh.ZoneIngressResource{
{
Spec: &mesh_proto.ZoneIngress{
Zone: "zone-2",
Networking: &mesh_proto.ZoneIngress_Networking{
Address: "10.20.1.2",
Port: 10001,
AdvertisedAddress: "192.168.0.100",
AdvertisedPort: 12345,
},
AvailableServices: []*mesh_proto.ZoneIngress_AvailableService{
{
Instances: 2,
Mesh: defaultMeshName,
Tags: map[string]string{mesh_proto.ServiceTag: "service-in-zone2", mesh_proto.ZoneTag: "zone-2"},
ExternalService: true,
},
},
},
},
},
zoneEgresses: []*core_mesh.ZoneEgressResource{
{
Meta: &test_model.ResourceMeta{
Name: "egress",
Mesh: "default",
},
Spec: &mesh_proto.ZoneEgress{
Networking: &mesh_proto.ZoneEgress_Networking{
Address: "1.1.1.1",
Port: 10002,
},
},
},
},
mesh: defaultMeshWithMTLS,
expected: core_xds.EndpointMap{
"redis": []core_xds.Endpoint{
{
Target: "192.168.0.1",
Port: 6379,
Tags: map[string]string{mesh_proto.ServiceTag: "redis", "version": "v1"},
Weight: 1,
},
},
"service-in-zone2": []core_xds.Endpoint{
{
Target: "192.168.0.100",
Port: 12345,
Tags: map[string]string{mesh_proto.ServiceTag: "service-in-zone2", mesh_proto.ZoneTag: "zone-2"},
Weight: 2, // local weight is bumped to 2 to factor two instances of Ingresses
Locality: &core_xds.Locality{Zone: "zone-2"},
},
},
"httpbin": []core_xds.Endpoint{
{
Target: "httpbin.org",
Port: 80,
Tags: map[string]string{mesh_proto.ServiceTag: "httpbin"},
Weight: 1,
ExternalService: &core_xds.ExternalService{},
},
},
},
}),
)
Describe("BuildRemoteEndpointMap()", func() {
type testCase struct {
Expand Down

0 comments on commit 11b966d

Please sign in to comment.