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

[DNM] k8s gateway cluster names #10403

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5fc9b4f
redo orig changes
jenshu Nov 25, 2024
7528fce
initial refactor
jenshu Nov 25, 2024
fb25af5
do it the easy way
jenshu Nov 25, 2024
2c25236
pre-refactor2 commit
jenshu Nov 25, 2024
7771e19
Merge branch 'main' of github.com:solo-io/gloo into kubegateway-clust…
jenshu Nov 25, 2024
ec98633
revert almost everything and cleanup
jenshu Nov 25, 2024
1842d7f
revert line
jenshu Nov 25, 2024
a69ca51
fix cl
jenshu Nov 25, 2024
7f2e29a
remove old one
jenshu Nov 25, 2024
caee7f9
Merge branch 'main' of github.com:solo-io/gloo into kubegateway-clust…
jenshu Nov 26, 2024
175b0fd
Merge branch 'main' of github.com:solo-io/gloo into kubegateway-clust…
jenshu Nov 26, 2024
89dcbe9
use Key in places that can
jenshu Nov 27, 2024
f6d267e
update util funcs
jenshu Nov 27, 2024
20a5c09
everything else
jenshu Nov 27, 2024
3a96a0e
Merge branch 'main' of github.com:solo-io/gloo into kubegateway-clust…
jenshu Nov 27, 2024
3e55bb6
codegen
jenshu Nov 27, 2024
2d292c0
fix test
jenshu Nov 27, 2024
a56219b
fix test
jenshu Nov 27, 2024
1447158
oops
jenshu Nov 27, 2024
d008599
Merge branch 'main' of github.com:solo-io/gloo into kubegateway-clust…
jenshu Nov 27, 2024
01ffc75
Merge branch 'main' of github.com:solo-io/gloo into kubegateway-clust…
jenshu Nov 28, 2024
094e5a3
try something
jenshu Nov 28, 2024
ba951c4
clean up
jenshu Nov 28, 2024
2564f92
conversion tests
jenshu Dec 1, 2024
a627fa1
finish changelog
jenshu Dec 2, 2024
237b50a
Merge branch 'main' into kubegateway-clusternames
jenshu Dec 2, 2024
4ba5c10
Adding changelog file to new location
Dec 2, 2024
9f6c3ff
Deleting changelog file from old location
Dec 2, 2024
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
10 changes: 10 additions & 0 deletions changelog/v1.18.0-rc4/kubegateway-clusternames.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
changelog:
- type: BREAKING_CHANGE
issueLink: https://github.com/solo-io/solo-projects/issues/7105
resolvesIssue: false
description: >-
When using the Kubernetes Gateway API, envoy cluster names corresponding to Kubernetes Service Upstreams
are now in a new more parseable format that allows us to extract info about the Service for metrics:
`upstreamName_upstreamNs_svcNs_svcName_svcPort` (underscore-separated). Note that as long as Kubernetes
Gateway integration is enabled (i.e. Gloo Gateway installed with `kubeGateway.enabled=true`), both
Edge and Kubernetes Gateway proxies will use the new cluster format.
5 changes: 2 additions & 3 deletions projects/discovery/pkg/fds/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

v1 "github.com/solo-io/gloo/projects/gloo/pkg/api/v1"
plugins "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/options"
"github.com/solo-io/gloo/projects/gloo/pkg/translator"
)

var errorUndetectableUpstream = errors.New("upstream type cannot be detected")
Expand Down Expand Up @@ -115,7 +114,7 @@ func (u *Updater) UpstreamUpdated(upstream *v1.Upstream) {

func (u *Updater) UpstreamAdded(upstream *v1.Upstream) {
// upstream already tracked. ignore.
key := translator.UpstreamToClusterName(upstream.GetMetadata().Ref())
key := upstream.GetMetadata().Ref().Key()
if _, ok := u.activeUpstreams[key]; ok {
return
}
Expand Down Expand Up @@ -144,7 +143,7 @@ func (u *Updater) UpstreamAdded(upstream *v1.Upstream) {
}

func (u *Updater) UpstreamRemoved(upstream *v1.Upstream) {
key := translator.UpstreamToClusterName(upstream.GetMetadata().Ref())
key := upstream.GetMetadata().Ref().Key()
if upstreamState, ok := u.activeUpstreams[key]; ok {
upstreamState.cancel()
delete(u.activeUpstreams, key)
Expand Down
7 changes: 3 additions & 4 deletions projects/gateway/pkg/syncer/translator_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/solo-io/gloo/pkg/utils/statsutils/metrics"
"github.com/solo-io/gloo/pkg/utils/syncutil"

gloo_translator "github.com/solo-io/gloo/projects/gloo/pkg/translator"
"github.com/solo-io/solo-kit/pkg/api/v1/clients"
"github.com/solo-io/solo-kit/pkg/errors"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -230,7 +229,7 @@ func (s *statusSyncer) setCurrentProxies(desiredProxies reconciler.GeneratedProx
// floating around. Historically, they were there to envorce an alphabetical processing of
// `proxyToLastStatus`. See https://github.com/solo-io/gloo/issues/5812 for more details.
for proxyRef, reports := range proxyReportsByRef {
refKey := gloo_translator.UpstreamToClusterName(proxyRef)
refKey := glooutils.ResourceRefToKey(proxyRef)
if _, ok := s.proxyToLastStatus[refKey]; !ok {
s.proxyToLastStatus[refKey] = reportsAndStatus{}
}
Expand Down Expand Up @@ -295,7 +294,7 @@ func (s *statusSyncer) setStatuses(list gloov1.ProxyList) {
defer s.mapLock.Unlock()
for _, proxy := range list {
ref := proxy.GetMetadata().Ref()
refKey := gloo_translator.UpstreamToClusterName(ref)
refKey := glooutils.ResourceRefToKey(ref)
status := s.statusClient.GetStatus(proxy)
if current, ok := s.proxyToLastStatus[refKey]; ok {
current.Status = status
Expand Down Expand Up @@ -359,7 +358,7 @@ func (s *statusSyncer) extractCurrentReports() (reporter.ResourceReports, map[re

var refKeys []string
for _, ref := range s.currentGeneratedProxies {
refKeys = append(refKeys, gloo_translator.UpstreamToClusterName(ref))
refKeys = append(refKeys, glooutils.ResourceRefToKey(ref))
}

// iterate over proxyToLastStatus by alphabetical ordering of keys
Expand Down
20 changes: 10 additions & 10 deletions projects/gateway/pkg/syncer/translator_syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
gloov1snap "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/gloosnapshot"
"github.com/solo-io/gloo/projects/gloo/pkg/defaults"
gloomocks "github.com/solo-io/gloo/projects/gloo/pkg/mocks"
"github.com/solo-io/gloo/projects/gloo/pkg/translator"
"github.com/solo-io/gloo/projects/gloo/pkg/utils"
"github.com/solo-io/solo-kit/pkg/api/v1/resources"
"github.com/solo-io/solo-kit/pkg/api/v1/resources/core"
"github.com/solo-io/solo-kit/pkg/api/v2/reporter"
Expand Down Expand Up @@ -82,7 +82,7 @@ var _ = Describe("TranslatorSyncer", func() {
err := syncer.syncStatus(context.Background())
Expect(err).NotTo(HaveOccurred())
reportedKey := getMapOnlyKey(mockReporter.Reports())
Expect(reportedKey).To(Equal(translator.UpstreamToClusterName(vs.GetMetadata().Ref())))
Expect(reportedKey).To(Equal(utils.ResourceRefToKey(vs.GetMetadata().Ref())))
Expect(mockReporter.Reports()[reportedKey]).To(BeEquivalentTo(errs[vs]))
m := map[string]*core.Status{
"*v1.Proxy.test_gloo-system": {State: core.Status_Accepted},
Expand Down Expand Up @@ -137,7 +137,7 @@ var _ = Describe("TranslatorSyncer", func() {
Expect(err).NotTo(HaveOccurred())

reportedKey := getMapOnlyKey(mockReporter.Reports())
Expect(reportedKey).To(Equal(translator.UpstreamToClusterName(rt.GetMetadata().Ref())))
Expect(reportedKey).To(Equal(utils.ResourceRefToKey(rt.GetMetadata().Ref())))

Expect(reportContainsWarning(mockReporter.Reports()[reportedKey], "warning 1")).To(BeTrue())
Expect(reportContainsWarning(mockReporter.Reports()[reportedKey], "warning 2")).To(BeTrue())
Expand Down Expand Up @@ -183,7 +183,7 @@ var _ = Describe("TranslatorSyncer", func() {
syncer.handleUpdatedProxies(ctx)
Eventually(mockReporter.Reports, "5s", "0.5s").ShouldNot(BeEmpty())
reportedKey := getMapOnlyKey(mockReporter.Reports())
Expect(reportedKey).To(Equal(translator.UpstreamToClusterName(vs.GetMetadata().Ref())))
Expect(reportedKey).To(Equal(utils.ResourceRefToKey(vs.GetMetadata().Ref())))
Expect(mockReporter.Reports()[reportedKey]).To(BeEquivalentTo(errs[vs]))
m := map[string]*core.Status{
"*v1.Proxy.test_gloo-system": {State: core.Status_Accepted},
Expand Down Expand Up @@ -218,7 +218,7 @@ var _ = Describe("TranslatorSyncer", func() {
syncer.handleUpdatedProxies(ctx)
Eventually(mockReporter.Reports, "5s", "0.5s").ShouldNot(BeEmpty())
reportedKey := getMapOnlyKey(mockReporter.Reports())
Expect(reportedKey).To(Equal(translator.UpstreamToClusterName(vs.GetMetadata().Ref())))
Expect(reportedKey).To(Equal(utils.ResourceRefToKey(vs.GetMetadata().Ref())))
Expect(mockReporter.Reports()[reportedKey]).To(BeEquivalentTo(errs[vs]))
m := map[string]*core.Status{
"*v1.Proxy.test_gloo-system": {State: core.Status_Accepted},
Expand Down Expand Up @@ -253,7 +253,7 @@ var _ = Describe("TranslatorSyncer", func() {
Expect(err).NotTo(HaveOccurred())

reportedKey := getMapOnlyKey(mockReporter.Reports())
Expect(reportedKey).To(Equal(translator.UpstreamToClusterName(vs.GetMetadata().Ref())))
Expect(reportedKey).To(Equal(utils.ResourceRefToKey(vs.GetMetadata().Ref())))
Expect(mockReporter.Reports()[reportedKey]).To(BeEquivalentTo(errs[vs]))

m := map[string]*core.Status{
Expand Down Expand Up @@ -290,7 +290,7 @@ var _ = Describe("TranslatorSyncer", func() {
Expect(err).NotTo(HaveOccurred())

reportedKey := getMapOnlyKey(mockReporter.Reports())
Expect(reportedKey).To(Equal(translator.UpstreamToClusterName(vs.GetMetadata().Ref())))
Expect(reportedKey).To(Equal(utils.ResourceRefToKey(vs.GetMetadata().Ref())))
Expect(mockReporter.Reports()[reportedKey]).To(BeEquivalentTo(errs[vs]))

m := map[string]*core.Status{
Expand Down Expand Up @@ -334,7 +334,7 @@ var _ = Describe("TranslatorSyncer", func() {
mergedErrs.AddError(vs, fmt.Errorf("invalid 2"))

reportedKey := getMapOnlyKey(mockReporter.Reports())
Expect(reportedKey).To(Equal(translator.UpstreamToClusterName(vs.GetMetadata().Ref())))
Expect(reportedKey).To(Equal(utils.ResourceRefToKey(vs.GetMetadata().Ref())))
Expect(mockReporter.Reports()[reportedKey]).To(BeEquivalentTo(mergedErrs[vs]))

m := map[string]*core.Status{
Expand Down Expand Up @@ -451,7 +451,7 @@ func (f *fakeReporter) WriteReports(ctx context.Context, errs reporter.ResourceR
newreports[k] = v
}
for k, v := range errs {
newreports[translator.UpstreamToClusterName(k.GetMetadata().Ref())] = v
newreports[utils.ResourceRefToKey(k.GetMetadata().Ref())] = v
}
f.reports = newreports

Expand All @@ -460,7 +460,7 @@ func (f *fakeReporter) WriteReports(ctx context.Context, errs reporter.ResourceR
newstatus[k] = v
}
for k := range errs {
newstatus[translator.UpstreamToClusterName(k.GetMetadata().Ref())] = subresourceStatuses
newstatus[utils.ResourceRefToKey(k.GetMetadata().Ref())] = subresourceStatuses
}
f.statuses = newstatus

Expand Down
3 changes: 2 additions & 1 deletion projects/gateway2/krtcollections/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
glookubev1 "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/kube/apis/gloo.solo.io/v1"
kubeplugin "github.com/solo-io/gloo/projects/gloo/pkg/api/v1/options/kubernetes"
"github.com/solo-io/gloo/projects/gloo/pkg/translator"
"github.com/solo-io/gloo/projects/gloo/pkg/upstreams"
"github.com/solo-io/go-utils/contextutils"
"istio.io/istio/pkg/kube"
"istio.io/istio/pkg/kube/kclient"
Expand Down Expand Up @@ -429,7 +430,7 @@ func findPortInEndpointSlice(endpointSlice *discoveryv1.EndpointSlice, singlePor

// TODO: use exported version from translator?
func GetEndpointClusterName(upstream *v1.Upstream) string {
clusterName := translator.UpstreamToClusterName(upstream.GetMetadata().Ref())
clusterName := upstreams.UpstreamToClusterName(upstream)
endpointClusterName, err := translator.GetEndpointClusterName(clusterName, upstream)
if err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion projects/gateway2/proxy_syncer/cla.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func PrioritizeEndpoints(logger *zap.Logger, destrule *DestinationRuleWrapper, e
var priorityInfo *PriorityInfo

if destrule != nil {
trafficPolicy := getTraficPolicy(destrule, ep.Port)
trafficPolicy := getTrafficPolicy(destrule, ep.Port)
localityLb := getLocalityLbSetting(trafficPolicy)
if localityLb != nil {
priorityInfo = getPriorityInfoFromDestrule(localityLb)
Expand Down
2 changes: 1 addition & 1 deletion projects/gateway2/proxy_syncer/destrule.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func getLocalityLbSetting(trafficPolicy *v1alpha3.TrafficPolicy) *v1alpha3.Local
return localityLb
}

func getTraficPolicy(destrule *DestinationRuleWrapper, port uint32) *v1alpha3.TrafficPolicy {
func getTrafficPolicy(destrule *DestinationRuleWrapper, port uint32) *v1alpha3.TrafficPolicy {
trafficPolicy := destrule.Spec.GetTrafficPolicy()
if trafficPolicy == nil {
return nil
Expand Down
2 changes: 1 addition & 1 deletion projects/gateway2/proxy_syncer/upstreams.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func translate(ctx context.Context, settings *gloov1.Settings, translator setup.

func ApplyDestRulesForUpstream(destrule *DestinationRuleWrapper, u *gloov1.Upstream) (*gloov1.Upstream, string) {
if destrule != nil {
trafficPolicy := getTraficPolicy(destrule, ggv2utils.GetPortForUpstream(u))
trafficPolicy := getTrafficPolicy(destrule, ggv2utils.GetPortForUpstream(u))
if outlier := trafficPolicy.GetOutlierDetection(); outlier != nil {
name := krtcollections.GetEndpointClusterName(u)

Expand Down
2 changes: 1 addition & 1 deletion projects/gateway2/setup/ggv2setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (g *genericStatusReporter) WriteReports(ctx context.Context, resourceErrs r
for resource, report := range resourceErrsCopy {

// check if resource is an internal upstream. if so skip it..
if kubernetes.IsKubeUpstream(resource.GetMetadata().GetName()) {
if kubernetes.IsFakeKubeUpstream(resource.GetMetadata().GetName()) {
continue
}
// check if resource is an internal upstream. Internal upstreams have ':' in their names so
Expand Down
2 changes: 1 addition & 1 deletion projects/gloo/cli/pkg/printers/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func upstreamDetails(up *v1.Upstream, xdsDump *xdsinspection.XdsDump) []string {
fmt.Sprintf("port: %v", usType.AwsEc2.GetPort()),
)
add(getEc2TagFiltersString(usType.AwsEc2.GetFilters())...)
instances := xdsDump.GetEc2InstancesForUpstream(up.GetMetadata().Ref())
instances := xdsDump.GetEc2InstancesForUpstream(up)
add(
"EC2 Instance Ids:",
)
Expand Down
8 changes: 4 additions & 4 deletions projects/gloo/cli/pkg/xdsinspection/ec2.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package xdsinspection

import (
gloov1 "github.com/solo-io/gloo/projects/gloo/pkg/api/v1"
"github.com/solo-io/gloo/projects/gloo/pkg/plugins/aws/ec2"

"github.com/solo-io/gloo/projects/gloo/pkg/translator"
"github.com/solo-io/solo-kit/pkg/api/v1/resources/core"
"github.com/solo-io/gloo/projects/gloo/pkg/upstreams"
)

func (xd *XdsDump) GetEc2InstancesForUpstream(upstream *core.ResourceRef) []string {
func (xd *XdsDump) GetEc2InstancesForUpstream(upstream *gloov1.Upstream) []string {
var out []string
if xd == nil {
out = append(out, "use -o wide for instance details")
return out
}
clusterName := translator.UpstreamToClusterName(upstream)
clusterName := upstreams.UpstreamToClusterName(upstream)
endpointCount := 0
for _, clusterEndpoints := range xd.Endpoints {
if clusterEndpoints.GetClusterName() == clusterName {
Expand Down
22 changes: 11 additions & 11 deletions projects/gloo/pkg/plugins/als/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"github.com/solo-io/solo-kit/pkg/api/v1/resources/core"
"github.com/solo-io/solo-kit/test/matchers"

envoygrpc "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/grpc/v3"
. "github.com/solo-io/gloo/projects/gloo/pkg/plugins/als"
translatorutil "github.com/solo-io/gloo/projects/gloo/pkg/translator"

envoygrpc "github.com/envoyproxy/go-control-plane/envoy/extensions/access_loggers/grpc/v3"
"github.com/solo-io/gloo/projects/gloo/pkg/utils"
)

var _ = Describe("Plugin", func() {
Expand Down Expand Up @@ -72,7 +72,7 @@ var _ = Describe("Plugin", func() {
GrpcService: &accessLogService.GrpcService{
LogName: logName,
ServiceRef: &accessLogService.GrpcService_StaticClusterName{
StaticClusterName: translatorutil.UpstreamToClusterName(usRef),
StaticClusterName: utils.ResourceRefToKey(usRef),
},
AdditionalRequestHeadersToLog: extraHeaders,
AdditionalResponseHeadersToLog: extraHeaders,
Expand All @@ -98,7 +98,7 @@ var _ = Describe("Plugin", func() {
Expect(falCfg.CommonConfig.LogName).To(Equal(logName))
envoyGrpc := falCfg.CommonConfig.GetGrpcService().GetEnvoyGrpc()
Expect(envoyGrpc).NotTo(BeNil())
Expect(envoyGrpc.ClusterName).To(Equal(translatorutil.UpstreamToClusterName(usRef)))
Expect(envoyGrpc.ClusterName).To(Equal(utils.ResourceRefToKey(usRef)))
})

DescribeTable("Test each filter is translated properly",
Expand Down Expand Up @@ -605,7 +605,7 @@ var _ = Describe("Plugin", func() {
GrpcService: &accessLogService.GrpcService{
LogName: logName,
ServiceRef: &accessLogService.GrpcService_StaticClusterName{
StaticClusterName: translatorutil.UpstreamToClusterName(usRef),
StaticClusterName: utils.ResourceRefToKey(usRef),
},
AdditionalRequestHeadersToLog: extraHeaders,
AdditionalResponseHeadersToLog: extraHeaders,
Expand Down Expand Up @@ -634,7 +634,7 @@ var _ = Describe("Plugin", func() {
Expect(falCfg.CommonConfig.LogName).To(Equal(logName))
envoyGrpc := falCfg.CommonConfig.GetGrpcService().GetEnvoyGrpc()
Expect(envoyGrpc).NotTo(BeNil())
Expect(envoyGrpc.ClusterName).To(Equal(translatorutil.UpstreamToClusterName(usRef)))
Expect(envoyGrpc.ClusterName).To(Equal(utils.ResourceRefToKey(usRef)))
})

})
Expand Down Expand Up @@ -787,7 +787,7 @@ var _ = Describe("Plugin", func() {
GrpcService: &accessLogService.GrpcService{
LogName: logName,
ServiceRef: &accessLogService.GrpcService_StaticClusterName{
StaticClusterName: translatorutil.UpstreamToClusterName(usRef),
StaticClusterName: utils.ResourceRefToKey(usRef),
},
AdditionalRequestHeadersToLog: extraHeaders,
AdditionalResponseHeadersToLog: extraHeaders,
Expand Down Expand Up @@ -826,7 +826,7 @@ var _ = Describe("Plugin", func() {
GrpcService: &accessLogService.GrpcService{
LogName: logName,
ServiceRef: &accessLogService.GrpcService_StaticClusterName{
StaticClusterName: translatorutil.UpstreamToClusterName(usRef),
StaticClusterName: utils.ResourceRefToKey(usRef),
},
AdditionalRequestHeadersToLog: extraHeaders,
AdditionalResponseHeadersToLog: extraHeaders,
Expand Down Expand Up @@ -878,7 +878,7 @@ var _ = Describe("Plugin", func() {
GrpcService: &accessLogService.GrpcService{
LogName: logName,
ServiceRef: &accessLogService.GrpcService_StaticClusterName{
StaticClusterName: translatorutil.UpstreamToClusterName(usRef),
StaticClusterName: utils.ResourceRefToKey(usRef),
},
AdditionalRequestHeadersToLog: extraHeaders,
AdditionalResponseHeadersToLog: extraHeaders,
Expand Down Expand Up @@ -932,7 +932,7 @@ var _ = Describe("Plugin", func() {
GrpcService: &accessLogService.GrpcService{
LogName: logName,
ServiceRef: &accessLogService.GrpcService_StaticClusterName{
StaticClusterName: translatorutil.UpstreamToClusterName(usRef),
StaticClusterName: utils.ResourceRefToKey(usRef),
},
AdditionalRequestHeadersToLog: extraHeaders,
AdditionalResponseHeadersToLog: extraHeaders,
Expand Down Expand Up @@ -962,7 +962,7 @@ var _ = Describe("Plugin", func() {
GrpcService: &accessLogService.GrpcService{
LogName: logName,
ServiceRef: &accessLogService.GrpcService_StaticClusterName{
StaticClusterName: translatorutil.UpstreamToClusterName(usRef),
StaticClusterName: utils.ResourceRefToKey(usRef),
},
AdditionalRequestHeadersToLog: extraHeaders,
AdditionalResponseHeadersToLog: extraHeaders,
Expand Down
5 changes: 2 additions & 3 deletions projects/gloo/pkg/plugins/aws/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/solo-io/gloo/projects/gloo/pkg/plugins"
"github.com/solo-io/gloo/projects/gloo/pkg/plugins/pluginutils"
"github.com/solo-io/gloo/projects/gloo/pkg/plugins/transformation"
"github.com/solo-io/gloo/projects/gloo/pkg/translator"
"github.com/solo-io/gloo/projects/gloo/pkg/upstreams"
"github.com/solo-io/gloo/projects/gloo/pkg/utils"
"github.com/solo-io/go-utils/contextutils"
Expand Down Expand Up @@ -99,7 +98,7 @@ func (p *Plugin) ProcessUpstream(params plugins.Params, in *v1.Upstream, out *en
return nil
}
// even if it failed, route should still be valid
p.recordedUpstreams[translator.UpstreamToClusterName(in.GetMetadata().Ref())] = upstreamSpec.Aws
p.recordedUpstreams[in.GetMetadata().Ref().Key()] = upstreamSpec.Aws

lambdaHostname := getLambdaHostname(upstreamSpec.Aws)

Expand Down Expand Up @@ -208,7 +207,7 @@ func (p *Plugin) ProcessRoute(params plugins.RouteParams, in *v1.Route, out *env
}

// validate that the upstream is one that we have previously recorded as an aws upstream
lambdaSpec, ok := p.recordedUpstreams[translator.UpstreamToClusterName(upstreamRef)]
lambdaSpec, ok := p.recordedUpstreams[upstreamRef.Key()]
if !ok {
if tryingNonExplicitAWSDest {
// skip the lambda plugin as the route was not explicitly set to be an aws route
Expand Down
5 changes: 2 additions & 3 deletions projects/gloo/pkg/plugins/azure/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/solo-io/gloo/projects/gloo/pkg/plugins"
"github.com/solo-io/gloo/projects/gloo/pkg/plugins/pluginutils"
"github.com/solo-io/gloo/projects/gloo/pkg/plugins/transformation"
"github.com/solo-io/gloo/projects/gloo/pkg/translator"
"github.com/solo-io/gloo/projects/gloo/pkg/upstreams"
"github.com/solo-io/gloo/projects/gloo/pkg/utils"
"github.com/solo-io/go-utils/contextutils"
Expand Down Expand Up @@ -64,7 +63,7 @@ func (p *plugin) ProcessUpstream(params plugins.Params, in *v1.Upstream, out *en
return nil
}
azureUpstream := upstreamSpec.Azure
p.recordedUpstreams[translator.UpstreamToClusterName(in.GetMetadata().Ref())] = azureUpstream
p.recordedUpstreams[in.GetMetadata().Ref().Key()] = azureUpstream

// configure Envoy cluster routing info
out.ClusterDiscoveryType = &envoy_config_cluster_v3.Cluster_Type{
Expand Down Expand Up @@ -126,7 +125,7 @@ func (p *plugin) ProcessRoute(params plugins.RouteParams, in *v1.Route, out *env
contextutils.LoggerFrom(p.ctx).Error(err)
return nil, err
}
upstreamSpec, ok := p.recordedUpstreams[translator.UpstreamToClusterName(upstreamRef)]
upstreamSpec, ok := p.recordedUpstreams[upstreamRef.Key()]
if !ok {
// TODO(yuval-k): panic in debug
return nil, errors.Errorf("%v is not an Azure upstream", *upstreamRef)
Expand Down
Loading
Loading