|
| 1 | +--- |
| 2 | +title: Spintainer Executor |
| 3 | +description: An overview of what the Spintainer Executor does and how it can be used. |
| 4 | +categories: [SpinKube] |
| 5 | +tags: [] |
| 6 | +--- |
| 7 | + |
| 8 | +# The Spintainer Executor |
| 9 | + |
| 10 | +The Spintainer (a play on the words Spin and container) executor is a [SpinAppExecutor](../../reference/spin-app-executor) that runs Spin applications directly in a container rather than via the [shim](../../topics/architecture#containerd-shim-spin). This is useful for a number of reasons: |
| 11 | + |
| 12 | +- Provides the flexibility to: |
| 13 | + - Use any Spin version you want. |
| 14 | + - Use any custom triggers or plugins you want. |
| 15 | +- Allows you to use SpinKube even if you don't have the cluster permissions to install the shim. |
| 16 | + |
| 17 | +> Note: We recommend using the shim for most use cases. The spintainer executor is best saved as a workaround. |
| 18 | +
|
| 19 | +## How to create a spintainer executor |
| 20 | + |
| 21 | +The following is some sample configuration for a spintainer executor: |
| 22 | + |
| 23 | +```yaml |
| 24 | +apiVersion: core.spinkube.dev/v1alpha1 |
| 25 | +kind: SpinAppExecutor |
| 26 | +metadata: |
| 27 | + name: spintainer |
| 28 | +spec: |
| 29 | + createDeployment: true |
| 30 | + deploymentConfig: |
| 31 | + installDefaultCACerts: true |
| 32 | + spinImage: ghcr.io/fermyon/spin:v2.7.0 |
| 33 | +``` |
| 34 | +
|
| 35 | +Save this into a file named `spintainer-executor.yaml` and then apply it to the cluster. |
| 36 | + |
| 37 | +```bash |
| 38 | +kubectl apply -f spintainer-executor.yaml |
| 39 | +``` |
| 40 | + |
| 41 | +## How to use a spintainer executor |
| 42 | + |
| 43 | +To use the spintainer executor you must reference it as the executor of your `SpinApp`. |
| 44 | + |
| 45 | +```yaml |
| 46 | +apiVersion: core.spinkube.dev/v1alpha1 |
| 47 | +kind: SpinApp |
| 48 | +metadata: |
| 49 | + name: simple-spinapp |
| 50 | +spec: |
| 51 | + image: "ghcr.io/spinkube/containerd-shim-spin/examples/spin-rust-hello:v0.13.0" |
| 52 | + replicas: 1 |
| 53 | + executor: spintainer |
| 54 | +``` |
| 55 | + |
| 56 | +## How the spintainer executor works |
| 57 | + |
| 58 | +The spintainer executor executes your Spin application in a container created from the image specified by `.spec.deploymentConfig.spinImage`. The container image must have a Spin binary be the [entrypoint](https://docs.docker.com/reference/dockerfile/#entrypoint) of the container. It will be started with the following args. |
| 59 | + |
| 60 | +``` |
| 61 | +up --listen {spin-operator-defined-port} -f {spin-operator-defined-image} --runtime-config-file {spin-operator-defined-config-file} |
| 62 | +``` |
| 63 | +
|
| 64 | +For ease of use you can use the images published by the Spin project [here](https://github.com/fermyon/spin/pkgs/container/spin). Alternatively you can craft images for your own unique need. |
0 commit comments