Avoid nil panic when cluster config doesn't exist

This commit is contained in:
freddygv 2021-04-13 10:17:11 -06:00
parent 66de74767c
commit 75edc9bc7c
1 changed files with 1 additions and 0 deletions

View File

@ -59,6 +59,7 @@ func (s *Server) clustersFromSnapshotConnectProxy(cfgSnap *proxycfg.ConfigSnapsh
// In transparent proxy mode there needs to be a passthrough cluster for traffic going to destinations // In transparent proxy mode there needs to be a passthrough cluster for traffic going to destinations
// that aren't in Consul's catalog. // that aren't in Consul's catalog.
if cfgSnap.Proxy.Mode == structs.ProxyModeTransparent && if cfgSnap.Proxy.Mode == structs.ProxyModeTransparent &&
cfgSnap.ConnectProxy.ClusterConfig != nil &&
!cfgSnap.ConnectProxy.ClusterConfig.TransparentProxy.CatalogDestinationsOnly { !cfgSnap.ConnectProxy.ClusterConfig.TransparentProxy.CatalogDestinationsOnly {
clusters = append(clusters, &envoy_cluster_v3.Cluster{ clusters = append(clusters, &envoy_cluster_v3.Cluster{