Skip to content

Commit 33596a6

Browse files
authored
Merge pull request opencloud-eu#26 from opencloud-eu/collabora
Add Collabora Online Support
2 parents 883e18d + 5d38c14 commit 33596a6

File tree

16 files changed

+572
-25
lines changed

16 files changed

+572
-25
lines changed

README.md

Lines changed: 155 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Welcome to the **OpenCloud Helm Charts** repository! This repository is intended
2727
- [Gateway API Configuration](#gateway-api-configuration)
2828
- [HTTPRoute Settings](#httproute-settings)
2929
- [Setting Up Gateway API with Talos, Cilium, and cert-manager](#setting-up-gateway-api-with-talos-cilium-and-cert-manager)
30+
- [Setting up Ingress](#setting-up-ingress)
3031
- [License](#-license)
3132
- [Community Maintained](#community-maintained)
3233

@@ -217,9 +218,7 @@ The following sections outline the main configuration parameters for the product
217218
| `global.domain.onlyoffice` | Domain for OnlyOffice | `onlyoffice.opencloud.test` |
218219
| `global.domain.companion` | Domain for Companion | `companion.opencloud.test` |
219220
| `global.tls.enabled` | Enable TLS (set to false when using gateway TLS termination externally) | `false` |
220-
| `global.tls.selfSigned` | Use self-signed certificates | `true` |
221-
| `global.tls.acmeEmail` | ACME email for Let's Encrypt | `[email protected]` |
222-
| `global.tls.acmeCAServer` | ACME CA server | `https://acme-v02.api.letsencrypt.org/directory` |
221+
| `global.tls.secretName` | Secret name for TLS certificate | `""` |
223222
| `global.storage.storageClass` | Storage class for persistent volumes | `""` |
224223

225224
### Image Settings
@@ -315,14 +314,21 @@ The following sections outline the main configuration parameters for the product
315314
| `onlyoffice.config.coAuthoring.token.enable.browser` | Enable token for browser requests | `true` |
316315
| `onlyoffice.collaboration.enabled` | Enable collaboration service | `true` |
317316

317+
If you use Traefik and enable OnlyOffice, this chart will automatically create a `Middleware`
318+
named `add-x-forwarded-proto-https`, used by:
319+
* Ingress (if `annotationsPreset: traefik`)
320+
* Gateway API `HTTPRoute` (if `gateway.className: traefik`)
321+
322+
This ensures the `X-Forwarded-Proto: https` header is added as required by OnlyOffice.
323+
318324
### Collabora Settings
319325

320326
| Parameter | Description | Default |
321327
| --------- | ----------- | ------- |
322328
| `collabora.enabled` | Enable Collabora | `true` |
323-
| `collabora.repository` | Collabora image repository | `collabora/code` |
324-
| `collabora.tag` | Collabora image tag | `24.04.13.2.1` |
325-
| `collabora.pullPolicy` | Image pull policy | `IfNotPresent` |
329+
| `collabora.image.repository` | Collabora image repository | `collabora/code` |
330+
| `collabora.image.tag` | Collabora image tag | `24.04.13.2.1` |
331+
| `collabora.image.pullPolicy` | Image pull policy | `IfNotPresent` |
326332
| `collabora.adminUser` | Admin user | `admin` |
327333
| `collabora.adminPassword` | Admin password | `admin` |
328334
| `collabora.ssl.enabled` | Enable SSL | `true` |
@@ -501,7 +507,7 @@ Apply the ClusterIssuer:
501507
kubectl apply -f cluster-issuer.yaml
502508
```
503509

504-
### Step 3: Create a Wildcard Certificate for OpenCloud Domains
510+
### Step 4: Create a Wildcard Certificate for OpenCloud Domains
505511

506512
Create a wildcard certificate for all OpenCloud subdomains:
507513

@@ -535,7 +541,7 @@ Apply the certificate:
535541
kubectl apply -f cluster-issuer.yaml
536542
```
537543

538-
### Step 4: Create the Gateway
544+
### Step 5: Create the Gateway
539545

540546
Create a Gateway resource to expose your services:
541547

@@ -653,7 +659,7 @@ Apply the Gateway:
653659
kubectl apply -f gateway.yaml
654660
```
655661

656-
### Step 5: Configure DNS
662+
### Step 6: Configure DNS
657663

658664
Configure your DNS to point to the Gateway IP address. You can use a wildcard DNS record or individual records for each service:
659665

@@ -673,7 +679,7 @@ Alternatively, for local testing, you can add entries to your `/etc/hosts` file:
673679
192.168.178.77 wopiserver.opencloud.test
674680
```
675681

676-
### Step 6: Install OpenCloud
682+
### Step 7: Install OpenCloud
677683

678684
Finally, install OpenCloud using Helm:
679685

@@ -732,6 +738,145 @@ kubectl get pods -n opencloud -l app.kubernetes.io/component=onlyoffice-redis
732738
kubectl get pods -n opencloud -l app.kubernetes.io/component=onlyoffice-rabbitmq
733739
```
734740

741+
## Setting up Ingress
742+
743+
For some deployments the kubernetes gateway API is not readily available. Using the traditional Ingress objects can be easier to
744+
set up. The chart only deploys the necessary Ingress objects, e.g.
745+
minio is not reachable.
746+
747+
### Step 1: Install cert-manager
748+
749+
Install cert-manager to manage TLS certificates:
750+
751+
```bash
752+
# install the default cert manager
753+
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.17.0/cert-manager.yaml
754+
```
755+
756+
### Step 2: Create a ClusterIssuer for cert-manager
757+
758+
Create a ClusterIssuer for cert-manager to issue certificates:
759+
760+
```yaml
761+
# cluster-issuer.yaml
762+
apiVersion: cert-manager.io/v1
763+
kind: ClusterIssuer
764+
metadata:
765+
name: selfsigned-issuer
766+
spec:
767+
selfSigned: {}
768+
```
769+
770+
Apply the ClusterIssuer:
771+
772+
```bash
773+
kubectl apply -f cluster-issuer.yaml
774+
```
775+
776+
### Step 3: Create a Wildcard Certificate for OpenCloud Domains
777+
778+
Create a wildcard certificate for all OpenCloud subdomains:
779+
780+
```yaml
781+
# cluster-issuer.yaml
782+
apiVersion: cert-manager.io/v1
783+
kind: ClusterIssuer
784+
metadata:
785+
name: selfsigned-issuer
786+
spec:
787+
selfSigned: {}
788+
---
789+
apiVersion: cert-manager.io/v1
790+
kind: Certificate
791+
metadata:
792+
name: opencloud-wildcard-tls
793+
namespace: kube-system
794+
spec:
795+
secretName: opencloud-wildcard-tls
796+
dnsNames:
797+
- "opencloud.test"
798+
- "*.opencloud.test"
799+
issuerRef:
800+
name: selfsigned-issuer
801+
kind: ClusterIssuer
802+
```
803+
804+
Apply the certificate:
805+
806+
```bash
807+
kubectl apply -f cluster-issuer.yaml
808+
```
809+
810+
### Step 4: Install OpenCloud
811+
812+
Finally, install OpenCloud using Helm:
813+
814+
```bash
815+
# Clone the repository
816+
git clone https://github.com/your-repo/opencloud-helm.git
817+
cd opencloud-helm
818+
```
819+
820+
Customize the chart to use Ingress objects instead of the newer gateway API
821+
822+
```yaml
823+
global:
824+
# TLS settings
825+
tls:
826+
# Enable TLS
827+
enabled: true
828+
secretName: opencloud-wildcard-tls
829+
830+
# Disable Gateway API configuration
831+
httpRoute:
832+
enabled: false
833+
834+
# Enable ingress
835+
ingress:
836+
enabled: true
837+
# onlyoffice requires adding an X-Forwarded-Proto header to the request.
838+
# The chart currently knows how to add this header for traefik, nginx,
839+
# haproxy, contour, and istio. PR welcome.
840+
annotationsPreset: "traefik" # optional, default ""
841+
annotations:
842+
cert-manager.io/cluster-issuer: selfsigned-issuer
843+
```
844+
845+
```bash
846+
# Install OpenCloud
847+
helm install opencloud . \
848+
--namespace opencloud \
849+
--create-namespace \
850+
--set httpRoute.gateway.name=opencloud-gateway \
851+
--set httpRoute.gateway.namespace=kube-system
852+
```
853+
854+
855+
### 🔧 Traefik Middleware for OnlyOffice
856+
If you enable:
857+
```yaml
858+
ingress:
859+
enabled: true
860+
annotationsPreset: "traefik"
861+
onlyoffice:
862+
enabled: true
863+
```
864+
865+
The chart will automatically:
866+
* Create a Traefik `Middleware` resource named `add-x-forwarded-proto-https` in the chart's namespace.
867+
* Attach that Middleware to the OnlyOffice Ingress via:
868+
```yaml
869+
traefik.ingress.kubernetes.io/router.middlewares: <namespace>-add-x-forwarded-proto-https@kubernetescrd
870+
```
871+
872+
If you disable the preset and define custom annotations:
873+
```yaml
874+
annotationsPreset: ""
875+
ingress.annotations:
876+
traefik.ingress.kubernetes.io/router.middlewares: my-custom-middleware@kubernetescrd
877+
```
878+
Then you are responsible for creating the referenced Middleware yourself.
879+
735880

736881
## 📜 License
737882

charts/opencloud/README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,7 @@ The following table lists the configurable parameters of the OpenCloud chart and
203203
| `global.domain.onlyoffice` | Domain for OnlyOffice | `onlyoffice.opencloud.test` |
204204
| `global.domain.companion` | Domain for Companion | `companion.opencloud.test` |
205205
| `global.tls.enabled` | Enable TLS (set to false when using gateway TLS termination externally) | `false` |
206-
| `global.tls.selfSigned` | Use self-signed certificates | `true` |
207-
| `global.tls.acmeEmail` | ACME email for Let's Encrypt | `[email protected]` |
208-
| `global.tls.acmeCAServer` | ACME CA server | `https://acme-v02.api.letsencrypt.org/directory` |
206+
| `global.tls.secretName` | secretName for TLS certificate | `""` |
209207
| `global.storage.storageClass` | Storage class for persistent volumes | `""` |
210208

211209
### Image Settings
@@ -301,14 +299,21 @@ The following table lists the configurable parameters of the OpenCloud chart and
301299
| `onlyoffice.config.coAuthoring.token.enable.browser` | Enable token for browser requests | `true` |
302300
| `onlyoffice.collaboration.enabled` | Enable collaboration service | `true` |
303301

302+
If you use Traefik and enable OnlyOffice, this chart will automatically create a `Middleware`
303+
named `add-x-forwarded-proto-https`, used by:
304+
* Ingress (if `annotationsPreset: traefik`)
305+
* Gateway API `HTTPRoute` (if `gateway.className: traefik`)
306+
307+
This ensures the `X-Forwarded-Proto: https` header is added as required by OnlyOffice.
308+
304309
### Collabora Settings
305310

306311
| Parameter | Description | Default |
307312
| --------- | ----------- | ------- |
308313
| `collabora.enabled` | Enable Collabora | `true` |
309-
| `collabora.repository` | Collabora image repository | `collabora/code` |
310-
| `collabora.tag` | Collabora image tag | `24.04.13.2.1` |
311-
| `collabora.pullPolicy` | Image pull policy | `IfNotPresent` |
314+
| `collabora.image.repository` | Collabora image repository | `collabora/code` |
315+
| `collabora.image.tag` | Collabora image tag | `24.04.13.2.1` |
316+
| `collabora.image.pullPolicy` | Image pull policy | `IfNotPresent` |
312317
| `collabora.adminUser` | Admin user | `admin` |
313318
| `collabora.adminPassword` | Admin password | `admin` |
314319
| `collabora.ssl.enabled` | Enable SSL | `true` |

charts/opencloud/templates/_helpers/tpl.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ Return the OnlyOffice domain
118118
{{- .Values.global.domain.onlyoffice }}
119119
{{- end }}
120120

121+
{{/*
122+
Return the Collabora domain
123+
*/}}
124+
{{- define "opencloud.collabora.domain" -}}
125+
{{- .Values.global.domain.collabora }}
126+
{{- end }}
127+
121128
{{/*
122129
Return the Companion domain
123130
*/}}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{{- if .Values.collabora.enabled }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ include "opencloud.fullname" . }}-collabora
6+
labels:
7+
{{- include "opencloud.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: collabora
9+
spec:
10+
replicas: 1
11+
selector:
12+
matchLabels:
13+
{{- include "opencloud.selectorLabels" . | nindent 6 }}
14+
app.kubernetes.io/component: collabora
15+
template:
16+
metadata:
17+
labels:
18+
{{- include "opencloud.selectorLabels" . | nindent 8 }}
19+
app.kubernetes.io/component: collabora
20+
spec:
21+
containers:
22+
- name: collabora
23+
image: {{ .Values.collabora.image.repository }}:{{ .Values.collabora.image.tag }}
24+
imagePullPolicy: {{ .Values.collabora.image.pullPolicy | default "IfNotPresent" }}
25+
command: ['/bin/bash', '-c']
26+
args:
27+
- 'coolconfig generate-proof-key && /start-collabora-online.sh'
28+
env:
29+
- name: aliasgroup1
30+
value: "http://opencloud-collaboration:9300,https://{{ .Values.global.domain.wopi }}"
31+
- name: DONT_GEN_SSL_CERT
32+
value: "YES"
33+
- name: extra_params
34+
value: |
35+
--o:ssl.enable={{ .Values.collabora.ssl.enabled }} \
36+
--o:ssl.ssl_verification={{ .Values.collabora.ssl.verification }} \
37+
--o:ssl.termination=true \
38+
--o:welcome.enable=false \
39+
--o:net.frame_ancestors={{ include "opencloud.domain" . }}
40+
- name: username
41+
value: "{{ .Values.collabora.admin.user | default "admin" }}"
42+
- name: password
43+
value: "{{ .Values.collabora.admin.password | default "admin" }}"
44+
ports:
45+
- containerPort: 9980
46+
name: http
47+
protocol: TCP
48+
resources:
49+
{{- toYaml .Values.collabora.resources | nindent 12 }}
50+
livenessProbe:
51+
httpGet:
52+
path: /hosting/discovery
53+
port: http
54+
initialDelaySeconds: 60
55+
periodSeconds: 10
56+
readinessProbe:
57+
httpGet:
58+
path: /hosting/discovery
59+
port: http
60+
initialDelaySeconds: 30
61+
periodSeconds: 10
62+
securityContext:
63+
capabilities:
64+
add:
65+
- MKNOD
66+
{{- end }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{- if and .Values.ingress.enabled .Values.collabora.enabled }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: {{ include "opencloud.fullname" . }}-collabora
6+
annotations:
7+
{{- toYaml .Values.ingress.annotations | nindent 4 }}
8+
spec:
9+
{{- if .Values.ingress.ingressClassName }}
10+
ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
11+
{{- end }}
12+
{{- if .Values.global.tls.enabled }}
13+
tls:
14+
- hosts:
15+
- {{ .Values.global.domain.collabora | quote }}
16+
secretName: {{ .Values.global.tls.secretName }}
17+
{{- end }}
18+
rules:
19+
- host: {{ .Values.global.domain.collabora | quote }}
20+
http:
21+
paths:
22+
- path: /
23+
pathType: Prefix
24+
backend:
25+
service:
26+
name: {{ include "opencloud.fullname" . }}-collabora
27+
port:
28+
number: 9980
29+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if .Values.collabora.enabled }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ include "opencloud.fullname" . }}-collabora
6+
labels:
7+
{{- include "opencloud.labels" . | nindent 4 }}
8+
app.kubernetes.io/component: collabora
9+
spec:
10+
type: ClusterIP
11+
ports:
12+
- port: 9980
13+
targetPort: http
14+
protocol: TCP
15+
name: http
16+
selector:
17+
{{- include "opencloud.selectorLabels" . | nindent 4 }}
18+
app.kubernetes.io/component: collabora
19+
{{- end }}

0 commit comments

Comments
 (0)