Skip to content

Commit

Permalink
Merge pull request cs3org#17 from SamuAlfageme/wopibridge_integration
Browse files Browse the repository at this point in the history
Charts look fine and bring important changes and additions, so merging this PR now
  • Loading branch information
Daniel-WWU-IT authored Sep 1, 2020
2 parents d61741d + 05eb576 commit d8c1c33
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 17 deletions.
4 changes: 2 additions & 2 deletions wopiserver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ apiVersion: v2
name: wopiserver
description: A Vendor-neutral Web-application Open Platform Interface (WOPI) gateway for EFSS systems
type: application
version: 0.1.0
appVersion: v5.2
version: 0.2.0
appVersion: v5.4
source: https://github.com/cs3org/wopiserver
24 changes: 24 additions & 0 deletions wopiserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,39 @@ The following configurations may be set. It is recommended to use `values.yaml`
| `image.pullPolicy` | The kubernetes image pull policy. | `Always` |
| `service.type` | The kubernetes service type to use. | `ClusterIP` |
| `service.port` | The wopiserver service HTTP port. | `8880` |
| `wopiserverUrl` | Overrides the (default) Helm URL generation based on the ingress/service values. | Not set |
| `extraVolumeMounts` | Array of additional volume mounts. | `[]` |
| `extraVolumes` | Array of additional volumes. | `[]` |
| `env` | Additional environment variables passed to the wopiserver container. | `[]` |
| `config.wopisecret` | Wopi-Secret, stored in `/etc/wopi/wopisecret` | `nil` - generates a random secret (`randAlphaNum 24`) |
| `config.iopsecret` | IOP-Shared-Secret, stored in `/etc/wopi/iopsecret` | `nil` - generates a random secret (`randAlphaNum 24`) |
| `config.appProviders` | Freeform `<app-provider>: <url>` (`oosurl`, `codeurl`, `slidesurl` or `codimdurl` as app-providers) | `{codimdurl: http://codimd.local}` |
| `config.cs3.revahost` | The GRPC endpoint of the REVA service. | `revad:19000` |
| `config.loglevel` | Logging fequency. Values, in order of severity: `Critical`, `Error`, `Warning`, `Info` `Debug`. | `Debug` |
| `ingress.enabled` | Whether to create an Ingress resource to access the wopiserver. | `false` |
| `ingress.hostname` | The ingress hostname. | `wopi.local` |
| `ingress.path` | The ingress path. | `/wopi` |
| `ingress.annotations` | Ingress annotations. | `{}` |
| `ingress.tls` | Ingress TLS configuration (YAML). | `[]` |

## WOPI Bridge Configuration

| Parameter | Description | Default |
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `wopibridge.enabled` | Wheter to deploy the [WOPI Bridge](https://github.com/cs3org/wopibridge) service. | `false` |
| `wopibridge.name` | The name used to identify the resources as `{{ wopiserver.fullname }}-{{ .name }}`. | `wopibridge` |
| `wopibridge.replicaCount` | How many replicas to run. | `1` |
| `wopibridge.image.repository` | Name of the image to run, without the tag. | [`cs3org/wopibridge`](https://hub.docker.com/r/cs3org/wopibridge) |
| `wopibridge.image.tag` | The image tag to use. | `latest` |
| `wopibridge.image.pullPolicy` | The kubernetes image pull policy. | `Always` |
| `wopibridge.service.type` | The kubernetes service type to use. | `ClusterIP` |
| `wopibridge.service.port` | The wopibridge service HTTP port. | `8000` |
| `wopibridge.bridgeUrl` | Overrides the (default) Helm URL generation based on the ingress/service values. | Not set |
| `wopibridge.extraVolumeMounts` | Array of additional volume mounts. | `[]` |
| `wopibridge.extraVolumes` | Array of additional volumes. | `[]` |
| `wopibridge.env` | Additional environment variables passed to the wopibridge container. | `[]` |
| `wopibridge.ingress.enabled` | Whether to create an Ingress resource to access the wopibridge. | `false` |
| `wopibridge.ingress.hostname` | The ingress hostname. | `bridge.local` |
| `wopibridge.ingress.path` | The ingress path. | `/wopibridge` |
| `wopibridge.ingress.annotations` | Ingress annotations. | `{}` |
| `wopibridge.ingress.tls` | Ingress TLS configuration (YAML). | `[]` |
50 changes: 44 additions & 6 deletions wopiserver/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{- define "wopibridge.labels" -}}
helm.sh/chart: {{ include "wopiserver.chart" . }}
{{ include "wopibridge.selectorLabels" . }}
app.kubernetes.io/version: {{ .Values.wopibridge.image.tag | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Selector labels
*/}}
Expand All @@ -51,13 +58,44 @@ app.kubernetes.io/name: {{ include "wopiserver.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{- define "wopibridge.selectorLabels" -}}
app.kubernetes.io/name: {{ include "wopiserver.name" . }}-{{ .Values.wopibridge.name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}

{{/*
Create the name of the service account to use
Returns the WOPI Server external URL
*/}}
{{- define "wopiserver.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "wopiserver.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- define "wopiserver.url" -}}
{{- if .Values.wopiserverUrl -}}
{{- .Values.wopiserverUrl }}
{{- else }}
{{- if .Values.ingress.hostname -}}
{{- if .Values.ingress.tls -}}
https://{{ .Values.ingress.hostname }}
{{- else -}}
http://{{ .Values.ingress.hostname }}
{{- end -}}
{{- else -}}
http://{{ template "wopiserver.fullname" . }}:{{ .Values.service.port }}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "wopibridge.url" -}}
{{- with .Values.wopibridge -}}
{{- if .bridgeUrl -}}
{{- .bridgeUrl }}
{{- else -}}
{{- if .ingress.hostname -}}
{{- if .ingress.tls -}}
https://{{ .ingress.hostname }}{{ .ingress.path }}
{{- else -}}
http://{{ .ingress.hostname }}{{ .ingress.path }}
{{- end -}}
{{- else -}}
http://{{ template "wopiserver.fullname" $ }}-{{ .name }}:{{ .service.port }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
11 changes: 3 additions & 8 deletions wopiserver/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ data:

tokenvalidity = 86400

{{- if .Values.ingress.enabled }}
wopiurl = http://{{ .Values.ingress.hostname }}
downloadurl = http://{{ .Values.ingress.hostname }}/wopi/cbox/download
{{- else }}
wopiurl = http://{{ include "wopiserver.fullname" . }}
downloadurl = http://{{ include "wopiserver.fullname" . }}/wopi/cbox/download
{{- end }}
wopiurl = {{ template "wopiserver.url" . }}
downloadurl = {{ template "wopiserver.url" . }}/wopi/cbox/download

loglevel = Debug
loglevel = {{ .Values.config.loglevel }}

[security]
usehttps = no
Expand Down
53 changes: 53 additions & 0 deletions wopiserver/templates/wopibridge/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{- with .Values.wopibridge }}
{{- if .enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "wopiserver.fullname" $ }}-{{ .name }}
labels:
{{- include "wopibridge.labels" $ | nindent 4 }}
spec:
replicas: {{ .replicaCount }}
selector:
matchLabels:
{{- include "wopibridge.selectorLabels" $ | nindent 6 }}
template:
metadata:
labels:
{{- include "wopibridge.selectorLabels" $ | nindent 8 }}
spec:
containers:
- name: {{ .name }}
image: "{{ .image.repository }}:{{ .image.tag }}"
imagePullPolicy: {{ .image.pullPolicy }}
ports:
- name: http
containerPort: 8000
protocol: TCP
{{- if .extraVolumeMounts }}
volumeMounts:
{{- toYaml .extraVolumeMounts | nindent 12 }}
{{- end }}
env:
- name: "WOPIBRIDGE_URL"
value: {{ template "wopibridge.url" $ }}
{{- if .env }}
{{- range $name, $value := .env }}
- name: "{{ $name }}"
value: "{{ $value }}"
{{- end }}
{{- end }}
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
{{- if .extraVolumes }}
volumes:
{{- toYaml .extraVolumes | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
28 changes: 28 additions & 0 deletions wopiserver/templates/wopibridge/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- with .Values.wopibridge }}
{{- if and .enabled .ingress.enabled }}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ template "wopiserver.fullname" $ }}-{{ .name }}
labels: {{- include "wopibridge.labels" $ | nindent 4 }}
annotations:
{{- if .ingress.annotations }}
{{ toYaml .ingress.annotations | indent 4 }}
{{- end }}
spec:
rules:
{{- if .ingress.hostname }}
- host: {{ .ingress.hostname }}
http:
paths:
- path: {{ .ingress.path }}
backend:
serviceName: {{ template "wopiserver.fullname" $ }}-{{ .name }}
servicePort: http
{{- end }}
{{- if .ingress.tls }}
tls:
{{- toYaml .ingress.tls | indent 4 }}
{{- end }}
{{- end }}
{{- end }}
19 changes: 19 additions & 0 deletions wopiserver/templates/wopibridge/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- with .Values.wopibridge }}
{{- if .enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "wopiserver.fullname" $ }}-{{ .name }}
labels:
{{- include "wopibridge.labels" $ | nindent 4 }}
spec:
type: {{ .service.type }}
ports:
- port: {{ .service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "wopibridge.selectorLabels" $ | nindent 4 }}
{{- end }}
{{- end }}
49 changes: 48 additions & 1 deletion wopiserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ service:
type: ClusterIP
port: 8880

## Overrides the default URL generation based on the ingress/service values
# wopiserverUrl: https://wopi.local/

extraVolumeMounts: []
extraVolumes: []

Expand All @@ -18,9 +21,10 @@ env: []
# - ref: https://github.com/cs3org/wopiserver/blob/master/wopiserver.conf
config:
appProviders:
codimdurl: http://codimd.local
codimdurl: http://wopibridge:8000
cs3:
revahost: revad:19000
loglevel: Debug

ingress:
enabled: false
Expand All @@ -34,3 +38,46 @@ ingress:
# - secretName: wopi-tls
# hosts:
# - wopi.local

wopibridge:
enabled: false
name: wopibridge
replicaCount: 1
image:
repository: cs3org/wopibridge
tag: latest
pullPolicy: Always

service:
type: ClusterIP
port: 8000

## Overrides the default URL generation based on the ingress/service values
# bridgeUrl: https://bridge.local/wopibridge

extraVolumes: []
# - name: image-store
# persistentVolumeClaim:
# claimName: image-store

extraVolumeMounts: []
# - name: image-store
# mountPath: /mnt/codimd_storage

env: []
# CODIMD_INT_URL: http://codimd
# CODIMD_EXT_URL: https://codimd.local/path
# CODIMD_STORAGE_PATH: /mnt/codimd_storage

ingress:
enabled: false
hostname: bridge.local
path: /wopibridge
annotations: {}
# kubernetes.io/ingress.class: nginx
# nginx.ingress.kubernetes.io/ssl-redirect: "true"
tls: []
# Secrets must be present in the namespace beforehand.
# - secretName: bridge-tls
# hosts:
# - wopi.local

0 comments on commit d8c1c33

Please sign in to comment.