Skip to content

Commit

Permalink
net-5689 fix disabling panic threshold logic (#18958)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndhanushkodi authored Sep 21, 2023
1 parent 5d0edec commit 0a11499
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
3 changes: 2 additions & 1 deletion agent/xds/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ package xds

import (
"bytes"
"github.com/hashicorp/consul/types"
"path/filepath"
"sort"
"testing"
"text/template"
"time"

"github.com/hashicorp/consul/types"

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_tls_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
Expand Down
14 changes: 8 additions & 6 deletions agent/xds/proxystateconverter/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ package proxystateconverter
import (
"errors"
"fmt"
"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-uuid"
"strings"
"time"

"github.com/hashicorp/go-hclog"
"github.com/hashicorp/go-uuid"

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/wrapperspb"
Expand Down Expand Up @@ -312,7 +313,8 @@ func (s *Converter) makePassthroughClusters(cfgSnap *proxycfg.ConfigSnapshot) (m
ConnectTimeout: durationpb.New(5 * time.Second),
// Endpoints are managed separately by EDS
// Having an empty config enables outlier detection with default config.
OutlierDetection: &pbproxystate.OutlierDetection{},
OutlierDetection: &pbproxystate.OutlierDetection{},
DisablePanicThreshold: true,
},
},
},
Expand Down Expand Up @@ -653,8 +655,7 @@ func (s *Converter) makeUpstreamClusterForPreparedQuery(upstream structs.Upstrea
ConnectTimeout: durationpb.New(time.Duration(cfg.ConnectTimeoutMs) * time.Millisecond),
// Endpoints are managed separately by EDS
// Having an empty config enables outlier detection with default config.
OutlierDetection: makeOutlierDetection(cfg.PassiveHealthCheck, nil, true),
DisablePanicThreshold: true,
OutlierDetection: makeOutlierDetection(cfg.PassiveHealthCheck, nil, true),
CircuitBreakers: &pbproxystate.CircuitBreakers{
UpstreamLimits: makeUpstreamLimitsIfNeeded(cfg.Limits),
},
Expand Down Expand Up @@ -880,7 +881,8 @@ func (s *Converter) makeUpstreamClustersForDiscoveryChain(
CircuitBreakers: &pbproxystate.CircuitBreakers{
UpstreamLimits: makeUpstreamLimitsIfNeeded(upstreamConfig.Limits),
},
OutlierDetection: makeOutlierDetection(upstreamConfig.PassiveHealthCheck, nil, true),
DisablePanicThreshold: true,
OutlierDetection: makeOutlierDetection(upstreamConfig.PassiveHealthCheck, nil, true),
},
}
ti := groupedTarget.Targets[0]
Expand Down
2 changes: 1 addition & 1 deletion agent/xdsv2/cluster_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (pr *ProxyResources) makeEnvoyDynamicCluster(name string, protocol string,
cluster.AltStatName = name
}
cluster.ConnectTimeout = dynamic.Config.ConnectTimeout
if !dynamic.Config.DisablePanicThreshold {
if dynamic.Config.DisablePanicThreshold {
cluster.CommonLbConfig = &envoy_cluster_v3.Cluster_CommonLbConfig{
HealthyPanicThreshold: &envoy_type_v3.Percent{
Value: 0, // disable panic threshold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"resourceApiVersion": "V3"
}
},
"commonLbConfig": {
"healthyPanicThreshold": {}
},
"name": "tcp.api-1.default.dc1.internal.foo.consul",
"transportSocket": {
"name": "tls",
Expand Down

0 comments on commit 0a11499

Please sign in to comment.