From 4769faf7b495f2026cab9ca6d7336dbce2ead2cb Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Fri, 20 Apr 2018 14:45:44 -0400 Subject: [PATCH] first pass at chart for Zulip probably requires https://github.com/galexrt/docker-zulip/pull/99 --- incubator/zulip/.helmignore | 21 +++ incubator/zulip/Chart.yaml | 4 + incubator/zulip/README.md | 11 ++ incubator/zulip/templates/NOTES.txt | 24 ++++ incubator/zulip/templates/_helpers.tpl | 21 +++ incubator/zulip/templates/deployment.yaml | 81 +++++++++++ incubator/zulip/templates/ingress.yaml | 31 +++++ incubator/zulip/templates/postgresql-pvc.yaml | 30 ++++ incubator/zulip/templates/redis-pvc.yaml | 30 ++++ incubator/zulip/templates/service.yaml | 23 ++++ incubator/zulip/templates/zulip-pvc.yaml | 30 ++++ incubator/zulip/values.yaml | 128 ++++++++++++++++++ 12 files changed, 434 insertions(+) create mode 100644 incubator/zulip/.helmignore create mode 100644 incubator/zulip/Chart.yaml create mode 100644 incubator/zulip/README.md create mode 100644 incubator/zulip/templates/NOTES.txt create mode 100644 incubator/zulip/templates/_helpers.tpl create mode 100644 incubator/zulip/templates/deployment.yaml create mode 100644 incubator/zulip/templates/ingress.yaml create mode 100644 incubator/zulip/templates/postgresql-pvc.yaml create mode 100644 incubator/zulip/templates/redis-pvc.yaml create mode 100644 incubator/zulip/templates/service.yaml create mode 100644 incubator/zulip/templates/zulip-pvc.yaml create mode 100644 incubator/zulip/values.yaml diff --git a/incubator/zulip/.helmignore b/incubator/zulip/.helmignore new file mode 100644 index 000000000000..f0c131944441 --- /dev/null +++ b/incubator/zulip/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/incubator/zulip/Chart.yaml b/incubator/zulip/Chart.yaml new file mode 100644 index 000000000000..b8b904ac63a9 --- /dev/null +++ b/incubator/zulip/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: zulipchat +name: zulip +version: 0.1.0 diff --git a/incubator/zulip/README.md b/incubator/zulip/README.md new file mode 100644 index 000000000000..169668dc4381 --- /dev/null +++ b/incubator/zulip/README.md @@ -0,0 +1,11 @@ +# Zulip + +[Zulip](https://zulipchat.com/), the world's most productive chat + +Helm chart based on https://github.com/galexrt/docker-zulip + +## Installation + +Grab a copy of values.yaml, modify it as necessary, then install with `helm install -f value.yaml incubator/zulip` + +After installation you will need to run `/opt/createZulipRealm.sh`. Instructions for doing so should be printed out during installation. diff --git a/incubator/zulip/templates/NOTES.txt b/incubator/zulip/templates/NOTES.txt new file mode 100644 index 000000000000..65aba287e526 --- /dev/null +++ b/incubator/zulip/templates/NOTES.txt @@ -0,0 +1,24 @@ +1. Zulip should now be available on: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "zulip.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "zulip.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "zulip.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:80 +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "zulip.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} + +2. To create a realm so you can sign in: + + kubectl -n {{ .Release.Namespace }} exec -it $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "zulip.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") -c zulip /opt/createZulipRealm.sh + diff --git a/incubator/zulip/templates/_helpers.tpl b/incubator/zulip/templates/_helpers.tpl new file mode 100644 index 000000000000..dcbbdef332ed --- /dev/null +++ b/incubator/zulip/templates/_helpers.tpl @@ -0,0 +1,21 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "zulip.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "zulip.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} diff --git a/incubator/zulip/templates/deployment.yaml b/incubator/zulip/templates/deployment.yaml new file mode 100644 index 000000000000..327609ecc74d --- /dev/null +++ b/incubator/zulip/templates/deployment.yaml @@ -0,0 +1,81 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "zulip.fullname" . }} + labels: + app: {{ template "zulip.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: 1 + template: + metadata: + labels: + app: {{ template "zulip.name" . }} + release: {{ .Release.Name }} + spec: + containers: + - name: redis + image: {{ .Values.redis.image }} + resources: +{{ toYaml .Values.redis.resources | indent 12 }} + volumeMounts: + - name: redis-persistent-storage + mountPath: /var/lib/redis + - name: memcached + image: {{ .Values.memcached.image }} + resources: +{{ toYaml .Values.memcached.resources | indent 12 }} + - name: rabbitmq + image: {{ .Values.rabbitmq.image }} + resources: +{{ toYaml .Values.rabbitmq.resources | indent 12 }} + env: +{{ toYaml .Values.rabbitmq.env | indent 12 }} + - name: postgresql + image: {{ .Values.postgresql.image }} + resources: +{{ toYaml .Values.postgresql.resources | indent 12 }} + env: +{{ toYaml .Values.postgresql.env | indent 12 }} + volumeMounts: + - name: postgresql-persistent-storage + mountPath: /var/lib/postgresql + - name: zulip + image: {{ .Values.zulip.image }} + resources: +{{ toYaml .Values.zulip.resources | indent 12 }} + env: +{{ toYaml .Values.zulip.env | indent 12 }} + ports: + - containerPort: 80 + name: http + protocol: TCP + - containerPort: 443 + name: https + protocol: TCP + volumeMounts: + - name: zulip-persistent-storage + mountPath: /data +# livenessProbe: +# httpGet: +# path: /login +# port: 443 +# scheme: HTTP +# initialDelaySeconds: 120 +# timeoutSeconds: 12 + volumes: + - name: zulip-persistent-storage + persistentVolumeClaim: + claimName: {{ template "zulip.fullname" . }}-zulip + - name: redis-persistent-storage + persistentVolumeClaim: + claimName: {{ template "zulip.fullname" . }}-redis + - name: postgresql-persistent-storage + persistentVolumeClaim: + claimName: {{ template "zulip.fullname" . }}-postgresql + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} diff --git a/incubator/zulip/templates/ingress.yaml b/incubator/zulip/templates/ingress.yaml new file mode 100644 index 000000000000..939b7b88582b --- /dev/null +++ b/incubator/zulip/templates/ingress.yaml @@ -0,0 +1,31 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := include "zulip.fullname" . -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "zulip.fullname" . }} + labels: + app: {{ template "zulip.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: / + backend: + serviceName: {{ $serviceName }} + servicePort: 80 + {{- end -}} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/incubator/zulip/templates/postgresql-pvc.yaml b/incubator/zulip/templates/postgresql-pvc.yaml new file mode 100644 index 000000000000..e009522682b1 --- /dev/null +++ b/incubator/zulip/templates/postgresql-pvc.yaml @@ -0,0 +1,30 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "zulip.fullname" . }}-postgresql + labels: + app: {{ template "zulip.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- if .Values.postgresql.persistence.annotations }} + annotations: +{{ toYaml .Values.postgresql.persistence.annotations | indent 4 }} +{{- end }} +spec: +{{- if .Values.postgresql.persistence.selector }} + selector: +{{ toYaml .Values.postgresql.persistence.selector | indent 4 }} +{{- end }} + accessModes: + - {{ .Values.postgresql.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.postgresql.persistence.size | quote }} +{{- if .Values.postgresql.persistence.storageClass }} +{{- if (eq "-" .Values.postgresql.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.postgresql.persistence.storageClass }}" +{{- end }} +{{- end }} diff --git a/incubator/zulip/templates/redis-pvc.yaml b/incubator/zulip/templates/redis-pvc.yaml new file mode 100644 index 000000000000..ddf0c0c0e565 --- /dev/null +++ b/incubator/zulip/templates/redis-pvc.yaml @@ -0,0 +1,30 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "zulip.fullname" . }}-redis + labels: + app: {{ template "zulip.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- if .Values.redis.persistence.annotations }} + annotations: +{{ toYaml .Values.redis.persistence.annotations | indent 4 }} +{{- end }} +spec: +{{- if .Values.redis.persistence.selector }} + selector: +{{ toYaml .Values.redis.persistence.selector | indent 4 }} +{{- end }} + accessModes: + - {{ .Values.redis.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.redis.persistence.size | quote }} +{{- if .Values.redis.persistence.storageClass }} +{{- if (eq "-" .Values.redis.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.redis.persistence.storageClass }}" +{{- end }} +{{- end }} diff --git a/incubator/zulip/templates/service.yaml b/incubator/zulip/templates/service.yaml new file mode 100644 index 000000000000..2f1b4703cd84 --- /dev/null +++ b/incubator/zulip/templates/service.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "zulip.fullname" . }} + labels: + app: {{ template "zulip.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: http + - port: 443 + targetPort: 443 + protocol: TCP + name: https + selector: + app: {{ template "zulip.name" . }} + release: {{ .Release.Name }} diff --git a/incubator/zulip/templates/zulip-pvc.yaml b/incubator/zulip/templates/zulip-pvc.yaml new file mode 100644 index 000000000000..41816f6ecae8 --- /dev/null +++ b/incubator/zulip/templates/zulip-pvc.yaml @@ -0,0 +1,30 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "zulip.fullname" . }}-zulip + labels: + app: {{ template "zulip.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- if .Values.zulip.persistence.annotations }} + annotations: +{{ toYaml .Values.zulip.persistence.annotations | indent 4 }} +{{- end }} +spec: +{{- if .Values.zulip.persistence.selector }} + selector: +{{ toYaml .Values.zulip.persistence.selector | indent 4 }} +{{- end }} + accessModes: + - {{ .Values.zulip.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.zulip.persistence.size | quote }} +{{- if .Values.zulip.persistence.storageClass }} +{{- if (eq "-" .Values.zulip.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.zulip.persistence.storageClass }}" +{{- end }} +{{- end }} diff --git a/incubator/zulip/values.yaml b/incubator/zulip/values.yaml new file mode 100644 index 000000000000..6f28321f6319 --- /dev/null +++ b/incubator/zulip/values.yaml @@ -0,0 +1,128 @@ +# Default values for zulip. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +nodeSelector: + zulip: "true" +ingress: + enabled: true + hosts: + - zulip.example.com + annotations: + kubernetes.io/ingress.class: nginx + kubernetes.io/tls-acme: "true" + tls: + - secretName: zulip.example.com + hosts: + - zulip.example.com +service: + type: ClusterIP +redis: + image: quay.io/sameersbn/redis:latest + resources: {} + persistence: + accessMode: ReadWriteOnce + size: 10Gi + # storageClass: standard + # annotations: {} + # selector: + # matchLabels: + # app: zulip + # component: redis +memcached: + image: quay.io/sameersbn/memcached:latest + resources: {} +rabbitmq: + resources: {} + image: rabbitmq:3.5.5 + env: + - name: RABBITMQ_DEFAULT_USER + value: "zulip" + - name: RABBITMQ_DEFAULT_PASS + value: "zulip" +postgresql: + resources: {} + image: quay.io/galexrt/zulip-postgresql-tsearchextras:latest + env: + - name: DB_NAME + value: zulip + - name: DB_USER + value: zulip + - name: DB_PASS + value: zulip + persistence: + accessMode: ReadWriteOnce + size: 10Gi + # storageClass: standard + # annotations: {} + # selector: + # matchLabels: + # app: zulip + # component: postgresql +zulip: + image: "quay.io/galexrt/zulip:1.8.0-1" + env: + - name: DB_HOST + value: "localhost" + - name: DB_HOST_PORT + value: "5432" + - name: DB_USER + value: "zulip" + - name: DB_PASS + value: "zulip" + - name: SETTING_MEMCACHED_LOCATION + value: "localhost:11211" + - name: SETTING_RABBITMQ_HOST + value: "localhost" + - name: SETTING_REDIS_HOST + value: "localhost" + - name: SECRETS_email_password + value: "fixme" + - name: SECRETS_rabbitmq_password + value: "zulip" + - name: SECRETS_secret_key + value: "put something random here" + - name: SETTING_EXTERNAL_HOST + value: "zulip.example.com" + - name: SETTING_ZULIP_ADMINISTRATOR + value: "admin@example.com" + - name: SETTING_ADMIN_DOMAIN + value: "zulip.example.com" + - name: SETTING_NOREPLY_EMAIL_ADDRESS + value: "noreply@example.com" + - name: SETTING_DEFAULT_FROM_EMAIL + value: "Zulip " + - name: SETTING_EMAIL_HOST + value: "smtp.example.com" + - name: SETTING_EMAIL_HOST_USER + value: "zulip@example.com" + - name: SETTING_EMAIL_PORT + value: "587" + - name: SETTING_EMAIL_USE_SSL + value: "False" + - name: SETTING_EMAIL_USE_TLS + value: "True" + - name: SETTING_EMAIL_BACKEND + value: "django.core.mail.backends.smtp.EmailBackend" + - name: SETTING_ALLOWED_HOSTS + value: "[ '*', '127.0.0.2' ]" + - name: ZULIP_AUTH_BACKENDS + value: "EmailAuthBackend" + - name: DISABLE_HTTPS + value: "True" + persistence: + accessMode: ReadWriteOnce + size: 10Gi + # storageClass: standard + # annotations: {} + # selector: + # matchLabels: + # app: zulip + # component: zulip + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi