Skip to content

Commit 0f1c9c3

Browse files
committed
add instructions for st2.packs.volumes values
1 parent bd72f51 commit 0f1c9c3

File tree

1 file changed

+77
-6
lines changed

1 file changed

+77
-6
lines changed

README.md

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ st2:
140140
- name: circleci
141141
ref: circle_ci.CircleCIWebhookSensor
142142
```
143-
143+
144144
### [st2actionrunner](https://docs.stackstorm.com/reference/ha.html#st2actionrunner)
145145
Stackstorm workers that actually execute actions.
146146
`5` replicas for K8s Deployment are configured by default to increase StackStorm ability to execute actions without excessive queuing.
@@ -181,15 +181,23 @@ StackStorm employs redis sentinel as a distributed coordination backend, require
181181
As any other Helm dependency, it's possible to further configure it for specific scaling needs via `values.yaml`.
182182

183183
## Install custom st2 packs in the cluster
184-
In distributed environment of the Kubernetes cluster `st2 pack install` won’t work.
184+
There are two ways to install st2 packs in the k8s cluster.
185+
186+
1. The `st2packs` method is the default. This method will work for practically all clusters, but `st2 pack install` does not work. The packs are injected via `st2packs` images instead.
187+
188+
2. The other method defines shared/writable `volumes`. This method allows `st2 pack install` to work, but requires a persistent storage backend to be available in the cluster. This chart will not configure a storage backend for you.
189+
190+
### Method 1: st2packs images (the default)
191+
The `st2packs` method is the default. `st2 pack install` does not work because this chart uses read-only `emptyDir` volumes for `/opt/stackstorm/{packs,virtualenvs}`.
185192
Instead, you need to bake the packs into a custom docker image, push it to a private or public docker registry and reference that image in Helm values.
186-
Helm chart will take it from there, sharing `/opt/stackstorm/{packs,virtualenvs}` via a sidecar container in pods which require access to the packs.
193+
Helm chart will take it from there, sharing `/opt/stackstorm/{packs,virtualenvs}` via a sidecar container in pods which require access to the packs
194+
(the sidecar is the only place where the volumes are writable).
187195

188-
### Building st2packs image
196+
#### Building st2packs image
189197
For your convenience, we created a new `st2-pack-install <pack1> <pack2> <pack3>` utility and included it in a container that will help to install custom packs during the Docker build process without relying on live DB and MQ connection.
190198
Please see https://github.com/StackStorm/st2packs-dockerfiles/ for instructions on how to build your custom `st2packs` image.
191199

192-
### How to provide custom pack configs
200+
#### How to provide custom pack configs
193201
Update the `st2.packs.configs` section of Helm values:
194202

195203
For example:
@@ -205,7 +213,7 @@ For example:
205213
```
206214
Don't forget running Helm upgrade to apply new changes.
207215

208-
### Pull st2packs from a private Docker registry
216+
#### Pull st2packs from a private Docker registry
209217
If you need to pull your custom packs Docker image from a private repository, create a Kubernetes Docker registry secret and pass it to Helm values.
210218
See [K8s documentation](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) for more info.
211219
```
@@ -214,6 +222,69 @@ kubectl create secret docker-registry st2packs-auth --docker-server=<your-regist
214222
```
215223
Once secret created, reference its name in helm value: `st2.packs.images[].pullSecret`.
216224

225+
### Method 2: Shared Volumes
226+
This method requires cluster-specific storage setup and configuration. As the storage volumes are both writable and shared, `st2 pack install` should work like it does for standalone StackStorm installations. The volumes get mounted at `/opt/stackstorm/{packs,virtualenvs}` in the containers that need read or write access to those directories. With this method, `/opt/stackstorm/configs` can also be mounted as a writable volume instead of using `st2.packs.configs`.
227+
228+
#### Configure the storage volumes
229+
Enable the `st2.packs.voluems` section of Helm values and add volume definitions for both `packs` and `virtualenvs`.
230+
Each of the volume definitions should be customized for your cluster and storage solution.
231+
232+
NOTE: Make sure that `st2.packs.images` is empty. This method does not use or work with the `st2packs` images.
233+
234+
For example, to use persistentVolumeClaims:
235+
```
236+
volumes:
237+
enabled: true
238+
packs:
239+
persistentVolumeClaim:
240+
claim-name: pvc-st2-packs
241+
virtualenvs:
242+
persistentVolumeClaim:
243+
claim-name: pvc-st2-virtualenvs
244+
```
245+
246+
Or, for example, to use NFS:
247+
```
248+
volumes:
249+
enabled: true
250+
packs:
251+
nfs:
252+
server: nfs.example.com
253+
path: /var/nfsshare/packs
254+
virtualenvs:
255+
nfs:
256+
server: nfs.example.com
257+
path: /var/nfsshare/virtualenvs
258+
```
259+
260+
Please consult the documentation for your cluster's storage solution to see how to add the storage backend to your cluster and how to define volumes that use your storage backend.
261+
262+
#### How to provide custom pack configs
263+
You may either use the `st2.packs.configs` section of Helm values (like Method 1, see above),
264+
or add another shared writable volume similar to `packs` and `virtualenvs`. This volume gets mounted
265+
to `/opt/stackstorm/configs` instead of the `st2.packs.config` values. NOTE: If you define a configs volume,
266+
anything in `st2.packs.configs` will NOT be visible to StackStorm.
267+
268+
For example, to use persistentVolumeClaims:
269+
```
270+
volumes:
271+
enabled: true
272+
... # define packs and virtualenvs volumes as shown above
273+
configs:
274+
persistentVolumeClaim:
275+
claim-name: pvc-st2-pack-configs
276+
```
277+
278+
Or, for example, to use NFS:
279+
```
280+
volumes:
281+
enabled: true
282+
... # define packs and virtualenvs volumes as shown above
283+
configs:
284+
nfs:
285+
server: nfs.example.com
286+
path: /var/nfsshare/configs
287+
```
217288

218289
## Tips & Tricks
219290
Grab all logs for entire StackStorm cluster with dependent services in Helm release:

0 commit comments

Comments
 (0)