Skip to content

Support remote cluster call in proxywasm go-sdk DispatchHttpCall? #563

@ray1888

Description

@ray1888

i cant use the go code below with envoy config which specified cluster

if _, err := proxywasm.DispatchHttpCall("acl-service", [][2]string{
		{":path", "/api/v1/match"},
		{":method", "POST"},
		{":scheme", "http"},
		{":authority", "*"},
	}, body, nil,
		3000, httpCallResponseCallback); err != nil {
		proxywasm.LogCriticalf("dipatch httpcall failed: %v", err)
		return types.ActionContinue
	}

// Envoy Config

static_resources:
  listeners:
    - name: main
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 18000
      filter_chains:
        - filters:
            - name: envoy.http_connection_manager
              typed_config:
                "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
                stat_prefix: ingress_http
                codec_type: auto
                route_config:
                  name: local_route
                  virtual_hosts:
                    - name: local_service
                      domains:
                        - "*"
                      routes:
                        - match:
                            prefix: "/"
                          route:
                            cluster: normal_service
                http_filters:
                  - name: envoy.filters.http.wasm
                    typed_config:
                      "@type": type.googleapis.com/udpa.type.v1.TypedStruct
                      type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
                      value:
                        config:
                          configuration:
                            "@type": "type.googleapis.com/google.protobuf.StringValue"
                            value: |
                              {"acl_service_host":"127.0.0.1", "acl_service_port":"10000", "cluster_name":"acl-service"}
                          vm_config:
                            runtime: "envoy.wasm.runtime.v8"
                            code:
                              local:
                                filename: "./build/gitee-acl.wasm"
                            configuration:
                              "@type": "type.googleapis.com/google.protobuf.StringValue"
                              value: |
                                {}

                  - name: envoy.filters.http.router
                    typed_config:
                      "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

  clusters:
    - name: normal_service
      connect_timeout: 5000s
      type: strict_dns
      lb_policy: round_robin
      load_assignment:
        cluster_name: httpbin
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address:
                      address: 127.0.0.1
                      port_value: 10001
    - name: acl-service
      connect_timeout: 5000s
      type: strict_dns
      lb_policy: round_robin
      load_assignment:
        cluster_name: httpbin
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address:
                      address: 127.0.0.1
                      port_value: 10000

admin:
  access_log_path: "/dev/null"
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 8001

but i can't use kong upstream to call a remote cluster , it can't find it anywhere

_format_version: "1.1"
_transform: true

services:
- name: demo
  url: http://my-service
  routes:
  - name: my-route
    paths:
    - /
    strip_path: false
    filter_chains:
    - filters:
      - name: gitee-acl
        config: 
          cluster_name: acl-service
          acl_service_host: 127.0.0.1
          acl_service_port: "10000"


upstreams:
  - name: my-service
    targets:
      - target: 127.0.0.1:10001
        weight: 100
  - name: acl-service
    targets:
      - target: 127.0.0.1:10000
        weight: 100

kong calling plugin error is below picture

image

is there any support of this remote cluster call in ngx_wasm_module implemetation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions