Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Add Envoy support for HTTP/1.0 health-check requests #830

Merged
merged 6 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/v1beta1/kafkacluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ type EnvoyConfig struct {
// If not specified, the Envoy pods' priority is default to zero
// +optional
PriorityClassName string `json:"priorityClassName,omitempty"`
// EnableHealthCheckHttp10 is a toggle for adding HTTP1.0 support to Envoy health-check
EnableHealthCheckHttp10 bool `json:"enableHealthCheckHttp10,omitempty"`
}

// EnvoyCommandLineArgs defines envoy command line arguments
Expand Down
9 changes: 9 additions & 0 deletions charts/kafka-operator/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16549,6 +16549,10 @@ spec:
- maxUnavailable
type: string
type: object
enableHealthCheckHttp10:
description: EnableHealthCheckHttp10 is a toggle for adding HTTP1.0
support to Envoy health-check
type: boolean
envoyCommandLineArgs:
description: Envoy command line arguments
properties:
Expand Down Expand Up @@ -18555,6 +18559,11 @@ spec:
- maxUnavailable
type: string
type: object
enableHealthCheckHttp10:
description: EnableHealthCheckHttp10 is a
toggle for adding HTTP1.0 support to Envoy
health-check
type: boolean
envoyCommandLineArgs:
description: Envoy command line arguments
properties:
Expand Down
9 changes: 9 additions & 0 deletions config/base/crds/kafka.banzaicloud.io_kafkaclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16548,6 +16548,10 @@ spec:
- maxUnavailable
type: string
type: object
enableHealthCheckHttp10:
description: EnableHealthCheckHttp10 is a toggle for adding HTTP1.0
support to Envoy health-check
type: boolean
envoyCommandLineArgs:
description: Envoy command line arguments
properties:
Expand Down Expand Up @@ -18554,6 +18558,11 @@ spec:
- maxUnavailable
type: string
type: object
enableHealthCheckHttp10:
description: EnableHealthCheckHttp10 is a
toggle for adding HTTP1.0 support to Envoy
health-check
type: boolean
envoyCommandLineArgs:
description: Envoy command line arguments
properties:
Expand Down
4 changes: 4 additions & 0 deletions controllers/tests/kafkacluster_controller_envoy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ staticResources:
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
httpProtocolOptions:
acceptHttp10: true
routeConfig:
name: local
virtualHosts:
Expand Down Expand Up @@ -810,6 +812,8 @@ staticResources:
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
httpProtocolOptions:
acceptHttp10: true
routeConfig:
name: local
virtualHosts:
Expand Down
1 change: 1 addition & 0 deletions controllers/tests/kafkacluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ var _ = Describe("KafkaCluster with two config external listener", func() {

kafkaCluster = createMinimalKafkaClusterCR(fmt.Sprintf("kafkacluster-%d", count), namespace)
kafkaCluster.Spec.ListenersConfig.ExternalListeners[0].HostnameOverride = ""
kafkaCluster.Spec.EnvoyConfig.EnableHealthCheckHttp10 = true
testExternalListener := kafkaCluster.Spec.ListenersConfig.ExternalListeners[0]
testExternalListener.Config = &v1beta1.Config{
DefaultIngressConfig: "az2",
Expand Down
5 changes: 5 additions & 0 deletions pkg/resources/envoy/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ func generateEnvoyHealthCheckListener(ingressConfig v1beta1.IngressConfig, log l
},
},
}
if ingressConfig.EnvoyConfig.EnableHealthCheckHttp10 {
healthCheckFilter.HttpProtocolOptions = &envoycore.Http1ProtocolOptions{
AcceptHttp_10: true,
}
}
pbstHealthCheckFilter, err := anypb.New(healthCheckFilter)
if err != nil {
log.Error(err, "could not marshall envoy healthCheckFilter config")
Expand Down