Skip to content

Commit 26c0b81

Browse files
tg44alexmv
authored andcommitted
Add helm chart
A helm chart is added for the installation of Zulip into Kubernetes clusters. The chart is based on a version of PR #287, but contains significant changes. The chart depends on Bitnami helm charts for the installation of Memcached, Postgresql, Rabbitmq and Redis. The chart includes the possibility to add `postSetup` scripts which are mounted to `/data/post-setup.d` and executed by the docker-zulip Docker container. More information can be found in the chart's README in kubernetes/chart/zulip/README.md
1 parent 461360d commit 26c0b81

20 files changed

+943
-10
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1+
# OS
2+
.DS_Store
3+
4+
# Various IDEs
5+
.project
6+
.idea/
7+
*.tmproj
8+
9+
# dev files
110
docker-compose-dev.yml
211
kubernetes/*-dev.yml
12+
kubernetes/chart/zulip/values-local.yaml
13+
kubernetes/chart/zulip/charts/

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,17 +329,11 @@ signing up for a cloud service is to install
329329

330330
### Helm charts
331331

332-
We are aware of two efforts at building Helm Charts for Zulip:
333-
* [A PR to the main Helm repo](https://github.com/kubernetes/charts/pull/5168/files),
334-
which is further along.
335-
* [The zulip-helm project](https://github.com/armooo/zulip-helm),
336-
which might be a helpful reference for work on this.
332+
Read the [Helm Chart README](kubernetes/chart/zulip/README.md) to learn more
333+
about installing Zulip on a Kubernetes cluster with Helm.
337334

338-
Contributions to finish either of those and get them integrated are
339-
very welcome! If you're interested in helping with this, post on
340-
[this thread][helm-chart-thread].
341-
342-
[helm-chart-thread]: https://chat.zulip.org/#narrow/stream/21-provision-help/subject/K8.20and.20Helm/near/589098
335+
Feedback is welcome in the [helm-chart-thread]:
336+
https://chat.zulip.org/#narrow/stream/21-provision-help/subject/K8.20and.20Helm/near/589098
343337

344338
### Scaling out and high availability
345339

kubernetes/chart/zulip/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

kubernetes/chart/zulip/CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## [0.3.0] - 2022-04-21
2+
3+
* Update dependencies:
4+
5+
* Helm charts:
6+
7+
| Repository | Name | Version |
8+
|------------|------|---------|
9+
| https://charts.bitnami.com/bitnami | memcached | 6.0.16 |
10+
| https://charts.bitnami.com/bitnami | postgresql | 11.1.22 |
11+
| https://charts.bitnami.com/bitnami | rabbitmq | 8.32.0 |
12+
| https://charts.bitnami.com/bitnami | redis | 16.8.7 |
13+
14+
* Update postgres 10 to postgres 14
15+
* Update Zulip 4.7 to 5.2
16+
* Remove autoscaling code
17+
* Remove readiness probe because its function is the same as the liveness probe
18+
19+
## [0.2.0] - 2021-11-22
20+
21+
* Use dependency charts from the Bitnami repository for Memcached, Rabbitmq,
22+
Redis and PostgreSQL
23+
* Use a StatefulSet instead of a Deployment
24+
* Add the possibility to run postSetup scripts
25+
26+
## [0.1.0] - 2020-12-30
27+
28+
* First version of helm chart created

kubernetes/chart/zulip/Chart.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
dependencies:
2+
- name: memcached
3+
repository: https://charts.bitnami.com/bitnami
4+
version: 6.0.16
5+
- name: rabbitmq
6+
repository: https://charts.bitnami.com/bitnami
7+
version: 8.32.0
8+
- name: redis
9+
repository: https://charts.bitnami.com/bitnami
10+
version: 16.8.7
11+
- name: postgresql
12+
repository: https://charts.bitnami.com/bitnami
13+
version: 11.1.22
14+
digest: sha256:376a93b6d6df79610d9ba283727a95560378644bb006f4ffc2c19571453a5cad
15+
generated: "2022-04-21T11:44:41.427111348+02:00"

kubernetes/chart/zulip/Chart.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
apiVersion: v2
2+
description: Zulip is an open source threaded team chat that helps teams stay productive and focused.
3+
name: zulip
4+
type: application
5+
icon: https://raw.githubusercontent.com/zulip/zulip/main/static/images/logo/zulip-icon-square.svg
6+
# This is the chart version. This version number should be incremented each time you make changes
7+
# to the chart and its templates, including the app version.
8+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
9+
version: 0.3.0
10+
11+
# This is the version number of the application being deployed. This version number should be
12+
# incremented each time you make changes to the application. Versions are not expected to
13+
# follow Semantic Versioning. They should reflect the version the application is using.
14+
# It is recommended to use it with quotes.
15+
appVersion: "5.2-0"
16+
dependencies:
17+
- name: memcached
18+
repository: https://charts.bitnami.com/bitnami
19+
tags:
20+
- memcached
21+
version: 6.0.16
22+
- name: rabbitmq
23+
repository: https://charts.bitnami.com/bitnami
24+
tags:
25+
- rabbitmq
26+
version: 8.32.0
27+
- name: redis
28+
repository: https://charts.bitnami.com/bitnami
29+
tags:
30+
- redis
31+
version: 16.8.7
32+
- name: postgresql
33+
repository: https://charts.bitnami.com/bitnami
34+
tags:
35+
- postgresql
36+
# Note: values.yaml overwrites posgresql image to zulip/zulip-postgresql:14
37+
version: 11.1.22
38+
39+
sources:
40+
- https://github.com/zulip/zulip
41+
- https://github.com/zulip/docker-zulip
42+
- https://hub.docker.com/r/zulip/docker-zulip

kubernetes/chart/zulip/README.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Zulip
2+
3+
![Version: 0.3.0](https://img.shields.io/badge/Version-0.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 5.2-0](https://img.shields.io/badge/AppVersion-5.2--0-informational?style=flat-square)
4+
5+
[Zulip](https://zulip.com/) is an open source threaded team chat that helps teams stay productive and focused.
6+
7+
Helm chart based on https://github.com/zulip/docker-zulip
8+
9+
## Installation
10+
11+
Copy `values-local.yaml.example`, modify it as instructed in the comments, then
12+
install with the following commands:
13+
14+
```
15+
helm dependency update # Get helm dependency charts
16+
helm install -f ./values-local.yaml zulip . # Install Zulip
17+
```
18+
19+
This will show a message on how to reach your Zulip installation and how to
20+
create your first realm. Wait for all your pods to be ready before you continue.
21+
You can run `kubectl get pods` to their current state. Once all pods are ready,
22+
you can run the commands to create a Realm, and you can reach Zulip following
23+
the instructions as well.
24+
25+
### Installing on Minikube
26+
27+
You need to do a few things to make
28+
[minikube](https://minikube.sigs.k8s.io/docs/) serve Zulip with a TLS
29+
certificate. Without it, Zulip will not work.
30+
31+
If you haven't already, you need to set up `cert-manager` inside your minikube.
32+
33+
First, enable the "ingress" minikube addon ([more info available
34+
here](https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/#enable-the-ingress-controller))
35+
36+
```
37+
minikube addons enable ingress
38+
```
39+
40+
Second, [install cert-manager into your minikube
41+
cluster](https://cert-manager.io/docs/installation/#default-static-install):
42+
43+
```
44+
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml
45+
```
46+
47+
Now you'll need to add an issuer that issues self-signed certificates. Copy this
48+
into a file, `self-signed-issuer.yaml`
49+
50+
```
51+
apiVersion: cert-manager.io/v1
52+
kind: ClusterIssuer
53+
metadata:
54+
name: selfsigned
55+
namespace: cert-manager
56+
spec:
57+
selfSigned: {}
58+
```
59+
60+
Now apply the issuer: `kubectl apply -f self-signed-issuer.yaml`
61+
62+
We'll host Zulip on `zulip.local`. Add that to your `/etc/hosts` file and
63+
point it to the IP address you get with the command `minikube ip`.
64+
65+
Now you're ready to follow [the installation instructions above](#installation).
66+
67+
## Values
68+
69+
| Key | Type | Default | Description |
70+
|-----|------|---------|-------------|
71+
| affinity | object | `{}` | Affinity for pod assignment. Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity |
72+
| fullnameOverride | string | `""` | Fully override common.names.fullname template. |
73+
| image.pullPolicy | string | `"IfNotPresent"` | Pull policy for Zulip docker image. Ref: https://kubernetes.io/docs/user-guide/images/#pre-pulling-images |
74+
| image.repository | string | `"zulip/docker-zulip"` | Defaults to hub.docker.com/zulip/docker-zulip, but can be overwritten with a full HTTPS address. |
75+
| image.tag | string | `"5.2-0"` | Zulip image tag (immutable tags are recommended) |
76+
| imagePullSecrets | list | `[]` | Global Docker registry secret names as an array. |
77+
| ingress.annotations | object | `{}` | Can be used to add custom Ingress annotations. |
78+
| ingress.enabled | bool | `false` | Enable this to use an Ingress to reach the Zulip service. |
79+
| ingress.hosts[0] | object | `{"host":"zulip.example.com","paths":[{"path":"/"}]}` | Host for the Ingress. Should be the same as `zulip.environment.SETTING_EXTERNAL_HOST`. |
80+
| ingress.hosts[0].paths | list | `[{"path":"/"}]` | Serves Zulip root of the chosen host domain. |
81+
| ingress.tls | list | `[]` | Set a specific secret to read the TLS certificate from. If you use cert-manager, it will save the TLS secret here. If you do not, you need to manually create a secret with your TLS certificate. |
82+
| livenessProbe | object | `{"enabled":true,"failureThreshold":3,"initialDelaySeconds":10,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":5}` | Liveness probe values. Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes |
83+
| memcached | object | `{"memcachedUsername":"zulip@localhost"}` | Memcached settings, see [Requirements](#Requirements). |
84+
| nameOverride | string | `""` | Partially override common.names.fullname template (will maintain the release name). |
85+
| nodeSelector | object | `{}` | Optionally add a nodeSelector to the Zulip pod, so it runs on a specific node. Ref: https://kubernetes.io/docs/user-guide/node-selection/ |
86+
| podAnnotations | object | `{}` | Custom annotations to add to the Zulip Pod. |
87+
| podLabels | object | `{}` | Custom labels to add to the Zulip Pod. |
88+
| podSecurityContext | object | `{}` | Can be used to override the default PodSecurityContext (fsGroup, runAsUser and runAsGroup) of the Zulip _Pod_. |
89+
| postSetup.scripts | object | `{}` | The Docker entrypoint script runs commands from `/data/post-setup.d` after the Zulip application's Setup phase has completed. Scripts can be added here as `script_filename: <script contents>` and they will be mounted in `/data/post-setup.d/script_filename`. |
90+
| postgresql | object | `{"auth":{"database":"zulip","username":"zulip"},"image":{"repository":"zulip/zulip-postgresql","tag":14},"primary":{"containerSecurityContext":{"runAsUser":0}}}` | PostgreSQL settings, see [Requirements](#Requirements). |
91+
| rabbitmq | object | `{"auth":{"username":"zulip"},"persistence":{"enabled":false}}` | Rabbitmq settings, see [Requirements](#Requirements). |
92+
| redis | object | `{"architecture":"standalone","master":{"persistence":{"enabled":false}}}` | Redis settings, see [Requirements](#Requirements). |
93+
| resources | object | `{}` | |
94+
| securityContext | object | `{}` | Can be used to override the default SecurityContext of the Zulip _container_. |
95+
| service | object | `{"port":80,"type":"ClusterIP"}` | Service type and port for the Kubernetes service that connects to Zulip. Default: ClusterIP, needs an Ingress to be used. |
96+
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account. |
97+
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created. |
98+
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
99+
| startupProbe | object | `{"enabled":true,"failureThreshold":30,"initialDelaySeconds":10,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":5}` | Startup probe values. Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes |
100+
| statefulSetAnnotations | object | `{}` | Custom annotations to add to the Zulip StatefulSet. |
101+
| statefulSetLabels | object | `{}` | Custom labels to add to the Zulip StatefulSet. |
102+
| tolerations | list | `[]` | Tolerations for pod assignment. Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ |
103+
| zulip.environment.DISABLE_HTTPS | bool | `true` | Disables HTTPS if set to "true". HTTPS and certificates are managed by the Kubernetes cluster, so by default it's disabled inside the container |
104+
| zulip.environment.SECRETS_email_password | string | `"123456789"` | SMTP email password. |
105+
| zulip.environment.SETTING_EMAIL_HOST | string | `""` | |
106+
| zulip.environment.SETTING_EMAIL_HOST_USER | string | `"[email protected]"` | |
107+
| zulip.environment.SETTING_EMAIL_PORT | string | `"587"` | |
108+
| zulip.environment.SETTING_EMAIL_USE_SSL | string | `"False"` | |
109+
| zulip.environment.SETTING_EMAIL_USE_TLS | string | `"True"` | |
110+
| zulip.environment.SETTING_EXTERNAL_HOST | string | `"zulip.example.com"` | Domain Zulip is hosted on. |
111+
| zulip.environment.SETTING_ZULIP_ADMINISTRATOR | string | `"[email protected]"` | |
112+
| zulip.environment.SSL_CERTIFICATE_GENERATION | string | `"self-signed"` | Set SSL certificate generation to self-signed because Kubernetes manages the client-facing SSL certs. |
113+
| zulip.environment.ZULIP_AUTH_BACKENDS | string | `"EmailAuthBackend"` | |
114+
| zulip.persistence | object | `{"accessMode":"ReadWriteOnce","enabled":true,"size":"10Gi"}` | If `persistence.existingClaim` is not set, a PVC is generated with these specifications. |
115+
116+
## About this helm chart
117+
118+
This helm chart sets up a StatefulSet that runs a Zulip pod, that in turn runs
119+
the [docker-zulip](https://hub.docker.com/r/zulip/docker-zulip/) Dockerized
120+
Zulip version. Configuration of Zulip happens through environment variables that
121+
are defined in the `values.yaml` under `zulip.environment`. These environment
122+
variables are forwarded to the Docker container, you can read more about
123+
configuring Zulip through environment variables
124+
[here](https://github.com/zulip/docker-zulip/#configuration).
125+
126+
### Dependencies
127+
128+
The chart uses Memcached, RabbitMQ and Redis helm charts defined in
129+
the Bitnami Helm repository. Most of these are configured following their
130+
default settings, but you can check
131+
https://github.com/bitnami/charts/tree/master/bitnami/ for more configuration
132+
options of the subcharts.
133+
134+
For PostgreSQL the chart also uses the Bitnami chart to install it on the
135+
Kubernetes cluster. However, in this case we use Zulip's
136+
[zulip-postgresql](https://hub.docker.com/r/zulip/zulip-postgresql) docker
137+
image, because it contains the Postgresql plugins that are needed to run Zulip.
138+
139+
## Requirements
140+
141+
| Repository | Name | Version |
142+
|------------|------|---------|
143+
| https://charts.bitnami.com/bitnami | memcached | 6.0.16 |
144+
| https://charts.bitnami.com/bitnami | postgresql | 11.1.22 |
145+
| https://charts.bitnami.com/bitnami | rabbitmq | 8.32.0 |
146+
| https://charts.bitnami.com/bitnami | redis | 16.8.7 |
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Zulip
2+
3+
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
4+
5+
[Zulip](https://zulip.com/) is an open source threaded team chat that helps teams stay productive and focused.
6+
7+
Helm chart based on https://github.com/zulip/docker-zulip
8+
9+
## Installation
10+
11+
Copy `values-local.yaml.example`, modify it as instructed in the comments, then
12+
install with the following commands:
13+
14+
```
15+
helm dependency update # Get helm dependency charts
16+
helm install -f ./values-local.yaml zulip . # Install Zulip
17+
```
18+
19+
This will show a message on how to reach your Zulip installation and how to
20+
create your first realm. Wait for all your pods to be ready before you continue.
21+
You can run `kubectl get pods` to their current state. Once all pods are ready,
22+
you can run the commands to create a Realm, and you can reach Zulip following
23+
the instructions as well.
24+
25+
### Installing on Minikube
26+
27+
You need to do a few things to make
28+
[minikube](https://minikube.sigs.k8s.io/docs/) serve Zulip with a TLS
29+
certificate. Without it, Zulip will not work.
30+
31+
If you haven't already, you need to set up `cert-manager` inside your minikube.
32+
33+
First, enable the "ingress" minikube addon ([more info available
34+
here](https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/#enable-the-ingress-controller))
35+
36+
```
37+
minikube addons enable ingress
38+
```
39+
40+
Second, [install cert-manager into your minikube
41+
cluster](https://cert-manager.io/docs/installation/#default-static-install):
42+
43+
```
44+
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml
45+
```
46+
47+
Now you'll need to add an issuer that issues self-signed certificates. Copy this
48+
into a file, `self-signed-issuer.yaml`
49+
50+
```
51+
apiVersion: cert-manager.io/v1
52+
kind: ClusterIssuer
53+
metadata:
54+
name: selfsigned
55+
namespace: cert-manager
56+
spec:
57+
selfSigned: {}
58+
```
59+
60+
Now apply the issuer: `kubectl apply -f self-signed-issuer.yaml`
61+
62+
We'll host Zulip on `zulip.local`. Add that to your `/etc/hosts` file and
63+
point it to the IP address you get with the command `minikube ip`.
64+
65+
Now you're ready to follow [the installation instructions above](#installation).
66+
67+
{{ template "chart.valuesSection" . }}
68+
69+
## About this helm chart
70+
71+
This helm chart sets up a StatefulSet that runs a Zulip pod, that in turn runs
72+
the [docker-zulip](https://hub.docker.com/r/zulip/docker-zulip/) Dockerized
73+
Zulip version. Configuration of Zulip happens through environment variables that
74+
are defined in the `values.yaml` under `zulip.environment`. These environment
75+
variables are forwarded to the Docker container, you can read more about
76+
configuring Zulip through environment variables
77+
[here](https://github.com/zulip/docker-zulip/#configuration).
78+
79+
### Dependencies
80+
81+
The chart uses Memcached, RabbitMQ and Redis helm charts defined in
82+
the Bitnami Helm repository. Most of these are configured following their
83+
default settings, but you can check
84+
https://github.com/bitnami/charts/tree/master/bitnami/ for more configuration
85+
options of the subcharts.
86+
87+
For PostgreSQL the chart also uses the Bitnami chart to install it on the
88+
Kubernetes cluster. However, in this case we use Zulip's
89+
[zulip-postgresql](https://hub.docker.com/r/zulip/zulip-postgresql) docker
90+
image, because it contains the Postgresql plugins that are needed to run Zulip.
91+
92+
{{ template "chart.requirementsSection" . }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
1. To create a realm so you can sign in:
2+
3+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "zulip.name" . }}" -o jsonpath="{.items[0].metadata.name}")
4+
kubectl -n {{ .Release.Namespace }} exec -it "$POD_NAME" -c zulip -- sudo -u zulip /home/zulip/deployments/current/manage.py generate_realm_creation_link
5+
6+
2. Zulip will be available on:
7+
8+
https://{{ .host }}

0 commit comments

Comments
 (0)