Skip to content

Commit

Permalink
Merge pull request #14 from CSCfi/rocketchat
Browse files Browse the repository at this point in the history
Add Rocketchat Helm Chart
  • Loading branch information
lvarin authored Feb 2, 2024
2 parents 18515cf + 5ae37df commit 8ef0dbb
Show file tree
Hide file tree
Showing 33 changed files with 1,914 additions and 0 deletions.
1 change: 1 addition & 0 deletions charts/rocketchat/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
6 changes: 6 additions & 0 deletions charts/rocketchat/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: nats
repository: https://nats-io.github.io/k8s/helm/charts
version: 0.15.1
digest: sha256:f5006ab6c7fe8432dbb48fff4934536c672302049a2edae50d95f50dc30fea22
generated: "2024-01-17T10:52:33.851583+02:00"
27 changes: 27 additions & 0 deletions charts/rocketchat/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v2
name: rocketchat
version: 6.4.4
appVersion: 6.4.4
dependencies:
- name: nats
repository: https://nats-io.github.io/k8s/helm/charts
version: 0.15.x
condition: microservices.enabled
description: Prepare to take off with the ultimate chat platform, experience the next level of team communications
keywords:
- chat
- communication
- http
- web
- application
- nodejs
- javascript
- meteor
home: https://rocket.chat/
icon: https://raw.githubusercontent.com/RocketChat/Rocket.Chat.Artwork/master/Logos/icon.svg
sources:
- https://github.com/RocketChat/Docker.Official.Image/
engine: gotpl
maintainers:
- email: [email protected]
name: RocketChat
212 changes: 212 additions & 0 deletions charts/rocketchat/README.md

Large diffs are not rendered by default.

Binary file added charts/rocketchat/charts/mongodb-13.18.5.tgz
Binary file not shown.
Binary file added charts/rocketchat/charts/nats-0.15.1.tgz
Binary file not shown.
8 changes: 8 additions & 0 deletions charts/rocketchat/ci/ci-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
host: rocketchat.example.com

ingress:
enabled: true

mongodb:
auth.rootPassword: DdVMffX7Mj8ZrrmS5rHiWignyFqWp263bCexRktzCk
auth.password: QBbUuRiPFEJf6oh2T7FXXxsUlzBxJRosnrVKEdrUyew
27 changes: 27 additions & 0 deletions charts/rocketchat/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Rocket.Chat can be accessed via port 80 on the following DNS name from within your cluster:

- http://{{ template "rocketchat.fullname" . }}.{{ .Release.Namespace }}

You can easily connect to the remote instance from your browser. Forward the webserver port to localhost:8888

- kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "rocketchat.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') 8888:3000

You can also connect to the container running Rocket.Chat. To open a shell session in the pod run the following:

- kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "rocketchat.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath='{.items[0].metadata.name}') /bin/sh

To trail the logs for the Rocket.Chat pod run the following:

- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "rocketchat.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }')

{{- if .Values.ingress.enabled }}

Rocket.Chat will be available at the URL:

- http://{{ .Values.host }}
{{ else }}

To expose Rocket.Chat via an Ingress you need to set host and enable ingress.

helm install --set host=chat.yourdomain.com --set ingress.enabled=true stable/rocketchat
{{- end -}}
97 changes: 97 additions & 0 deletions charts/rocketchat/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{{/* vim: set filetype=helm: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "rocketchat.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).
*/}}
{{- define "rocketchat.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | 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).
*/}}
{{- define "rocketchat.mongodb.fullname" -}}
{{- printf "%s-%s-headless" .Release.Name "mongodb" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "rocketchat.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "rocketchat.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "rocketchat.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Return the apiVersion of deployment.
*/}}
{{- define "deployment.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "apps/v1" -}}
{{- end -}}
{{- end -}}

{{/*
Renders a value that contains template.
Note: This function was lent from Bitnami Common Library Chart (cf.
https://github.com/bitnami/charts/blob/master/bitnami/common/templates/_tplvalues.tpl)
Usage:
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "common.tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}

{{/*Generate the MONGO_URL*/}}
{{- define "rocketchat.mongodb.url" }}
{{- if .Values.externalMongodbUrl }}
{{- print .Values.externalMongodbUrl }}
{{- else }}
{{- $service := include "rocketchat.mongodb.fullname" . }}
{{- $user := required "usernames array must have at least one entry" (first .Values.mongodb.auth.usernames) }}
{{- $password := required "passwords array must have at least one entry" (first .Values.mongodb.auth.passwords) }}
{{- $database := required "databases array must have at least one entry" (first .Values.mongodb.auth.databases) }}
{{- $port := .Values.mongodb.service.ports.mongodb }}
{{- $rs := .Values.mongodb.replicaSetName }}
{{- printf "mongodb://%s:%s@%s:%0.f/%s?replicaSet=%s" $user $password $service $port $database $rs }}
{{- end }}
{{- end }}

{{/*Generate MONGO_OPLOG_URL*/}}
{{- define "rocketchat.mongodb.oplogUrl" }}
{{- if .Values.externalMongodbOplogUrl }}
{{- print .Values.externalMongodbOplogUrl }}
{{- else }}
{{- $service := include "rocketchat.mongodb.fullname" . }}
{{- $user := .Values.mongodb.auth.rootUser }}
{{- $password := required "root password must be provided" .Values.mongodb.auth.rootPassword }}
{{- $port := .Values.mongodb.service.ports.mongodb }}
{{- $rs := .Values.mongodb.replicaSetName }}
{{- printf "mongodb://%s:%s@%s:%0.f/local?replicaSet=%s&authSource=admin" $user $password $service $port $rs }}
{{- end }}
{{- end }}
221 changes: 221 additions & 0 deletions charts/rocketchat/templates/chat-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
apiVersion: {{ template "deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "rocketchat.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
helm.sh/chart: {{ include "rocketchat.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Values.deploymentLabels }}
{{ toYaml .Values.deploymentLabels | indent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels | indent 8 }}
{{- end }}

annotations:
checksum/secret: {{ include (print .Template.BasePath "/secret.yaml") . | sha256sum }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}


spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
serviceAccountName: {{ template "rocketchat.serviceAccountName" . }}
{{- if .Values.extraInitContainers }}
initContainers:
{{- toYaml .Values.extraInitContainers | nindent 8 }}
{{- end }}
containers:
- name: rocketchat
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: DEPLOY_PLATFORM
value: helm-chart
- name: INSTANCE_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
{{- if .Values.existingMongodbSecret }}
- name: MONGO_URL
valueFrom:
secretKeyRef:
name: {{ .Values.existingMongodbSecret }}
key: mongo-uri
- name: MONGO_OPLOG_URL
valueFrom:
secretKeyRef:
name: {{ .Values.existingMongodbSecret }}
key: mongo-oplog-uri
{{- else }}
- name: MONGO_URL
valueFrom:
secretKeyRef:
name: {{ template "rocketchat.fullname" . }}
key: mongo-uri
- name: MONGO_OPLOG_URL
valueFrom:
secretKeyRef:
name: {{ template "rocketchat.fullname" . }}
key: mongo-oplog-uri
{{- end }}
{{- if .Values.host }}
- name: ROOT_URL
value: https://{{ .Values.route.host}}.{{ .Values.host }}
{{- end }}
{{- if .Values.smtp.enabled }}
{{- if not .Values.smtp.existingSecret }}
- name: MAIL_URL
valueFrom:
secretKeyRef:
name: {{ template "rocketchat.fullname" . }}
key: mail-url
{{- else }}
- name: MAIL_URL
valueFrom:
secretKeyRef:
name: {{ .Values.smtp.existingSecret }}
key: mail-url
{{- end }}
{{- end }}
{{- if and .Values.registrationToken .Release.IsInstall }}
- name: REG_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "rocketchat.fullname" . }}
key: reg-token
{{- end }}
{{- if and .Values.license .Release.IsInstall }}
- name: ROCKETCHAT_LICENSE
valueFrom:
secretKeyRef:
name: {{ template "rocketchat.fullname" . }}
key: license
{{- end }}
{{- if .Values.prometheusScraping.enabled }}
- name: OVERWRITE_SETTING_Prometheus_Enabled
value: "true"
- name: OVERWRITE_SETTING_Prometheus_Port
value: "{{ .Values.prometheusScraping.port }}"
{{- end }}
# Environment variables for microservices option
{{- if .Values.microservices.enabled }}
- name: TRANSPORTER
value: nats://{{ .Release.Name }}-nats:4222
- name: MOLECULER_LOG_LEVEL
value: {{ .Values.microservices.logLevel | quote }}
- name: HEARTBEAT_INTERVAL
value: {{ .Values.microservices.heartbeatInterval | quote }}
- name: HEARTBEAT_TIMEOUT
value: {{ .Values.microservices.heartbeatTimeout | quote }}
- name: RETRY_ENABLED
value: 'yes'
- name: MS_METRICS
value: {{ .Values.prometheusScraping.enabled | default "false" | quote }}
{{- end}} # end of microservices envvar. options
{{- with .Values.extraEnv }}
{{- include "common.tplvalues.render" (dict "value" . "context" $) | nindent 8 }}
{{- end }}
ports:
- name: http
containerPort: 3000
{{- if .Values.prometheusScraping.enabled }}
- name: metrics
containerPort: {{ .Values.prometheusScraping.port }}
{{- end}}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: {{ .Values.livenessProbe.path }}
port: http
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: {{ .Values.readinessProbe.path }}
port: http
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
- name: rocket-data
mountPath: /app/uploads
- name: tmp
mountPath: /tmp
{{- if .Values.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: tmp
emptyDir: {}
- name: rocket-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "rocketchat.fullname" . }}{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- if .Values.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 6 }}
{{- end }}
{{- if or .Values.podAntiAffinity .Values.affinity }}
affinity:
{{- if .Values.affinity }}
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
{{- if eq .Values.podAntiAffinity "hard" }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: {{ .Values.podAntiAffinityTopologyKey }}
labelSelector:
matchLabels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
{{- else if eq .Values.podAntiAffinity "soft" }}
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: {{ .Values.podAntiAffinityTopologyKey }}
labelSelector:
matchLabels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- end }}
Loading

0 comments on commit 8ef0dbb

Please sign in to comment.