net-5689 fix disabling panic threshold logic (#18958)

This commit is contained in:
Nitya Dhanushkodi 2023-09-21 15:52:30 -07:00 committed by GitHub
parent 5d0edec01f
commit 0a11499588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 8 deletions

View File

@ -5,13 +5,14 @@ package xds
import ( import (
"bytes" "bytes"
"github.com/hashicorp/consul/types"
"path/filepath" "path/filepath"
"sort" "sort"
"testing" "testing"
"text/template" "text/template"
"time" "time"
"github.com/hashicorp/consul/types"
envoy_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" envoy_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
envoy_tls_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" envoy_tls_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"

View File

@ -6,11 +6,12 @@ package proxystateconverter
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-uuid"
"strings" "strings"
"time" "time"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-uuid"
envoy_endpoint_v3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3" envoy_endpoint_v3 "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
"google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/wrapperspb" "google.golang.org/protobuf/types/known/wrapperspb"
@ -313,6 +314,7 @@ func (s *Converter) makePassthroughClusters(cfgSnap *proxycfg.ConfigSnapshot) (m
// Endpoints are managed separately by EDS // Endpoints are managed separately by EDS
// Having an empty config enables outlier detection with default config. // Having an empty config enables outlier detection with default config.
OutlierDetection: &pbproxystate.OutlierDetection{}, OutlierDetection: &pbproxystate.OutlierDetection{},
DisablePanicThreshold: true,
}, },
}, },
}, },
@ -654,7 +656,6 @@ func (s *Converter) makeUpstreamClusterForPreparedQuery(upstream structs.Upstrea
// Endpoints are managed separately by EDS // Endpoints are managed separately by EDS
// Having an empty config enables outlier detection with default config. // Having an empty config enables outlier detection with default config.
OutlierDetection: makeOutlierDetection(cfg.PassiveHealthCheck, nil, true), OutlierDetection: makeOutlierDetection(cfg.PassiveHealthCheck, nil, true),
DisablePanicThreshold: true,
CircuitBreakers: &pbproxystate.CircuitBreakers{ CircuitBreakers: &pbproxystate.CircuitBreakers{
UpstreamLimits: makeUpstreamLimitsIfNeeded(cfg.Limits), UpstreamLimits: makeUpstreamLimitsIfNeeded(cfg.Limits),
}, },
@ -880,6 +881,7 @@ func (s *Converter) makeUpstreamClustersForDiscoveryChain(
CircuitBreakers: &pbproxystate.CircuitBreakers{ CircuitBreakers: &pbproxystate.CircuitBreakers{
UpstreamLimits: makeUpstreamLimitsIfNeeded(upstreamConfig.Limits), UpstreamLimits: makeUpstreamLimitsIfNeeded(upstreamConfig.Limits),
}, },
DisablePanicThreshold: true,
OutlierDetection: makeOutlierDetection(upstreamConfig.PassiveHealthCheck, nil, true), OutlierDetection: makeOutlierDetection(upstreamConfig.PassiveHealthCheck, nil, true),
}, },
} }

View File

@ -125,7 +125,7 @@ func (pr *ProxyResources) makeEnvoyDynamicCluster(name string, protocol string,
cluster.AltStatName = name cluster.AltStatName = name
} }
cluster.ConnectTimeout = dynamic.Config.ConnectTimeout cluster.ConnectTimeout = dynamic.Config.ConnectTimeout
if !dynamic.Config.DisablePanicThreshold { if dynamic.Config.DisablePanicThreshold {
cluster.CommonLbConfig = &envoy_cluster_v3.Cluster_CommonLbConfig{ cluster.CommonLbConfig = &envoy_cluster_v3.Cluster_CommonLbConfig{
HealthyPanicThreshold: &envoy_type_v3.Percent{ HealthyPanicThreshold: &envoy_type_v3.Percent{
Value: 0, // disable panic threshold Value: 0, // disable panic threshold

View File

@ -11,6 +11,9 @@
"resourceApiVersion": "V3" "resourceApiVersion": "V3"
} }
}, },
"commonLbConfig": {
"healthyPanicThreshold": {}
},
"name": "tcp.api-1.default.dc1.internal.foo.consul", "name": "tcp.api-1.default.dc1.internal.foo.consul",
"transportSocket": { "transportSocket": {
"name": "tls", "name": "tls",