From 62264e40430b166a86097e18bc5513511b16e79a Mon Sep 17 00:00:00 2001 From: jm96441n Date: Wed, 14 Aug 2024 14:39:13 -0400 Subject: [PATCH] Fix cluster generation for jwt clusters for external jwt providers --- agent/xds/clusters.go | 6 +++--- agent/xds/jwt_authn_ce.go | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/agent/xds/clusters.go b/agent/xds/clusters.go index f8abdc0e91..f6a3532447 100644 --- a/agent/xds/clusters.go +++ b/agent/xds/clusters.go @@ -148,7 +148,7 @@ func (s *ResourceGenerator) clustersFromSnapshotConnectProxy(cfgSnap *proxycfg.C // add clusters for jwt-providers for _, prov := range cfgSnap.JWTProviders { - //skip cluster creation for local providers + // skip cluster creation for local providers if prov.JSONWebKeySet == nil || prov.JSONWebKeySet.Remote == nil { continue } @@ -923,7 +923,6 @@ func (s *ResourceGenerator) injectGatewayDestinationAddons(cfgSnap *proxycfg.Con } c.TransportSocket = transportSocket } - } return nil } @@ -1004,6 +1003,8 @@ func (s *ResourceGenerator) clustersFromSnapshotAPIGateway(cfgSnap *proxycfg.Con createdClusters[uid] = true } + + clusters = append(clusters, makeAPIGatewayJWKClusters(s.Logger, cfgSnap)...) } return clusters, nil } @@ -1145,7 +1146,6 @@ func (s *ResourceGenerator) makeUpstreamClusterForPeerService( } upstreamsSnapshot, err := cfgSnap.ToConfigSnapshotUpstreams() - if err != nil { return c, err } diff --git a/agent/xds/jwt_authn_ce.go b/agent/xds/jwt_authn_ce.go index f8cf52957d..5b08de5e5e 100644 --- a/agent/xds/jwt_authn_ce.go +++ b/agent/xds/jwt_authn_ce.go @@ -8,8 +8,11 @@ package xds import ( envoy_http_jwt_authn_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/jwt_authn/v3" envoy_http_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3" + "google.golang.org/protobuf/proto" + "github.com/hashicorp/consul/agent/proxycfg" "github.com/hashicorp/consul/agent/structs" + "github.com/hashicorp/go-hclog" ) type GatewayAuthFilterBuilder struct { @@ -22,3 +25,7 @@ type GatewayAuthFilterBuilder struct { func (g *GatewayAuthFilterBuilder) makeGatewayAuthFilters() ([]*envoy_http_v3.HttpFilter, error) { return nil, nil } + +func makeAPIGatewayJWKClusters(_ hclog.Logger, _ *proxycfg.ConfigSnapshot) []proto.Message { + return nil +}