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

Update Helm chart to support deployment of Turing App with experiment engine plugins #153

Merged
merged 4 commits into from
Jan 17, 2022

Conversation

romanwozniak
Copy link
Contributor

Context:

In the previous PRs (#143, #147, #149 to name a few) we added support of external experiment engines implemented as RPC plugins. This PR introduces a base Docker image to make it simpler to package and distribute experiment engine plugins and adds necessary changes to Turing's Helm chart to support the deployment of Turing application with such plugins.

Details:

Experiment engine plugins are supported via hashicorp/go-plugins, where each plugin is running in a separate process and host application (turing-app) communicates with the plugin over the network. Plugin's process is started by the host application, meaning that the plugin's executable binary should be accessible from the host app.
To achieve precisely this, we added a new emptyDir volume into the deployment, where plugin executables are expected to be placed.

Now Turing's user can package their plugin as a docker image:

docker build . \
  -t ghcr.io/myrepo/my-exp-engine:latest \
  -f engines/experiment/plugin.Dockerfile \
  --build-arg PLUGIN_NAME=my-exp-engine \
  --build-arg PLUGIN_BINARY=path/to/my/plugin/binary

And then deploy it with Turing, by providing turing.experimentEngines configuration via Helm values file:

turing:
  experimentEngines:
  - name: my-exp-engine
    type: rpc-plugin
    rpcPlugin:
      image: ghcr.io/myrepo/my-exp-engine:latest
    options: {}
    # plugin's configuration  

Under the hood, the docker image with the plugin's binary will be added as an initContainer on the Turing app deployment, and the binary will be copied over to the plugins-volume, where it can be accessed by the host application.

Note:

This PR touches only the deployment of Turing app, meaning that the plugin will not be available to the Turing router, after the one is deployed. This will be addressed separately in the next PR.

@romanwozniak romanwozniak requested a review from a team January 13, 2022 04:26
@romanwozniak romanwozniak self-assigned this Jan 13, 2022
{{- define "turing.plugins.initContainers" -}}
{{ if .Values.turing.experimentEngines }}
initContainers:
{{ range $expEngine := .Values.turing.experimentEngines }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to support multiple experiment engines at run time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's nothing new, Turing can be deployed with multiple experiment engines, and it's up to users to decide which experiment engine to use during the router configuration step

# type: rpc-plugin
# rpcPlugin:
# image: ghcr.io/turing/my-exp-engine:latest
# options:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is options here? Is it meant to hold the engine's configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. This configuration is later placed (or merged with, if some configuration already exists there) under turing.config.Experiment.<engine name>: https://github.com/romanwozniak/turing/blob/938ee0b09d7c3fd226afb282f43467792ba2431b/infra/charts/turing/templates/_helpers.tpl#L142-L148

@romanwozniak romanwozniak merged commit 4e09722 into caraml-dev:main Jan 17, 2022
@romanwozniak romanwozniak deleted the chart_to_support_plugins branch January 17, 2022 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants