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

fix(kuma-cp): clone outbound tags (backport of #9592) #9599

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/xds/generator/outbound_proxy_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"fmt"

"github.com/pkg/errors"
"golang.org/x/exp/maps"

mesh_proto "github.com/kumahq/kuma/api/mesh/v1alpha1"
"github.com/kumahq/kuma/pkg/core"
core_mesh "github.com/kumahq/kuma/pkg/core/resources/apis/mesh"
"github.com/kumahq/kuma/pkg/core/user"
model "github.com/kumahq/kuma/pkg/core/xds"
"github.com/kumahq/kuma/pkg/util/maps"
util_maps "github.com/kumahq/kuma/pkg/util/maps"
util_protocol "github.com/kumahq/kuma/pkg/util/protocol"
xds_context "github.com/kumahq/kuma/pkg/xds/context"
envoy_common "github.com/kumahq/kuma/pkg/xds/envoy"
Expand Down Expand Up @@ -459,7 +460,7 @@ func buildOutboundsWithMultipleIPs(dataplane *core_mesh.DataplaneResource, outbo

tagsToOutbounds := map[string]OutboundWithMultipleIPs{}
for _, outbound := range outbounds {
tags := outbound.GetTags()
tags := maps.Clone(outbound.GetTags())
tags[mesh_proto.ServiceTag] = outbound.GetService()
tagsStr := mesh_proto.SingleValueTagSet(tags).String()
owmi := tagsToOutbounds[tagsStr]
Expand All @@ -476,7 +477,7 @@ func buildOutboundsWithMultipleIPs(dataplane *core_mesh.DataplaneResource, outbo

// return sorted outbounds for a stable XDS config
var result []OutboundWithMultipleIPs
for _, key := range maps.SortedKeys(tagsToOutbounds) {
for _, key := range util_maps.SortedKeys(tagsToOutbounds) {
result = append(result, tagsToOutbounds[key])
}
return result
Expand Down