Skip to content

Commit

Permalink
Merge pull request #146 from RocketChat/native-wellknown
Browse files Browse the repository at this point in the history
feat: serve well-known paths for federation natively
  • Loading branch information
debdutdeb committed May 21, 2024
2 parents 72c876e + 1849700 commit 95185a6
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 10 deletions.
10 changes: 9 additions & 1 deletion rocketchat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,15 @@ mongodb:
tag: # find from https://hub.docker.com/r/bitnami/mongodb/tags
```

Refernces:
References:
- [Run a shell inside a container (to check mongodb version)](https://kubernetes.io/docs/tasks/debug/debug-application/get-shell-running-container/)
- [MongoDB upgrade official documentation](https://www.mongodb.com/docs/manual/tutorial/upgrade-revision/)
- [MongoDB helm chart options](https://artifacthub.io/packages/helm/bitnami/mongodb)

### To 6.13.0

**This is only applicable if you both, enabled federation in chart version >=6.8, and want to keep using lighttpd.**

IFF you manually enabled ingress.federation.serveWellKnown (which was a hidden setting) before, during upgrade, disable it once before enabling it again.

Chart contained a bug that would cause `wellknown` deployment to fail to update (illegal live modification of `matchLabels`).
4 changes: 4 additions & 0 deletions rocketchat/templates/chat-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ spec:
name: {{ include "rocketchat.fullname" . }}-synapse
key: bridge_url
- name: OVERWRITE_SETTING_Federation_Matrix_homeserver_url
{{- if .Values.ingress.federation.serveWellKnown }}
value: http://{{ template "rocketchat.fullname" . }}-synapse:8008
{{- else }}
value: https://{{ .Values.federation.host }}
{{- end }}
- name: OVERWRITE_SETTING_Federation_Matrix_bridge_localpart
value: "rocket.cat"
{{end}}
Expand Down
4 changes: 3 additions & 1 deletion rocketchat/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ spec:
port:
name: http
{{- end }}
{{ if and .Values.federation.enabled .Values.ingress.federation.serveWellKnown }}
{{- if .Values.federation.enabled }}
{{- if .Values.ingress.federation.serveWellKnown }}
- path: /.well-known/matrix/server
pathType: Prefix
backend:
Expand All @@ -74,6 +75,7 @@ spec:
name: {{ template "rocketchat.fullname" . }}-wellknown
port:
name: http
{{- end }}
- host: {{ .Values.federation.host }}
http:
paths:
Expand Down
4 changes: 0 additions & 4 deletions rocketchat/templates/lighttpd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,13 @@ metadata:
name: {{ include "rocketchat.fullname" . }}-wellknown
labels:
app.kubernetes.io/name: {{ include "rocketchat.fullname" . }}-wellknown
helm.sh/chart: {{ include "rocketchat.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ include "rocketchat.fullname" . }}-wellknown
helm.sh/chart: {{ include "rocketchat.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
template:
metadata:
labels:
Expand Down
21 changes: 18 additions & 3 deletions rocketchat/templates/synapse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,29 @@
{{- fail "federation must be used with rocket.chat version >= 6.6.4" }}
{{- end }}
{{- end }}
{{- $hs_token := randAlphaNum 26 | b64enc | quote -}}
{{- $as_token := randAlphaNum 24 | b64enc | quote -}}
{{- $secret := include "rocketchat.fullname" . | printf "%s-synapse" | lookup "v1" "Secret" .Release.Namespace }}
{{- $hs_token := "" }}
{{- $as_token := "" }}
{{- $bridge_url := printf "http://%s-bridge:3300" (include "rocketchat.fullname" .) -}}
{{- $id := randAlphaNum 14 | b64enc | printf "rocketchat_%s" -}}
{{- $id := "" }}
{{- if $secret }}
{{- $hs_token = $secret.data.hs_token | b64dec -}}
{{- $as_token = $secret.data.as_token | b64dec -}}
{{- $id = $secret.data.appservice_id | b64dec -}}
{{- else }}
{{- $hs_token = randAlphaNum 26 | b64enc | quote -}}
{{- $as_token = randAlphaNum 24 | b64enc | quote -}}
{{- $id = randAlphaNum 14 | b64enc | printf "rocketchat_%s" -}}
{{- end }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "rocketchat.fullname" . }}-synapse
labels:
app.kubernetes.io/name: {{ include "rocketchat.name" . }}-synapse
helm.sh/chart: {{ include "rocketchat.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}

stringData:
as_token: {{ $as_token }}
Expand Down
2 changes: 1 addition & 1 deletion rocketchat/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ ingress:
# hosts:
# - chart-example.local
federation:
serveWellKnown: true # if false, rocket.chat will handle the response
serveWellKnown: false

service:
annotations: {}
Expand Down

0 comments on commit 95185a6

Please sign in to comment.