Skip to content

Commit 2223c2a

Browse files
authored
Merge pull request #88 from StackStorm/remove-localhost-docker-registry
Remove local Docker registry
2 parents 4c70898 + 3fbad90 commit 2223c2a

File tree

5 files changed

+20
-92
lines changed

5 files changed

+20
-92
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
helm dependency update
8787
- run:
8888
name: Helm install stackstorm-ha chart (Community)
89-
command: helm install --timeout 500 --debug --wait --name stackstorm-ha .
89+
command: helm install --timeout 600 --debug --wait --name stackstorm-ha .
9090
- run:
9191
name: Helm test (Community)
9292
command: helm test stackstorm-ha --parallel --cleanup

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## v0.22.0
66
* Add an option to pull custom st2packs image from private Docker repository (#87)
7+
* Remove local 'docker-registry' dependency for hosting custom packs in-cluster that doesn't fit prod expectations (#88)
78

89
## v0.21.0
910
* Change etcd dependency from incubator/etcd to stable/etcd-operator (#81)

README.md

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -191,62 +191,20 @@ StackStorm employs etcd as a distributed coordination backend, required for st2
191191
`3` node Raft cluster is deployed via external official Helm chart dependency [etcd-operator](https://github.com/helm/charts/tree/master/stable/etcd-operator).
192192
As any other Helm dependency, it's possible to further configure it for specific scaling needs via `values.yaml`.
193193

194-
### Docker registry
195-
If you do not already have an appropriate docker registry for storing custom st2 packs images, we made it
196-
very easy to deploy one in your k8s cluster. You can optionally enable in-cluster Docker registry via
197-
`values.yaml` by setting `docker-registry.enabled: true` and additional 3rd party charts [docker-registry](https://github.com/helm/charts/tree/master/stable/docker-registry)
198-
and [kube-registry-proxy](https://github.com/helm/charts/tree/master/incubator/kube-registry-proxy) will be configured.
199-
200194
## Install custom st2 packs in the cluster
201-
In the kubernetes cluster, the `st2 pack install` command will not work. Instead, you need to bake the packs into a custom
202-
docker image, and push it to a private or public docker registry. The image will provide `/opt/stackstorm/{packs,virtualenvs}`
203-
via a sidecar container in pods which need access to the packs.
204-
205-
If you do not already have an appropriate docker registry, we made it very easy to deploy one in your k8s cluster.
206-
See below for details.
207-
208-
### Build st2packs image
209-
To build the st2packs image which contains your required packs installed in `/opt/stackstorm/packs` and
210-
`/opt/stackstorm/virtualenvs`, define the `PACKS` build argument using a space separated list of pack names.
211-
Set DOCKER_REGISTRY to the docker registry URL. If using the private docker registry in the k8s cluster,
212-
set `DOCKER_REGISTRY`to `localhost:5000`.
213-
214-
Please see https://hub.docker.com/r/stackstorm/st2packs/ for details on how to build your custom `st2packs` image.
215-
216-
### Push st2packs image to a docker registry
217-
If you're pushing to a private docker registry in the k8s cluster, you will need to port forward from your local host to the registry. You can use:
218-
```
219-
kubectl port-forward $(kubectl get pod -l app=docker-registry -o jsonpath="{.items[0].metadata.name}") 5000:5000
220-
```
221-
222-
NOTE: If running on MacOS, before deploying the image, open another terminal and execute:
223-
```
224-
docker run --privileged --pid=host stackstorm/socat:latest nsenter -t 1 -u -n -i socat TCP-LISTEN:5000,fork TCP:docker.for.mac.localhost:5000
225-
```
226-
227-
The source for the `stackstorm/socat` image is found at https://github.com/StackStorm/docker-socat.
228-
229-
To deploy the image to the registry, execute:
230-
```
231-
docker push ${DOCKER_REGISTRY}/st2packs:latest
232-
```
195+
In distributed environment of the Kubernetes cluster `st2 pack install` won’t work.
196+
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.
197+
Helm chart will take it from there, sharing `/opt/stackstorm/{packs,virtualenvs}` via a sidecar container in pods which require access to the packs.
233198

234-
### Pull st2packs from a private Docker registry
235-
If you need to pull your packs Docker image from a private registry, you need to create a Kubernetes Docker registry secret and pass it to helm.
236-
See [K8s documentation](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) for more info.
237-
```
238-
# Create a Docker registry secret called 'st2packs-auth'
239-
kubectl create secret docker-registry st2packs-auth --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-password>
240-
```
241-
242-
Once secret created, you pass its name to helm value: `st2.packs.image.pullSecret`.
199+
### Building st2packs image
200+
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.
201+
Please see https://github.com/StackStorm/st2packs-dockerfiles/ for instructions on how to build your custom `st2packs` image.
243202

244203
### How to provide custom pack configs
245-
Update the `pack.configs` section of `stackstorm-ha/values.yaml`:
204+
Update the `st2.packs.configs` section of Helm values:
246205

247206
For example:
248207
```
249-
pack
250208
configs:
251209
email.yaml: |
252210
---
@@ -258,6 +216,15 @@ pack
258216
```
259217
Don't forget running Helm upgrade to apply new changes.
260218

219+
### Pull st2packs from a private Docker registry
220+
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.
221+
See [K8s documentation](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) for more info.
222+
```
223+
# Create a Docker registry secret called 'st2packs-auth'
224+
kubectl create secret docker-registry st2packs-auth --docker-server=<your-registry-server> --docker-username=<your-name> --docker-password=<your-password>
225+
```
226+
Once secret created, reference its name in helm value: `st2.packs.image.pullSecret`.
227+
261228

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

requirements.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ dependencies:
88
repository: https://kubernetes-charts.storage.googleapis.com/
99
alias: mongodb-ha
1010
condition: mongodb-ha.enabled
11-
- name: docker-registry
12-
version: 1.7.0
13-
repository: https://kubernetes-charts.storage.googleapis.com/
14-
condition: docker-registry.enabled
15-
- name: kube-registry-proxy
16-
version: 0.3.0
17-
repository: https://kubernetes-charts-incubator.storage.googleapis.com/
18-
condition: docker-registry.enabled
1911
- name: external-dns
2012
version: 1.6.1
2113
repository: https://kubernetes-charts.storage.googleapis.com/

values.yaml

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ st2:
7878
# Custom packs image settings. The repository, name, tag and pullPolicy for this image
7979
# are specified below.
8080
image:
81-
# If you wish to use a docker registry running in the k8s cluster, set docker-registry.enabled to true.
82-
# Uncomment the following line to make the custom packs image available to the necessary pods.
83-
84-
# repository: localhost:5000
81+
# Uncomment the following block to make the custom packs image available to the necessary pods
82+
#repository: you-remote-docker-registry.io
8583
name: st2packs
8684
tag: latest
8785
pullPolicy: Always
@@ -414,36 +412,6 @@ etcd-operator:
414412
# create default etcd cluster
415413
createEtcdClusterCRD: true
416414

417-
##
418-
## Docker registry configuration (3rd party chart dependency)
419-
##
420-
## The docker registry is useful if custom images need to be made available in the cluster.
421-
##
422-
## For values.yaml reference:
423-
## https://github.com/helm/charts/tree/master/stable/docker-registry
424-
##
425-
## If enabled is true, helm installs a docker registry into the cluster.
426-
## Otherwise, the docker registry is not installed.
427-
##
428-
docker-registry:
429-
enabled: false
430-
fullnameOverride: st2packs-docker-registry
431-
432-
##
433-
## Docker registry proxy configuration (3rd party chart dependency)
434-
## (only installed if docker-registry is enabled)
435-
##
436-
## This is run on each k8s node, and proxies pod localhost:5000 to the docker registry
437-
##
438-
## For values.yaml reference:
439-
## https://github.com/helm/charts/tree/master/incubator/kube-registry-proxy
440-
##
441-
kube-registry-proxy:
442-
registry:
443-
host: st2packs-docker-registry.default.svc.cluster.local
444-
port: 5000
445-
hostPort: 5000
446-
447415
##
448416
## External DNS configuration (3rd party chart dependency)
449417
##

0 commit comments

Comments
 (0)