Skip to content

Commit 1ed599a

Browse files
committed
review fixes
Signed-off-by: Guy Daich <guy.daich@sap.com>
1 parent f14a435 commit 1ed599a

16 files changed

Lines changed: 257 additions & 40 deletions

api/v1alpha1/envoyproxy_healthchecklogging_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const (
5656
)
5757

5858
// ProxyHealthCheckLogSinkType is the type of a ProxyHealthCheckLog sink.
59-
// +kubebuilder:validation:Enum=File
6059
type ProxyHealthCheckLogSinkType string
6160

6261
const (

charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyproxies.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14656,12 +14656,9 @@ spec:
1465614656
- path
1465714657
type: object
1465814658
type:
14659-
allOf:
14660-
- enum:
14661-
- File
14662-
- enum:
14663-
- File
1466414659
description: Type defines the type of sink.
14660+
enum:
14661+
- File
1466514662
type: string
1466614663
required:
1466714664
- type

charts/gateway-helm/charts/crds/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14655,12 +14655,9 @@ spec:
1465514655
- path
1465614656
type: object
1465714657
type:
14658-
allOf:
14659-
- enum:
14660-
- File
14661-
- enum:
14662-
- File
1466314658
description: Type defines the type of sink.
14659+
enum:
14660+
- File
1466414661
type: string
1466514662
required:
1466614663
- type

internal/ir/xds.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3249,6 +3249,8 @@ type ActiveHealthCheck struct {
32493249
// Overrides defines the configuration of the overriding health check settings for all endpoints
32503250
// in the backend cluster.
32513251
Overrides *HealthCheckOverrides `json:"overrides,omitempty" yaml:"overrides,omitempty"`
3252+
// EventLog configures health check event logging for this cluster.
3253+
EventLog *ProxyHealthCheckLog `json:"eventLog,omitempty" yaml:"eventLog,omitempty"`
32523254
}
32533255

32543256
// Validate the fields within the HealthCheck structure.

internal/ir/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/xds/translator/cluster.go

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,14 @@ func buildXdsCluster(args *xdsClusterArgs) (*buildClusterResult, error) {
461461
}
462462

463463
if args.healthCheck != nil && args.healthCheck.Active != nil {
464-
cluster.HealthChecks = buildXdsHealthCheck(args.healthCheck.Active, args.routeHostname, args.healthCheckLog)
464+
if args.healthCheckLog != nil && args.healthCheck.Active.EventLog == nil {
465+
args.healthCheck.Active.EventLog = args.healthCheckLog
466+
}
467+
hcs, err := buildXdsHealthCheck(args.healthCheck.Active, args.routeHostname)
468+
if err != nil {
469+
return nil, err
470+
}
471+
cluster.HealthChecks = hcs
465472
}
466473

467474
if args.healthCheck != nil && args.healthCheck.Passive != nil {
@@ -581,7 +588,7 @@ func buildZoneAwareLbConfig(preferLocal *ir.PreferLocalZone) *commonv3.LocalityL
581588
return lbConfig
582589
}
583590

584-
func buildXdsHealthCheck(healthcheck *ir.ActiveHealthCheck, routeHostname string, healthCheckLogging *ir.ProxyHealthCheckLog) []*corev3.HealthCheck {
591+
func buildXdsHealthCheck(healthcheck *ir.ActiveHealthCheck, routeHostname string) ([]*corev3.HealthCheck, error) {
585592
hc := &corev3.HealthCheck{
586593
Timeout: durationpb.New(healthcheck.Timeout.Duration),
587594
Interval: durationpb.New(healthcheck.Interval.Duration),
@@ -633,23 +640,24 @@ func buildXdsHealthCheck(healthcheck *ir.ActiveHealthCheck, routeHostname string
633640
}
634641
}
635642

636-
if healthCheckLogging != nil {
643+
if healthCheckLogging := healthcheck.EventLog; healthCheckLogging != nil {
637644
hc.AlwaysLogHealthCheckFailures = healthCheckLogging.AlwaysLogHealthCheckFailures
638645
hc.AlwaysLogHealthCheckSuccess = healthCheckLogging.AlwaysLogHealthCheckSuccess
639646
for _, fs := range healthCheckLogging.FileSinks {
640647
fileSinkAny, err := proto.ToAnyWithValidation(&hcfilev3.HealthCheckEventFileSink{
641648
EventLogPath: fs.Path,
642649
})
643-
if err == nil {
644-
hc.EventLogger = append(hc.EventLogger, &corev3.TypedExtensionConfig{
645-
Name: "envoy.health_check.event_sinks.file",
646-
TypedConfig: fileSinkAny,
647-
})
650+
if err != nil {
651+
return nil, err
648652
}
653+
hc.EventLogger = append(hc.EventLogger, &corev3.TypedExtensionConfig{
654+
Name: "envoy.health_check.event_sinks.file",
655+
TypedConfig: fileSinkAny,
656+
})
649657
}
650658
}
651659

652-
return []*corev3.HealthCheck{hc}
660+
return []*corev3.HealthCheck{hc}, nil
653661
}
654662

655663
func httpHealthCheckHost(healthcheck *ir.HTTPHealthChecker, routeHostname string) string {
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
http:
2+
- address: 0.0.0.0
3+
hostnames:
4+
- '*'
5+
name: default/gateway-1/http
6+
path:
7+
escapedSlashesAction: UnescapeAndRedirect
8+
mergeSlashes: true
9+
port: 10080
10+
routes:
11+
- destination:
12+
name: httproute/default/httproute-1/rule/0
13+
settings:
14+
- addressType: IP
15+
endpoints:
16+
- host: 7.7.7.7
17+
port: 8080
18+
protocol: HTTP
19+
weight: 1
20+
name: httproute/default/httproute-1/rule/0/backend/0
21+
envoyExtensions:
22+
extProcs:
23+
- authority: grpc-backend.default:9000
24+
destination:
25+
name: envoyextensionpolicy/default/policy-for-http-route/extproc/0
26+
settings:
27+
- addressType: IP
28+
endpoints:
29+
- host: 1.2.3.4
30+
port: 9000
31+
protocol: GRPC
32+
weight: 1
33+
name: envoyextensionpolicy/default/policy-for-http-route/extproc/0/backend/0
34+
name: envoyextensionpolicy/default/policy-for-http-route/extproc/0
35+
traffic:
36+
healthCheck:
37+
active:
38+
timeout: "500ms"
39+
interval: "5s"
40+
unhealthyThreshold: 3
41+
healthyThreshold: 1
42+
grpc:
43+
service: envoy.service.ext_proc.v3.ExternalProcessor
44+
eventLog:
45+
fileSinks:
46+
- path: "/dev/stdout"
47+
alwaysLogHealthCheckFailures: true
48+
alwaysLogHealthCheckSuccess: false
49+
hostname: '*'
50+
isHTTP2: false
51+
name: httproute/default/httproute-1/rule/0/match/0/*
52+
pathMatch:
53+
distinct: false
54+
name: ""
55+
prefix: /
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
- circuitBreakers:
2+
thresholds:
3+
- maxRetries: 1024
4+
commonLbConfig: {}
5+
connectTimeout: 10s
6+
dnsLookupFamily: V4_PREFERRED
7+
edsClusterConfig:
8+
edsConfig:
9+
ads: {}
10+
resourceApiVersion: V3
11+
serviceName: httproute/default/httproute-1/rule/0
12+
ignoreHealthOnHostRemoval: true
13+
loadBalancingPolicy:
14+
policies:
15+
- typedExtensionConfig:
16+
name: envoy.load_balancing_policies.least_request
17+
typedConfig:
18+
'@type': type.googleapis.com/envoy.extensions.load_balancing_policies.least_request.v3.LeastRequest
19+
localityLbConfig:
20+
localityWeightedLbConfig: {}
21+
name: httproute/default/httproute-1/rule/0
22+
perConnectionBufferLimitBytes: 32768
23+
type: EDS
24+
- circuitBreakers:
25+
thresholds:
26+
- maxRetries: 1024
27+
commonLbConfig: {}
28+
connectTimeout: 10s
29+
dnsLookupFamily: V4_PREFERRED
30+
edsClusterConfig:
31+
edsConfig:
32+
ads: {}
33+
resourceApiVersion: V3
34+
serviceName: envoyextensionpolicy/default/policy-for-http-route/extproc/0
35+
healthChecks:
36+
- alwaysLogHealthCheckFailures: true
37+
eventLogger:
38+
- name: envoy.health_check.event_sinks.file
39+
typedConfig:
40+
'@type': type.googleapis.com/envoy.extensions.health_check.event_sinks.file.v3.HealthCheckEventFileSink
41+
eventLogPath: /dev/stdout
42+
grpcHealthCheck:
43+
serviceName: envoy.service.ext_proc.v3.ExternalProcessor
44+
healthyThreshold: 1
45+
interval: 5s
46+
timeout: 0.500s
47+
unhealthyThreshold: 3
48+
ignoreHealthOnHostRemoval: true
49+
loadBalancingPolicy:
50+
policies:
51+
- typedExtensionConfig:
52+
name: envoy.load_balancing_policies.least_request
53+
typedConfig:
54+
'@type': type.googleapis.com/envoy.extensions.load_balancing_policies.least_request.v3.LeastRequest
55+
localityLbConfig:
56+
localityWeightedLbConfig: {}
57+
name: envoyextensionpolicy/default/policy-for-http-route/extproc/0
58+
perConnectionBufferLimitBytes: 32768
59+
type: EDS
60+
typedExtensionProtocolOptions:
61+
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
62+
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
63+
explicitHttpConfig:
64+
http2ProtocolOptions:
65+
initialConnectionWindowSize: 1048576
66+
initialStreamWindowSize: 65536
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
- clusterName: httproute/default/httproute-1/rule/0
2+
endpoints:
3+
- lbEndpoints:
4+
- endpoint:
5+
address:
6+
socketAddress:
7+
address: 7.7.7.7
8+
portValue: 8080
9+
loadBalancingWeight: 1
10+
loadBalancingWeight: 1
11+
locality:
12+
region: httproute/default/httproute-1/rule/0/backend/0
13+
- clusterName: envoyextensionpolicy/default/policy-for-http-route/extproc/0
14+
endpoints:
15+
- lbEndpoints:
16+
- endpoint:
17+
address:
18+
socketAddress:
19+
address: 1.2.3.4
20+
portValue: 9000
21+
loadBalancingWeight: 1
22+
loadBalancingWeight: 1
23+
locality:
24+
region: envoyextensionpolicy/default/policy-for-http-route/extproc/0/backend/0
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
- address:
2+
socketAddress:
3+
address: 0.0.0.0
4+
portValue: 10080
5+
defaultFilterChain:
6+
filters:
7+
- name: envoy.filters.network.http_connection_manager
8+
typedConfig:
9+
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
10+
commonHttpProtocolOptions:
11+
headersWithUnderscoresAction: REJECT_REQUEST
12+
http2ProtocolOptions:
13+
initialConnectionWindowSize: 1048576
14+
initialStreamWindowSize: 65536
15+
maxConcurrentStreams: 100
16+
httpFilters:
17+
- disabled: true
18+
name: envoy.filters.http.ext_proc/envoyextensionpolicy/default/policy-for-http-route/extproc/0
19+
typedConfig:
20+
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_proc.v3.ExternalProcessor
21+
grpcService:
22+
envoyGrpc:
23+
authority: grpc-backend.default:9000
24+
clusterName: envoyextensionpolicy/default/policy-for-http-route/extproc/0
25+
timeout: 10s
26+
processingMode:
27+
requestHeaderMode: SKIP
28+
requestTrailerMode: SKIP
29+
responseHeaderMode: SKIP
30+
responseTrailerMode: SKIP
31+
- name: envoy.filters.http.router
32+
typedConfig:
33+
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
34+
suppressEnvoyHeaders: true
35+
mergeSlashes: true
36+
normalizePath: true
37+
pathWithEscapedSlashesAction: UNESCAPE_AND_REDIRECT
38+
rds:
39+
configSource:
40+
ads: {}
41+
resourceApiVersion: V3
42+
routeConfigName: default/gateway-1/http
43+
serverHeaderTransformation: PASS_THROUGH
44+
statPrefix: http-10080
45+
useRemoteAddress: true
46+
name: default/gateway-1/http
47+
maxConnectionsToAcceptPerSocketEvent: 1
48+
name: default/gateway-1/http
49+
perConnectionBufferLimitBytes: 32768

0 commit comments

Comments
 (0)