Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Kateryna Nezdolii <kateryna.nezdolii@docker.com>
  • Loading branch information
nezdolik authored and zirain committed Feb 2, 2025
1 parent 29f9a49 commit 37a00d4
Show file tree
Hide file tree
Showing 7 changed files with 296 additions and 9 deletions.
8 changes: 0 additions & 8 deletions internal/xds/translator/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,6 @@ func buildXdsCluster(args *xdsClusterArgs) *clusterv3.Cluster {
}
}

if args.healthCheck != nil && args.healthCheck.PanicThreshold != nil {
cluster.CommonLbConfig = &clusterv3.Cluster_CommonLbConfig{
HealthyPanicThreshold: &xdstype.Percent{
Value: float64(*args.healthCheck.PanicThreshold),
},
}
}

if args.healthCheck != nil && args.healthCheck.Active != nil {
cluster.HealthChecks = buildXdsHealthCheck(args.healthCheck.Active)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/xds/translator/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestBuildXdsCluster(t *testing.T) {
tSocket: bootstrapXdsCluster.TransportSocket,
endpointType: EndpointTypeDNS,
healthCheck: &ir.HealthCheck{
PanicThreshold: ptr.To[uint32](200),
PanicThreshold: ptr.To[uint32](66),
},
}
dynamicXdsCluster := buildXdsCluster(args)
Expand Down
66 changes: 66 additions & 0 deletions internal/xds/translator/testdata/in/xds-ir/panic-threshold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
http:
- name: "first-listener"
address: "::"
path:
mergeSlashes: true
escapedSlashesAction: UnescapeAndRedirect
port: 10080
hostnames:
- "*"
routes:
- name: "first-route"
hostname: "*"
traffic:
healthCheck:
panicThreshold: 66
destination:
name: "first-route-dest"
settings:
- endpoints:
- host: "1.2.3.4"
port: 50000
- name: "second-route"
hostname: "*"
traffic:
healthCheck:
panicThreshold: 80
destination:
name: "second-route-dest"
settings:
- endpoints:
- host: "1.2.3.4"
port: 50000
- name: "third-route"
hostname: "*"
traffic:
healthCheck:
panicThreshold: 20
destination:
name: "third-route-dest"
settings:
- endpoints:
- host: "1.2.3.4"
port: 50000
- name: "fourth-route"
hostname: "*"
traffic:
healthCheck:
panicThreshold: 50
destination:
name: "fourth-route-dest"
settings:
- endpoints:
- host: "1.2.3.4"
port: 50000
- name: "fifth-route"
hostname: "*"
traffic:
healthCheck:
panicThreshold: 80
destination:
name: "fifth-route-dest"
protocol: GRPC
settings:
- endpoints:
- host: "1.2.3.4"
port: 50000
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
healthyPanicThreshold:
value: 66
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_PREFERRED
edsClusterConfig:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: first-route-dest
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: first-route-dest
perConnectionBufferLimitBytes: 32768
type: EDS
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
healthyPanicThreshold:
value: 80
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_PREFERRED
edsClusterConfig:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: second-route-dest
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: second-route-dest
perConnectionBufferLimitBytes: 32768
type: EDS
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
healthyPanicThreshold:
value: 20
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_PREFERRED
edsClusterConfig:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: third-route-dest
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: third-route-dest
perConnectionBufferLimitBytes: 32768
type: EDS
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_PREFERRED
edsClusterConfig:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: fourth-route-dest
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: fourth-route-dest
perConnectionBufferLimitBytes: 32768
type: EDS
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
healthyPanicThreshold:
value: 80
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_PREFERRED
edsClusterConfig:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: fifth-route-dest
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: fifth-route-dest
perConnectionBufferLimitBytes: 32768
type: EDS
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
- clusterName: first-route-dest
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 1.2.3.4
portValue: 50000
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: first-route-dest/backend/0
- clusterName: second-route-dest
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 1.2.3.4
portValue: 50000
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: second-route-dest/backend/0
- clusterName: third-route-dest
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 1.2.3.4
portValue: 50000
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: third-route-dest/backend/0
- clusterName: fourth-route-dest
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 1.2.3.4
portValue: 50000
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: fourth-route-dest/backend/0
- clusterName: fifth-route-dest
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 1.2.3.4
portValue: 50000
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: fifth-route-dest/backend/0
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
- address:
socketAddress:
address: '::'
portValue: 10080
defaultFilterChain:
filters:
- name: envoy.filters.network.http_connection_manager
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
commonHttpProtocolOptions:
headersWithUnderscoresAction: REJECT_REQUEST
http2ProtocolOptions:
initialConnectionWindowSize: 1048576
initialStreamWindowSize: 65536
maxConcurrentStreams: 100
httpFilters:
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
suppressEnvoyHeaders: true
mergeSlashes: true
normalizePath: true
pathWithEscapedSlashesAction: UNESCAPE_AND_REDIRECT
rds:
configSource:
ads: {}
resourceApiVersion: V3
routeConfigName: first-listener
serverHeaderTransformation: PASS_THROUGH
statPrefix: http-10080
useRemoteAddress: true
name: first-listener
name: first-listener
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
- ignorePortInHostMatching: true
name: first-listener
virtualHosts:
- domains:
- '*'
name: first-listener/*
routes:
- match:
prefix: /
name: first-route
route:
cluster: first-route-dest
upgradeConfigs:
- upgradeType: websocket
- match:
prefix: /
name: second-route
route:
cluster: second-route-dest
upgradeConfigs:
- upgradeType: websocket
- match:
prefix: /
name: third-route
route:
cluster: third-route-dest
upgradeConfigs:
- upgradeType: websocket
- match:
prefix: /
name: fourth-route
route:
cluster: fourth-route-dest
upgradeConfigs:
- upgradeType: websocket
- match:
prefix: /
name: fifth-route
route:
cluster: fifth-route-dest
upgradeConfigs:
- upgradeType: websocket

0 comments on commit 37a00d4

Please sign in to comment.