Skip to content
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

Envoy WASM singleton service per envoy instance #15860

Closed
NomadXD opened this issue Apr 6, 2021 · 7 comments
Closed

Envoy WASM singleton service per envoy instance #15860

NomadXD opened this issue Apr 6, 2021 · 7 comments
Labels
area/wasm stale stalebot believes this issue/PR has not been touched recently

Comments

@NomadXD
Copy link
Contributor

NomadXD commented Apr 6, 2021

Title: Envoy WASM singleton service per envoy instance

Description:
I have a requirement where I have to make a HTTP request to an external service and pull some data periodically. I implemented a HTTP filter in Rust and doing the HTTP call from the onTick in the RootContext. But RootContext gets created for each worker thread and for each worker thread , a HTTP occur. In the docs, there is an option for a Singleton service where I have to specify singleton: true. https://www.envoyproxy.io/docs/envoy/latest/configuration/other_features/wasm_service#config-wasm-service. However the config example is not very descriptive.

Configured as follows as mentioned in the docs. But envoy rejects the config at start up saying error initializing configuration '/etc/envoy/envoy.yaml': Protobuf message (type envoy.config.bootstrap.v3.Bootstrap reason INVALID_ARGUMENT:wasm: Cannot find field.) has unknown fields. Envoy version used in 1.17.1

admin:
  access_log_path: /dev/null
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 9000
wasm:
  config:
    config:
      name: "my_plugin"
      vm_config:
        runtime: "envoy.wasm.runtime.v8"
        code:
          local:
            filename: "/usr/local/bin/singleton_service.wasm"
    singleton: true
static_resources:
  listeners:
  - address:
      socket_address:
        address: 0.0.0.0
        port_value: 9095
@NomadXD NomadXD added the triage Issue requires triage label Apr 6, 2021
@PiotrSikora
Copy link
Contributor

That's not the way to configure a bootstrap extension, you need something like this:

admin:
  access_log_path: /dev/null
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 9000

bootstrap_extensions:
- name: envoy.bootstrap.wasm
  typed_config:
    '@type': type.googleapis.com/envoy.extensions.wasm.v3.WasmService
    singleton: true
    config:
      vm_config:
        runtime: "envoy.wasm.runtime.v8"
        code:
          local:
            filename: "/usr/local/bin/singleton_service.wasm"

static_resources:
  listeners:
  - address:
      socket_address:
        address: 0.0.0.0
        port_value: 9095

@PiotrSikora PiotrSikora added area/wasm and removed triage Issue requires triage labels Apr 7, 2021
@NomadXD
Copy link
Contributor Author

NomadXD commented Apr 7, 2021

@PiotrSikora Thank you. I think the docs for that relevant section has not been updated yet.

@PiotrSikora
Copy link
Contributor

@NomadXD patches welcome!

@NomadXD
Copy link
Contributor Author

NomadXD commented Apr 8, 2021

@PiotrSikora Sure. Would like to contribute. Any specific procedure that I have to follow before sending a PR for the docs ?

@PiotrSikora
Copy link
Contributor

No, simply update docs/root/configuration/other_features/wasm_service.rst and make sure that it generates properly (e.g. using ./ci/run_envoy_docker.sh './ci/do_ci.sh docs').

If you want more about contributing to Envoy in general, there is CONTRIBUTING.md file that you could read.

@github-actions
Copy link

github-actions bot commented May 9, 2021

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 github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label May 9, 2021
@PiotrSikora
Copy link
Contributor

Fixed in #15914.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/wasm stale stalebot believes this issue/PR has not been touched recently
Projects
None yet
Development

No branches or pull requests

2 participants