Adding Custom Executors

The general process for adding an executor to Laser is as follows:

  1. Create a custom Lambda Executor docker image

  2. Add a corresponding Lambda Executor resource type in Gestalt Meta

  3. Add a new Executor Provider (based on the resource type and image)

These steps are described in more detail below.

Create a Custom Lambda Executor by Extending a Galactic Fog Executor Image

This example shows creating a custom Python version 3 executor using the Galactic Fog Python executor image as a base. The base executor image contains a management component used to communicate with Gestalt Laser. By extending the base executor image, this management component is automatically included in the new executor image.

1) Create the custom executor image

This example starts with the Galactic Fog Python executor image, removes the version of Python present, and installs python3 libraries.

Docker File:

FROM galacticfog/gestalt-laser-executor-python:release-1.4.2

USER root
RUN apk add --no-cache python3 && \
    python3 -m ensurepip && \
    rm -r /usr/lib/python*/ensurepip && \
    pip3 install --upgrade pip setuptools && \
    if [ -e /usr/bin/pip ]; then rm /usr/bin/pip ; fi && \
    if [ -e /usr/bin/python ]; then rm -f usr/bin/python; fi && \
    if [ -e /usr/sbin/python ]; then rm -f usr/sbin/python; fi && \
    ln -s pip3 /usr/bin/pip && \
    ln -sf /usr/bin/python3 /usr/bin/python && \
    rm -r /root/.cache

2) Build and publish the docker image

The following commands build and publish the docker image. Replace <sha> with the SHA output by the docker build command, <tag> with and mycompany with the appropriate docker registry prefix. Note that by default, the docker push command publishes the image to the https://docker.io public registry.

Build and publish to docker.io registry:

docker build .
docker tag <sha> mycompany/python3-executor:<tag>
docker push  mycompany/python3-executor:<tag>

3) Create the custom executor in Gestalt

Navigate to Providers > Create Provider, then create a new executor with the following parameters:

In Gestalt, navigate to Providers > Create > New Provider, then set the following parameters:

  • CMD - The command to run the executor image. Set to bin/gestalt-laser-executor-python.

  • IMAGE - Docker image to use. The image may be located in a public or private docker registry.

  • NAME - Preferred convention: {runtime name}-executor (e.g. python3-executor. The name must be unique among the executors in the system.

  • RUNTIME - This must be unique among the executors in the system. Set to python3.

image

Note: Since this executor is extending a base executor, the CMD field must be kept the same since that's how the underlying executor image needs to be run. However, make sure to change the NAME, IMAGE, and RUNTIME parameters. NAME and RUNTIME should be unique among the executors in the system. IMAGE must refer to the published docker image.

4) Associate the Executor with Gestalt Laser

Navigate to the Laser provider in Providers, and add a new Linked Provider. Click + Linked Provider, and add a entry with prefix EXECUTOR_<n> where <n> is the next executor. Selec the custom executor defined in the previous step (e.g. python3-executor).

image

Next, update and re-deploy the Laser provider by clicking UPDATE, then REDEPLOY. This re-deploys the underlying Laser container with the new executor configuration.

You can confirm the new executor container was deployed by inspecting the underlying CaaS infrastructure.

The screenshot applies to DC/OS:

image