-
Notifications
You must be signed in to change notification settings - Fork 633
dynamic forward proxy #11197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dynamic forward proxy #11197
Changes from all commits
44a047e
272761e
b9c1bfa
9a33930
15efb50
0732709
c50b07e
59f6bec
7551b5c
3ccf1fc
8767d49
4b70c0f
d319ec1
d32c9e0
79b975b
25a1896
7090a5f
7591f70
b587308
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| package backend | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3" | ||
| envoy_config_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" | ||
| envoy_dfp_cluster "github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/dynamic_forward_proxy/v3" | ||
| envoydfp "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/dynamic_forward_proxy/v3" | ||
| "github.com/envoyproxy/go-control-plane/pkg/wellknown" | ||
|
|
||
| eiutils "github.com/kgateway-dev/kgateway/v2/internal/envoyinit/pkg/utils" | ||
|
|
||
| envoy_tls_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3" | ||
|
|
||
| "github.com/kgateway-dev/kgateway/v2/api/v1alpha1" | ||
| "github.com/kgateway-dev/kgateway/v2/internal/kgateway/utils" | ||
| ) | ||
|
|
||
| var ( | ||
| dfpFilterConfig = &envoydfp.FilterConfig{ | ||
| ImplementationSpecifier: &envoydfp.FilterConfig_SubClusterConfig{ | ||
| SubClusterConfig: &envoydfp.SubClusterConfig{}, | ||
| }, | ||
| } | ||
| ) | ||
|
|
||
| func processDynamicForwardProxy(ctx context.Context, in *v1alpha1.DynamicForwardProxyBackend, out *envoy_config_cluster_v3.Cluster) error { | ||
| out.LbPolicy = envoy_config_cluster_v3.Cluster_CLUSTER_PROVIDED | ||
| c := &envoy_dfp_cluster.ClusterConfig{ | ||
| ClusterImplementationSpecifier: &envoy_dfp_cluster.ClusterConfig_SubClustersConfig{ | ||
| SubClustersConfig: &envoy_dfp_cluster.SubClustersConfig{ | ||
| LbPolicy: envoy_config_cluster_v3.Cluster_LEAST_REQUEST, | ||
| }, | ||
| }, | ||
| } | ||
| anyCluster, err := utils.MessageToAny(c) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| out.ClusterDiscoveryType = &envoy_config_cluster_v3.Cluster_ClusterType{ | ||
| ClusterType: &envoy_config_cluster_v3.Cluster_CustomClusterType{ | ||
| Name: "envoy.clusters.dynamic_forward_proxy", | ||
| TypedConfig: anyCluster, | ||
| }, | ||
| } | ||
|
|
||
| if in.EnableTls { | ||
| validationContext := &envoy_tls_v3.CertificateValidationContext{} | ||
| sdsValidationCtx := &envoy_tls_v3.SdsSecretConfig{ | ||
| Name: eiutils.SystemCaSecretName, | ||
| } | ||
|
|
||
| tlsContextDefault := &envoy_tls_v3.UpstreamTlsContext{ | ||
| CommonTlsContext: &envoy_tls_v3.CommonTlsContext{ | ||
| ValidationContextType: &envoy_tls_v3.CommonTlsContext_CombinedValidationContext{ | ||
| CombinedValidationContext: &envoy_tls_v3.CommonTlsContext_CombinedCertificateValidationContext{ | ||
| DefaultValidationContext: validationContext, | ||
| ValidationContextSdsSecretConfig: sdsValidationCtx, | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| typedConfig, _ := utils.MessageToAny(tlsContextDefault) | ||
| out.TransportSocket = &envoy_config_core_v3.TransportSocket{ | ||
| Name: wellknown.TransportSocketTls, | ||
| ConfigType: &envoy_config_core_v3.TransportSocket_TypedConfig{ | ||
| TypedConfig: typedConfig, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| return nil | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.