Skip to content

Commit

Permalink
fix(kuma-cp): order ExternalServices for building VIPs (#7333)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukasz Dziedziak <lukidzi@gmail.com>
  • Loading branch information
lukidzi committed Jul 26, 2023
1 parent 69aee01 commit ef4f8a2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/dns/vips_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net"
"sort"
"strings"

"github.com/pkg/errors"
Expand Down Expand Up @@ -226,6 +227,12 @@ func (d *VIPsAllocator) BuildVirtualOutboundMeshView(ctx context.Context, mesh s
if err := d.rm.List(ctx, &externalServices, store.ListByMesh(mesh)); err != nil {
return nil, err
}
// TODO(lukidzi): after switching to use the resource store as in the code for tests
// we should switch to `ListOrdered` https://github.com/kumahq/kuma/issues/7356
sort.SliceStable(externalServices.Items, func(i, j int) bool {
return (externalServices.Items[i].GetMeta().GetName() < externalServices.Items[j].GetMeta().GetName())
})

for _, es := range externalServices.Items {
tags := map[string]string{mesh_proto.ServiceTag: es.Spec.GetService()}
if d.serviceVipEnabled {
Expand Down

0 comments on commit ef4f8a2

Please sign in to comment.