envoyproxy / envoy

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

Envoy validate mode not working with internal listener #28413

Closed dceravigupta closed 8 months ago

dceravigupta commented 1 year ago

Title: Envoy validate mode not working with internal listener

Description: If I define an internal listener in Envoy config and then tries to validate it using --mode validate, it throws an error saying error initializing configuration 'envoy-test.yaml': error adding listener 'envoy://singleton_internal_encap': internal listener registry is not initialized.

I tried even with the sample config given on the Envoy wiki: https://www.envoyproxy.io/docs/envoy/v1.23.9/configuration/other_features/internal_listener#config-internal-listener

I can see the same issue in 1.26.2 version as well where a config is working fine but when I tries to validate it throws the same error.

Repro steps:

Config: Sample config mentioned at https://www.envoyproxy.io/docs/envoy/v1.23.9/configuration/other_features/internal_listener#config-internal-listener wiki or see the following attached file: envoy-congif.txt

Logs: $ ./envoy_1.23.9 --mode validate -c envoy-test.yaml [2023-07-14 12:06:14.066][700145][info][main] [source/server/server.cc:801] runtime: layers: - name: enable_internal_address static_layer: envoy.reloadable_features.internal_address: true [2023-07-14 12:06:14.066][700145][info][dns] [source/extensions/network/dns_resolver/cares/dns_impl.cc:531] c-ares library initialized. [2023-07-14 12:06:14.067][700145][info][config] [source/server/configuration_impl.cc:131] loading tracing configuration [2023-07-14 12:06:14.067][700145][info][config] [source/server/configuration_impl.cc:91] loading 0 static secret(s) [2023-07-14 12:06:14.067][700145][info][config] [source/server/configuration_impl.cc:97] loading 2 cluster(s) [2023-07-14 12:06:14.068][700145][info][config] [source/server/configuration_impl.cc:101] loading 2 listener(s) [2023-07-14 12:06:14.070][700145][critical][main] [source/server/config_validation/server.cc:64] error initializing configuration 'envoy-test.yaml': error adding listener 'envoy://singleton_internal_encap': internal listener registry is not initialized. [2023-07-14 12:06:14.071][700145][info][dns] [source/extensions/network/dns_resolver/cares/dns_impl.cc:540] c-ares library cleaned up.

lizan commented 1 year ago

@kyessenov @adisuissa

dceravigupta commented 1 year ago

@kyessenov can you take a look at this?

github-actions[bot] commented 1 year 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 1 year 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.

zamazan4ik commented 1 year ago

I get the same issue on the current Envoy from the master branch. I use the following config:

bootstrap_extensions:
- name: envoy.bootstrap.internal_listener_registry
  typed_config:
    "@type": "type.googleapis.com/envoy.extensions.bootstrap.internal_listener.v3.InternalListener"
admin:
  access_log_path: "/dev/null"
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 10000
static_resources:
  listeners:
  - name: internal_outbound
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 8080
    filter_chains:
      filters:
      - name: tcp_proxy
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
          cluster: internal_outbound
          stat_prefix: internal_outbound
  - name: outbound_8080
    #address:
    #  envoy_internal_address:
    #    server_listener_name: internal_outbound
    internal_listener: {}
    filter_chains:
      filters:
      - name: tcp_proxy
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.tcp_proxy.v3.TcpProxy
          cluster: outbound_8080
          tunneling_config:
            hostname: host.com:443
          stat_prefix: outbound
  - name: inbound_8081
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 8081
    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
          stat_prefix: inbound
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains:
              - "*"
              routes:
              - match:
                  connect_matcher:
                    {}
                route:
                  cluster: inbound_8081
                  upgrade_configs:
                  - upgrade_type: CONNECT
                    connect_config:
                      {}
          http_filters:
          - name: envoy.filters.http.router
            typed_config:
             "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
          http2_protocol_options:
            allow_connect: true
          upgrade_configs:
          - upgrade_type: CONNECT
  clusters:
  - connect_timeout: 1s
    name: internal_outbound
    load_assignment:
      cluster_name: internal_outbound
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              envoy_internal_address:
                server_listener_name: internal_outbound
  - connect_timeout: 1s
    name: outbound_8080
    typed_extension_protocol_options:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicit_http_config:
          http2_protocol_options:
            max_concurrent_streams: 1073741824
    load_assignment:
      cluster_name: outbound_8080
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 127.0.0.1
                port_value: 8081
  - connect_timeout: 1s
    name: inbound_8081
    load_assignment:
      cluster_name: inbound_8081
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 127.0.0.1
                port_value: 8082

For the ./envoy_static_release_master --mode validate -c http-connect.yaml command I get the following error:

[2023-09-17 02:43:39.288][1307728][warning][misc] [source/common/protobuf/message_validator_impl.cc:21] Deprecated field: type envoy.config.bootstrap.v3.Admin Using deprecated option 'envoy.config.bootstrap.v3.Admin.access_log_path' from file bootstrap.proto. This configuration will be removed from Envoy soon. Please see https://www.envoyproxy.io/docs/envoy/latest/version_history/version_history for details. If continued use of this field is absolutely necessary, see https://www.envoyproxy.io/docs/envoy/latest/configuration/operations/runtime#using-runtime-overrides-for-deprecated-features for how to apply a temporary and highly discouraged override.
[2023-09-17 02:43:39.288][1307728][info][main] [source/server/server.cc:838] runtime: {}
[2023-09-17 02:43:39.288][1307728][info][config] [source/server/configuration_impl.cc:159] loading tracing configuration
[2023-09-17 02:43:39.288][1307728][info][config] [source/server/configuration_impl.cc:118] loading 0 static secret(s)
[2023-09-17 02:43:39.288][1307728][info][config] [source/server/configuration_impl.cc:124] loading 3 cluster(s)
[2023-09-17 02:43:39.289][1307728][info][config] [source/server/configuration_impl.cc:128] loading 3 listener(s)
[2023-09-17 02:43:39.290][1307728][critical][main] [source/server/config_validation/server.cc:67] error initializing configuration 'http-connect.yaml': error adding listener named 'outbound_8080': internal listener registry is not initialized.

Only validation does not work - Envoy itself starts fine with this config with envoy -c http-connect.yaml.

ningcng commented 9 months ago

Getting the same error. Can we reopen this issue? @kyessenov @lizan