envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
24.85k stars 4.78k forks source link

PostgresProxy: unknown type: envoy.extensions.filters.network.postgres_proxy.v3.PostgresProxy #21193

Closed zd9KgA closed 2 years ago

zd9KgA commented 2 years ago

Title: PostgresProxy filter cannot be configured

Description: Envoy refuses configuration using envoy.yaml from https://www.envoyproxy.io/docs/envoy/latest/start/sandboxes/postgres.html. The expected behavior is that the example works as described in the documentation.

Repro steps: Follow steps as described in https://www.envoyproxy.io/docs/envoy/latest/start/sandboxes/postgres.html. Step 1 will fail. Check cause using func-e run -c envoy.yaml.

Admin and Stats Output: None available as Envoy refuses to start.

Config: https://github.com/envoyproxy/envoy/blob/release/v1.21/examples/postgres/envoy.yaml

Logs:

[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:381] initializing epoch 0 (base id=0, hot restart version=11.104)
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:383] statically linked extensions:
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.thrift_proxy.filters: envoy.filters.thrift.header_to_metadata, envoy.filters.thrift.rate_limit, envoy.filters.thrift.router
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.thrift_proxy.transports: auto, framed, header, unframed
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.grpc_credentials: envoy.grpc_credentials.aws_iam, envoy.grpc_credentials.default, envoy.grpc_credentials.file_based_metadata
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.filters.http: envoy.bandwidth_limit, envoy.buffer, envoy.cors, envoy.csrf, envoy.ext_authz, envoy.ext_proc, envoy.fault, envoy.filters.http.adaptive_concurrency, envoy.filters.http.admission_control, envoy.filters.http.alternate_protocols_cache, envoy.filters.http.aws_lambda, envoy.filters.http.aws_request_signing, envoy.filters.http.bandwidth_limit, envoy.filters.http.buffer, envoy.filters.http.cache, envoy.filters.http.cdn_loop, envoy.filters.http.composite, envoy.filters.http.compressor, envoy.filters.http.cors, envoy.filters.http.csrf, envoy.filters.http.decompressor, envoy.filters.http.dynamic_forward_proxy, envoy.filters.http.dynamo, envoy.filters.http.ext_authz, envoy.filters.http.ext_proc, envoy.filters.http.fault, envoy.filters.http.grpc_http1_bridge, envoy.filters.http.grpc_http1_reverse_bridge, envoy.filters.http.grpc_json_transcoder, envoy.filters.http.grpc_stats, envoy.filters.http.grpc_web, envoy.filters.http.header_to_metadata, envoy.filters.http.health_check, envoy.filters.http.ip_tagging, envoy.filters.http.jwt_authn, envoy.filters.http.local_ratelimit, envoy.filters.http.lua, envoy.filters.http.oauth2, envoy.filters.http.on_demand, envoy.filters.http.original_src, envoy.filters.http.ratelimit, envoy.filters.http.rbac, envoy.filters.http.router, envoy.filters.http.set_metadata, envoy.filters.http.stateful_session, envoy.filters.http.tap, envoy.filters.http.wasm, envoy.grpc_http1_bridge, envoy.grpc_json_transcoder, envoy.grpc_web, envoy.health_check, envoy.http_dynamo_filter, envoy.ip_tagging, envoy.local_rate_limit, envoy.lua, envoy.rate_limit, envoy.router, match-wrapper
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.retry_host_predicates: envoy.retry_host_predicates.omit_canary_hosts, envoy.retry_host_predicates.omit_host_metadata, envoy.retry_host_predicates.previous_hosts
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.formatter: envoy.formatter.metadata, envoy.formatter.req_without_query
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.bootstrap: envoy.bootstrap.wasm, envoy.extensions.network.socket_interface.default_socket_interface
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.dubbo_proxy.serializers: dubbo.hessian2
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.resource_monitors: envoy.resource_monitors.fixed_heap, envoy.resource_monitors.injected_resource
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.filters.udp_listener: envoy.filters.udp.dns_filter, envoy.filters.udp_listener.udp_proxy
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.quic.proof_source: envoy.quic.proof_source.filter_chain
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.guarddog_actions: envoy.watchdog.abort_action, envoy.watchdog.profile_action
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.dubbo_proxy.filters: envoy.filters.dubbo.router
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.retry_priorities: envoy.retry_priorities.previous_priorities
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.compression.decompressor: envoy.compression.brotli.decompressor, envoy.compression.gzip.decompressor
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.matching.action: composite-action, skip
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.tracers: envoy.dynamic.ot, envoy.lightstep, envoy.tracers.datadog, envoy.tracers.dynamic_ot, envoy.tracers.lightstep, envoy.tracers.opencensus, envoy.tracers.skywalking, envoy.tracers.xray, envoy.tracers.zipkin, envoy.zipkin
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.filters.network: envoy.client_ssl_auth, envoy.echo, envoy.ext_authz, envoy.filters.network.client_ssl_auth, envoy.filters.network.connection_limit, envoy.filters.network.direct_response, envoy.filters.network.dubbo_proxy, envoy.filters.network.echo, envoy.filters.network.ext_authz, envoy.filters.network.http_connection_manager, envoy.filters.network.local_ratelimit, envoy.filters.network.mongo_proxy, envoy.filters.network.ratelimit, envoy.filters.network.rbac, envoy.filters.network.redis_proxy, envoy.filters.network.sni_cluster, envoy.filters.network.sni_dynamic_forward_proxy, envoy.filters.network.tcp_proxy, envoy.filters.network.thrift_proxy, envoy.filters.network.wasm, envoy.filters.network.zookeeper_proxy, envoy.http_connection_manager, envoy.mongo_proxy, envoy.ratelimit, envoy.redis_proxy, envoy.tcp_proxy
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.clusters: envoy.cluster.eds, envoy.cluster.logical_dns, envoy.cluster.original_dst, envoy.cluster.static, envoy.cluster.strict_dns, envoy.clusters.aggregate, envoy.clusters.dynamic_forward_proxy, envoy.clusters.redis
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.access_loggers: envoy.access_loggers.file, envoy.access_loggers.http_grpc, envoy.access_loggers.open_telemetry, envoy.access_loggers.stderr, envoy.access_loggers.stdout, envoy.access_loggers.tcp_grpc, envoy.access_loggers.wasm, envoy.file_access_log, envoy.http_grpc_access_log, envoy.open_telemetry_access_log, envoy.stderr_access_log, envoy.stdout_access_log, envoy.tcp_grpc_access_log, envoy.wasm_access_log
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.common.key_value: envoy.key_value.file_based
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.http.stateful_header_formatters: preserve_case
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.wasm.runtime: envoy.wasm.runtime.null, envoy.wasm.runtime.v8
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.http.original_ip_detection: envoy.http.original_ip_detection.custom_header, envoy.http.original_ip_detection.xff
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.transport_sockets.upstream: envoy.transport_sockets.alts, envoy.transport_sockets.quic, envoy.transport_sockets.raw_buffer, envoy.transport_sockets.starttls, envoy.transport_sockets.tap, envoy.transport_sockets.tcp_stats, envoy.transport_sockets.tls, envoy.transport_sockets.upstream_proxy_protocol, raw_buffer, starttls, tls
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.compression.compressor: envoy.compression.brotli.compressor, envoy.compression.gzip.compressor
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.transport_sockets.downstream: envoy.transport_sockets.alts, envoy.transport_sockets.quic, envoy.transport_sockets.raw_buffer, envoy.transport_sockets.starttls, envoy.transport_sockets.tap, envoy.transport_sockets.tcp_stats, envoy.transport_sockets.tls, raw_buffer, starttls, tls
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.network.dns_resolver: envoy.network.dns_resolver.cares
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.health_checkers: envoy.health_checkers.redis
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.rbac.matchers: envoy.rbac.matchers.upstream_ip_port
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.upstreams: envoy.filters.connection_pools.tcp.generic
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.matching.input_matchers: envoy.matching.matchers.consistent_hashing, envoy.matching.matchers.ip
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.dubbo_proxy.protocols: dubbo
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.upstream_options: envoy.extensions.upstreams.http.v3.HttpProtocolOptions, envoy.upstreams.http.http_protocol_options
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.http.cache: envoy.extensions.http.cache.simple
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.resolvers: envoy.ip
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.internal_redirect_predicates: envoy.internal_redirect_predicates.allow_listed_routes, envoy.internal_redirect_predicates.previous_routes, envoy.internal_redirect_predicates.safe_cross_scheme
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.matching.common_inputs: envoy.matching.common_inputs.environment_variable
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.access_logger.extension_filters: envoy.access_loggers.extension_filters.cel
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.tls.cert_validator: envoy.tls.cert_validator.default, envoy.tls.cert_validator.spiffe
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.matching.http.input: request-headers, request-trailers, response-headers, response-trailers
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.request_id: envoy.request_id.uuid
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.quic.server.crypto_stream: envoy.quic.crypto_stream.server.quiche
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.thrift_proxy.protocols: auto, binary, binary/non-strict, compact, twitter
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.rate_limit_descriptors: envoy.rate_limit_descriptors.expr
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.http.stateful_session: envoy.http.stateful_session.cookie
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.stats_sinks: envoy.dog_statsd, envoy.graphite_statsd, envoy.metrics_service, envoy.stat_sinks.dog_statsd, envoy.stat_sinks.graphite_statsd, envoy.stat_sinks.hystrix, envoy.stat_sinks.metrics_service, envoy.stat_sinks.statsd, envoy.stat_sinks.wasm, envoy.statsd
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.dubbo_proxy.route_matchers: default
[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:385]   envoy.filters.listener: envoy.filters.listener.http_inspector, envoy.filters.listener.original_dst, envoy.filters.listener.original_src, envoy.filters.listener.proxy_protocol, envoy.filters.listener.tls_inspector, envoy.listener.http_inspector, envoy.listener.original_dst, envoy.listener.original_src, envoy.listener.proxy_protocol, envoy.listener.tls_inspector
[2022-05-07 21:16:23.930][2470383][critical][main] [source/server/server.cc:117] error initializing configuration 'envoy.yaml': Unable to parse JSON as proto (INVALID_ARGUMENT:(static_resources.listeners[0].filter_chains[0].filters[0].typed_config): invalid value Invalid type URL, unknown type: envoy.extensions.filters.network.postgres_proxy.v3alpha.PostgresProxy for type Any): {"admin":{"address":{"socket_address":{"address":"0.0.0.0","port_value":8001}}},"static_resources":{"clusters":[{"load_assignment":{"cluster_name":"postgres_cluster","endpoints":[{"lb_endpoints":[{"endpoint":{"address":{"socket_address":{"port_value":5432,"address":"postgres"}}}}]}]},"type":"STRICT_DNS","name":"postgres_cluster"}],"listeners":[{"name":"postgres_listener","filter_chains":[{"filters":[{"name":"envoy.filters.network.postgres_proxy","typed_config":{"stat_prefix":"egress_postgres","@type":"type.googleapis.com/envoy.extensions.filters.network.postgres_proxy.v3alpha.PostgresProxy"}},{"name":"envoy.filters.network.tcp_proxy","typed_config":{"cluster":"postgres_cluster","@type":"type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy","stat_prefix":"postgres_tcp"}}]}],"address":{"socket_address":{"address":"0.0.0.0","port_value":1999}}}]}}
[2022-05-07 21:16:23.930][2470383][info][main] [source/server/server.cc:925] exiting
Unable to parse JSON as proto (INVALID_ARGUMENT:(static_resources.listeners[0].filter_chains[0].filters[0].typed_config): invalid value Invalid type URL, unknown type: envoy.extensions.filters.network.postgres_proxy.v3alpha.PostgresProxy for type Any): {"admin":{"address":{"socket_address":{"address":"0.0.0.0","port_value":8001}}},"static_resources":{"clusters":[{"load_assignment":{"cluster_name":"postgres_cluster","endpoints":[{"lb_endpoints":[{"endpoint":{"address":{"socket_address":{"port_value":5432,"address":"postgres"}}}}]}]},"type":"STRICT_DNS","name":"postgres_cluster"}],"listeners":[{"name":"postgres_listener","filter_chains":[{"filters":[{"name":"envoy.filters.network.postgres_proxy","typed_config":{"stat_prefix":"egress_postgres","@type":"type.googleapis.com/envoy.extensions.filters.network.postgres_proxy.v3alpha.PostgresProxy"}},{"name":"envoy.filters.network.tcp_proxy","typed_config":{"cluster":"postgres_cluster","@type":"type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy","stat_prefix":"postgres_tcp"}}]}],"address":{"socket_address":{"address":"0.0.0.0","port_value":1999}}}]}}
dio commented 2 years ago

@zd9KgA with the latest version, I'm not sure the envoy binary installed by func-e has the postgres extension, since the postgres extension is only available in "contrib" images: https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/filters/network/postgres_proxy/v3alpha/postgres_proxy.proto.

As you can see from the log above:

[2022-05-07 21:16:23.925][2470383][info][main] [source/server/server.cc:383] statically linked extensions:
...

There are no postgres there.

I suggest opening a feature request to func-e, to distribute the contrib binary as well.

zd9KgA commented 2 years ago

@dio Thanks for pointing that out to me. My understanding of the Envoy ecosystem is just gradually developing.

When I start the example as described, the proxy container terminates with exit code 132, and I tried to fathom the reason using func-e. Apparently not the best choice. I don't get logs from the container either.

Any suggestion on how I might unravel this?

zd9KgA commented 2 years ago

I tried to trace the problem within the container (docker-compose run proxy) with the following outcome:

envoy@cfc327c492a8:/$ /usr/local/bin/envoy -c /etc/envoy.yaml
Illegal instruction (core dumped)
github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

github-actions[bot] commented 2 years ago

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

liangsqrt commented 2 years ago

i also meet the same problem in docker, the docker image is envoyproxy/envoy-alpine:v1.21-latest

Rahul-1300 commented 4 months ago

Unable to parse JSON as proto (INVALID_ARGUMENT: could not find @type 'type.googleapis.com/envoy.extensions.filters.network.postgres_proxy.v3alpha.PostgresProxy'

this issue with me Please help me to resolve this i tried lots but not able to resolve