Skip to content

Didn't find a registered implementation for name: 'envoy.filters.network.postgres_proxy' #16599

Closed

Description

@ajsalow

Description:
I'm trying to use the postgres_proxy filter in a cluster and I get the error Didn't find a registered implementation for name: 'envoy.filters.network.postgres_proxy' It is listed as a supported filter here and I tried using it in a listener in a different configuration and it worked fine there.

Config:

static_resources:
  listeners:
  - name: postgres_listener
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 10000
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          codec_type: AUTO
          http_filters:
          - name: envoy.filters.http.router
          stat_prefix: ingress_http
          route_config:
            name: test_route
            virtual_hosts:
            - domains:
              - milvus.milvus:19530
              - milvus.milvus.svc:19530
              - milvus.milvus.svc.cluster.local:19530
              name: milvus.milvus:19530
              routes:
              - match:
                  prefix: /
                route:
                  cluster: milvus.milvus:5432
            - domains:
              - postgres-postgresql.postgres:5432
              - postgres-postgresql.postgres.svc:5432
              - postgres-postgresql.postgres.svc.cluster.local:5432
              name: postgres-postgresql.postgres:5432
              routes:
              - match:
                  prefix: /
                route:
                  cluster: postgres-postgresql.postgres:5432
            - domains:
              - '*'
              name: wildcard
              routes:
              - match:
                  prefix: /milvus.milvus:19530
                route:
                  cluster: milvus.milvus:19530
                  prefix_rewrite: /
              - match:
                  prefix: /milvus.milvus.svc:19530
                route:
                  cluster: milvus.milvus:19530
                  prefix_rewrite: /
              - match:
                  prefix: /milvus.milvus.svc.cluster.local:19530
                route:
                  cluster: milvus.milvus:19530
                  prefix_rewrite: /
              - match:
                  prefix: /postgres-postgresql.postgres:5432
                route:
                  cluster: postgres-postgresql.postgres:5432
                  prefix_rewrite: /
              - match:
                  prefix: /postgres-postgresql.postgres.svc:5432
                route:
                  cluster: postgres-postgresql.postgres:5432
                  prefix_rewrite: /
              - match:
                  prefix: /postgres-postgresql.postgres.svc.cluster.local:5432
                route:
                  cluster: postgres-postgresql.postgres:5432
                  prefix_rewrite: /
              
    listener_filters:
      - name: envoy.filters.listener.original_dst
        typed_config: {}
    


  clusters:

  - name:  postgres-postgresql:5432
    connect_timeout: 10s
    type: STRICT_DNS
    lb_policy: ROUND_ROBIN
    filters:
      - name: envoy.filters.network.postgres_proxy
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.postgres_proxy.v3alpha.PostgresProxy
          stat_prefix: egress_postgres
    load_assignment:
      cluster_name:  postgres-postgresql:5432
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: postgres-postgresql
                port_value: 5432
  
  - name: milvus.milvus:19530
    connect_timeout: 10s
    type: STRICT_DNS
    lb_policy: ROUND_ROBIN
    load_assignment:
      cluster_name: milvus.milvus:19530
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: milvus.milvus
                port_value: 19530
    http2_protocol_options: {}
  

admin:
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 8001

Logs:

[2021-05-20 16:19:56.972][1][info][config] [source/server/configuration_impl.cc:94] loading 3 cluster(s)
[2021-05-20 16:19:56.973][1][critical][main] [source/server/server.cc:113] error initializing configuration '/etc/postgres-proxy.yaml': Didn't find a registered implementation for name: 'envoy.filters.network.postgres_proxy'
[2021-05-20 16:19:56.973][1][info][main] [source/server/server.cc:823] exiting

Activity

  1. added
    triage
    on May 20, 2021
  2. moderation commented on May 20, 2021

    @moderation
    Contributor

    This means that the Envoy binary you are using doesn't have the Postgres extension included / compiled. What version of Envoy are you using here? I think the Postgres filter was added in 1.15.0 - https://www.envoyproxy.io/docs/envoy/v1.18.3/version_history/v1.15.0#new-features

  3. ajsalow commented on May 20, 2021

    @ajsalow
    Author

    @moderation I'm using the latest docker dev image, envoyproxy/envoy-dev. So I would be using 1.19+. Like I said, if I use the filter in a listener, it works fine. Are you able to use it in a cluster?

  4. moderation commented on May 20, 2021

    @moderation
    Contributor

    Looking at the config a little closer I notice there isn't a clusters: stanza and you have a misspelling for your filter with fitlers so there may be additional config issues. I'm not familiar with setting filter's on the cluster. The documentation is for a listener filter - https://www.envoyproxy.io/docs/envoy/latest/configuration/listeners/network_filters/postgres_proxy_filter#config-network-filters-postgres-proxy. The Postgres sandbox and config don't set filters on the cluster for example

  5. ajsalow commented on May 21, 2021

    @ajsalow
    Author

    @moderation good catch on the misspelling. clusters: actually was in my config, it just got lost in the copy & paste somehow. I've updated my config in the original post to match my exact config I am running. I'm still getting the original error of error initializing configuration '/etc/postgres-proxy.yaml': Didn't find a registered implementation for name: 'envoy.filters.network.postgres_proxy' Can you try and reproduce? Is it true that all listener filters should also be supported by clusters? This page contains a link to supported filters but these filters under the listener section, I'm not sure if that matters.

  6. soulxu commented on May 23, 2021

    @soulxu
    Member
  7. added
    question
    and removed
    triage
    on May 24, 2021
  8. ajsalow commented on Jun 2, 2021

    @ajsalow
    Author

    @moderation @alyssawilk https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/upstream_filters explains that there are no upstream filters available out of the box. It is confusing to then list all the network filters as "supported" upstream filters here. Additionally, I think more documentation and examples of how to use upstream filters is needed.

    I'm curious how I can take send http traffic to a cluster and then give the cluster and upstream tcp filter so the upstream gets tcp bytes. I don't see how I would do this though because the tcp network filter requires exactly one cluster as an argument. Maybe I'm misunderstanding what cluster filters are meant to do though.

    Specifically in the below configuration I would like to not have to send the http traffic back to my self on port 10002 before converting it to tcp and sending it to the postgres port. I would like to have the httpconnectionmanager send it to a cluster that has a tcp cluster filter and sends it straight to postgres.

    downstream.yaml

    # This configuration takes incoming data on port 10000 and encapsulates it in a CONNECT
    # request which is sent upstream port 10001.
    # It can be used to test TCP tunneling as described in docs/root/intro/arch_overview/http/upgrades.rst
    # and running `curl --x 127.0.0.1:10000 https://www.google.com`
    
    admin:
      address:
        socket_address:
          protocol: TCP
          address: 0.0.0.0
          port_value: 9903
    static_resources:
      listeners:
      - name: listener_0
        address:
          socket_address:
            protocol: TCP
            address: 0.0.0.0
            port_value: 1999
        filter_chains:
        - filters:
          - name: tcp
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
              stat_prefix: tcp_stats
              cluster: "cluster_0"
              tunneling_config:
                hostname: host.com:443
                headers_to_add:
                - header:
                    key: target
                    value: postgres
      clusters:
        - name: cluster_0
          dns_refresh_rate: 60s
          connect_timeout: 10s
          type: strict_dns
          # This ensures HTTP/1.1 CONNECT is used for establishing the tunnel.
          typed_extension_protocol_options:
            envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
              "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
              explicit_http_config:
                # http_protocol_options: {}
                http2_protocol_options: {}
          load_assignment:
            cluster_name: cluster_0
            endpoints:
              - lb_endpoints:
                  - endpoint:
                      address:
                        socket_address:
                          address: postgres_proxy
                          port_value: 10001

    upstream.yaml

    static_resources:
      listeners:
      - name: tunnel_listener 
        address:
          socket_address:
            address: 0.0.0.0
            port_value: 10001
        listener_filters:
          - name: "envoy.listener.tls_inspector"
            typed_config: {}
        filter_chains:
        - filters:
          - name: envoy.http_connection_manager
            typed_config: 
              "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
              codec_type: auto
              stat_prefix: localgw
              common_http_protocol_options:
                max_stream_duration: 3600s
              http2_protocol_options: 
                allow_connect: true
              upgrade_configs: 
                upgrade_type: "CONNECT"
              #            connect_config: 
              route_config:
                name: local_route
                virtual_hosts:
                - name: backend2
                  domains:
                  - "*"
                  routes:
                  - match:
                      prefix: "/"
                      headers:
                      - name: target
                        exact_match: "postgres"
                    route:
                        cluster: "to_postgres"
                        upgrade_configs:
                          upgrade_type: "CONNECT"
                          connect_config:
                          enabled: true
              http_filters:
              - name: envoy.filters.http.router
                typed_config: {}
    
                
      - name: postgres_listener
        address:
          socket_address:
            address: 0.0.0.0
            port_value: 10002
        filter_chains:
        - filters:
          - name: envoy.filters.network.postgres_proxy
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.network.postgres_proxy.v3alpha.PostgresProxy
              stat_prefix: egress_postgres
          - name: envoy.filters.network.tcp_proxy
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
              stat_prefix: postgres_tcp
              cluster: postgres_cluster
        listenerFiltersTimeout: 0.100s
        continueOnListenerFiltersTimeout: true
    
      clusters:
      - name: to_postgres
        dns_refresh_rate: 60s
        connect_timeout: 10s
        type: strict_dns
        lb_policy: round_robin
        load_assignment:
          cluster_name: to_postgres
          endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: 127.0.0.1
                    port_value: 10002
                    protocol: TCP
      - name: postgres_cluster
        connect_timeout: 10s
        dns_refresh_rate: 60s
        type: STRICT_DNS
        load_assignment:
          cluster_name: postgres_cluster
          endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: postgres
                    port_value: 5432
                    protocol: TCP
    
    admin:
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 8001

    I would like my upstream to look something like this.

    static_resources:
      listeners:
      - name: tunnel_listener 
        address:
          socket_address:
            address: 0.0.0.0
            port_value: 10001
        listener_filters:
          - name: "envoy.listener.tls_inspector"
            typed_config: {}
        filter_chains:
        - filters:
          - name: envoy.http_connection_manager
            typed_config: 
              "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
              codec_type: auto
              stat_prefix: localgw
              common_http_protocol_options:
                max_stream_duration: 3600s
              http2_protocol_options: 
                allow_connect: true
              upgrade_configs: 
                upgrade_type: "CONNECT"
              #            connect_config: 
              route_config:
                name: local_route
                virtual_hosts:
                - name: backend2
                  domains:
                  - "*"
                  routes:
                  - match:
                      prefix: "/"
                      headers:
                      - name: target
                        exact_match: "postgres"
                    route:
                        cluster: "to_postgres"
                        upgrade_configs:
                          upgrade_type: "CONNECT"
                          connect_config:
                          enabled: true
              http_filters:
              - name: envoy.filters.http.router
                typed_config: {}
    
    
      - name: postgres_cluster
        connect_timeout: 10s
        dns_refresh_rate: 60s
        type: STRICT_DNS
        filters:
         - name: envoy.filters.network.postgres_proxy
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.network.postgres_proxy.v3alpha.PostgresProxy
              stat_prefix: egress_postgres
          - name: envoy.filters.network.tcp_proxy
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
              stat_prefix: postgres_tcp
        load_assignment:
          cluster_name: postgres_cluster
          endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: postgres
                    port_value: 5432
                    protocol: TCP
    
    admin:
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 8001
  9. github-actions commented on Jul 2, 2021

    @github-actions

    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.

  10. added
    stale
    on Jul 2, 2021
  11. github-actions commented on Jul 9, 2021

    @github-actions

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/configurationquestionstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions