Skip to content

Commit

Permalink
Migrate to envoy API V3 in Envoy Ingress
Browse files Browse the repository at this point in the history
  • Loading branch information
amuraru committed May 26, 2021
1 parent bc3e32d commit a3b9b7d
Show file tree
Hide file tree
Showing 6 changed files with 308 additions and 224 deletions.
194 changes: 118 additions & 76 deletions controllers/tests/kafkacluster_controller_envoy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,43 +86,58 @@ func expectEnvoyConfigMap(kafkaCluster *v1beta1.KafkaCluster, eListenerTemplate
Expect(configMap.Data).To(HaveKey("envoy.yaml"))
svcTemplate := fmt.Sprintf("%s-%s.%s.svc.%s", kafkaCluster.Name, "%s", kafkaCluster.Namespace, kafkaCluster.Spec.GetKubernetesClusterDomain())
Expect(configMap.Data["envoy.yaml"]).To(Equal(fmt.Sprintf(`admin:
accessLogPath: /tmp/admin_access.log
address:
socketAddress:
address: 0.0.0.0
portValue: 9901
staticResources:
clusters:
- connectTimeout: 1s
hosts:
- socketAddress:
address: %s
portValue: 9094
http2ProtocolOptions: {}
loadAssignment:
clusterName: broker-0
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: %s
portValue: 9094
name: broker-0
type: STRICT_DNS
- connectTimeout: 1s
hosts:
- socketAddress:
address: %s
portValue: 9094
http2ProtocolOptions: {}
loadAssignment:
clusterName: broker-1
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: %s
portValue: 9094
name: broker-1
type: STRICT_DNS
- connectTimeout: 1s
hosts:
- socketAddress:
address: %s
portValue: 9094
http2ProtocolOptions: {}
loadAssignment:
clusterName: broker-2
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: %s
portValue: 9094
name: broker-2
type: STRICT_DNS
- connectTimeout: 1s
hosts:
- socketAddress:
address: %s
portValue: 9094
http2ProtocolOptions: {}
loadAssignment:
clusterName: all-brokers
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: %s
portValue: 9094
name: all-brokers
type: STRICT_DNS
listeners:
Expand All @@ -132,40 +147,44 @@ staticResources:
portValue: 19090
filterChains:
- filters:
- config:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: broker-0
stat_prefix: broker_tcp-0
name: envoy.filters.network.tcp_proxy
statPrefix: broker_tcp-0
- address:
socketAddress:
address: 0.0.0.0
portValue: 19091
filterChains:
- filters:
- config:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: broker-1
stat_prefix: broker_tcp-1
name: envoy.filters.network.tcp_proxy
statPrefix: broker_tcp-1
- address:
socketAddress:
address: 0.0.0.0
portValue: 19092
filterChains:
- filters:
- config:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: broker-2
stat_prefix: broker_tcp-2
name: envoy.filters.network.tcp_proxy
statPrefix: broker_tcp-2
- address:
socketAddress:
address: 0.0.0.0
portValue: 29092
filterChains:
- filters:
- config:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: all-brokers
stat_prefix: all-brokers
name: envoy.filters.network.tcp_proxy
statPrefix: all-brokers
`, fmt.Sprintf(svcTemplate, "0"), fmt.Sprintf(svcTemplate, "1"), fmt.Sprintf(svcTemplate, "2"), fmt.Sprintf(svcTemplate, "all-broker"))))
}

Expand All @@ -190,7 +209,7 @@ func expectEnvoyDeployment(kafkaCluster *v1beta1.KafkaCluster, eListenerTemplate
Expect(templateSpec.Containers).To(HaveLen(1))
container := templateSpec.Containers[0]
Expect(container.Name).To(Equal("envoy"))
Expect(container.Image).To(Equal("envoyproxy/envoy:v1.14.4"))
Expect(container.Image).To(Equal("envoyproxy/envoy:v1.18.3"))
Expect(container.Ports).To(ConsistOf(
corev1.ContainerPort{
Name: "broker-0",
Expand Down Expand Up @@ -303,27 +322,34 @@ func expectEnvoyWithConfigAz1(kafkaCluster *v1beta1.KafkaCluster) {
Expect(configMap.Data).To(HaveKey("envoy.yaml"))
svcTemplate := fmt.Sprintf("%s-%s.%s.svc.%s", kafkaCluster.Name, "%s", kafkaCluster.Namespace, kafkaCluster.Spec.GetKubernetesClusterDomain())
Expect(configMap.Data["envoy.yaml"]).To(Equal(fmt.Sprintf(`admin:
accessLogPath: /tmp/admin_access.log
address:
socketAddress:
address: 0.0.0.0
portValue: 9901
staticResources:
clusters:
- connectTimeout: 1s
hosts:
- socketAddress:
address: %s
portValue: 9094
http2ProtocolOptions: {}
loadAssignment:
clusterName: broker-0
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: %s
portValue: 9094
name: broker-0
type: STRICT_DNS
- connectTimeout: 1s
hosts:
- socketAddress:
address: %s
portValue: 9094
http2ProtocolOptions: {}
loadAssignment:
clusterName: all-brokers
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: %s
portValue: 9094
name: all-brokers
type: STRICT_DNS
listeners:
Expand All @@ -333,20 +359,22 @@ staticResources:
portValue: 19090
filterChains:
- filters:
- config:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: broker-0
stat_prefix: broker_tcp-0
name: envoy.filters.network.tcp_proxy
statPrefix: broker_tcp-0
- address:
socketAddress:
address: 0.0.0.0
portValue: 29092
filterChains:
- filters:
- config:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: all-brokers
stat_prefix: all-brokers
name: envoy.filters.network.tcp_proxy
statPrefix: all-brokers
`, fmt.Sprintf(svcTemplate, "0"), fmt.Sprintf(svcTemplate, "all-broker"))))
}

Expand Down Expand Up @@ -419,35 +447,46 @@ func expectEnvoyWithConfigAz2(kafkaCluster *v1beta1.KafkaCluster) {
Expect(configMap.Data).To(HaveKey("envoy.yaml"))
svcTemplate := fmt.Sprintf("%s-%s.%s.svc.%s", kafkaCluster.Name, "%s", kafkaCluster.Namespace, kafkaCluster.Spec.GetKubernetesClusterDomain())
Expect(configMap.Data["envoy.yaml"]).To(Equal(fmt.Sprintf(`admin:
accessLogPath: /tmp/admin_access.log
address:
socketAddress:
address: 0.0.0.0
portValue: 9901
staticResources:
clusters:
- connectTimeout: 1s
hosts:
- socketAddress:
address: %s
portValue: 9094
http2ProtocolOptions: {}
loadAssignment:
clusterName: broker-1
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: %s
portValue: 9094
name: broker-1
type: STRICT_DNS
- connectTimeout: 1s
hosts:
- socketAddress:
address: %s
portValue: 9094
http2ProtocolOptions: {}
loadAssignment:
clusterName: broker-2
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: %s
portValue: 9094
name: broker-2
type: STRICT_DNS
- connectTimeout: 1s
hosts:
- socketAddress:
address: %s
portValue: 9094
http2ProtocolOptions: {}
loadAssignment:
clusterName: all-brokers
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: %s
portValue: 9094
name: all-brokers
type: STRICT_DNS
listeners:
Expand All @@ -457,29 +496,32 @@ staticResources:
portValue: 19091
filterChains:
- filters:
- config:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: broker-1
stat_prefix: broker_tcp-1
name: envoy.filters.network.tcp_proxy
statPrefix: broker_tcp-1
- address:
socketAddress:
address: 0.0.0.0
portValue: 19092
filterChains:
- filters:
- config:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: broker-2
stat_prefix: broker_tcp-2
name: envoy.filters.network.tcp_proxy
statPrefix: broker_tcp-2
- address:
socketAddress:
address: 0.0.0.0
portValue: 29092
filterChains:
- filters:
- config:
- name: envoy.filters.network.tcp_proxy
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
cluster: all-brokers
stat_prefix: all-brokers
name: envoy.filters.network.tcp_proxy
statPrefix: all-brokers
`, fmt.Sprintf(svcTemplate, "1"), fmt.Sprintf(svcTemplate, "2"), fmt.Sprintf(svcTemplate, "all-broker"))))
}
33 changes: 19 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,49 @@ require (
github.com/banzaicloud/k8s-objectmatcher v1.4.1
github.com/banzaicloud/kafka-operator/api v0.0.0
github.com/banzaicloud/kafka-operator/properties v0.0.0
github.com/envoyproxy/go-control-plane v0.9.7
github.com/envoyproxy/go-control-plane v0.9.9
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/go-logr/logr v0.1.0
github.com/golang/protobuf v1.4.2
github.com/google/uuid v1.1.2 // indirect
github.com/golang/protobuf v1.4.3
github.com/golang/snappy v0.0.3 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/uuid v1.1.5 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v0.12.2 // indirect
github.com/hashicorp/go-retryablehttp v0.6.7 // indirect
github.com/hashicorp/memberlist v0.2.0 // indirect
github.com/hashicorp/go-retryablehttp v0.6.8 // indirect
github.com/hashicorp/vault v1.4.0
github.com/hashicorp/vault/api v1.0.5-0.20200317185738-82f498082f02
github.com/hashicorp/vault/sdk v0.1.14-0.20200406173424-43a93d4a43b1
github.com/imdario/mergo v0.3.11
github.com/imdario/mergo v0.3.12
github.com/influxdata/influxdb v1.7.6 // indirect
github.com/jetstack/cert-manager v0.15.2
github.com/json-iterator/go v1.1.11 // indirect
github.com/klauspost/compress v1.11.13 // indirect
github.com/lestrrat-go/backoff v1.0.0
github.com/magiconair/properties v1.8.4 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/onsi/ginkgo v1.12.1
github.com/onsi/gomega v1.10.5
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/pavel-v-chernykh/keystore-go v2.1.0+incompatible
github.com/prometheus/client_golang v1.4.1 // indirect
github.com/prometheus/common v0.9.1
github.com/shirou/gopsutil v3.20.12+incompatible // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/viper v1.7.1 // indirect
go.uber.org/zap v1.10.0
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/grpc v1.27.1 // indirect
golang.org/x/text v0.3.6 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.25.0
gotest.tools v2.2.0+incompatible
k8s.io/api v0.18.9
k8s.io/apiextensions-apiserver v0.18.9
k8s.io/apimachinery v0.18.9
k8s.io/client-go v0.18.9
k8s.io/api v0.18.19
k8s.io/apiextensions-apiserver v0.18.19
k8s.io/apimachinery v0.18.19
k8s.io/client-go v0.18.19
sigs.k8s.io/controller-runtime v0.6.5
)

replace (
github.com/banzaicloud/kafka-operator/api => ./pkg/sdk
github.com/banzaicloud/kafka-operator/properties => ./properties
google.golang.org/grpc => google.golang.org/grpc v1.29.1
)
Loading

0 comments on commit a3b9b7d

Please sign in to comment.