diff --git a/wopiserver/Chart.yaml b/wopiserver/Chart.yaml index f66c297..318038a 100644 --- a/wopiserver/Chart.yaml +++ b/wopiserver/Chart.yaml @@ -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 diff --git a/wopiserver/README.md b/wopiserver/README.md index f50f5cb..4089d22 100644 --- a/wopiserver/README.md +++ b/wopiserver/README.md @@ -34,6 +34,7 @@ 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. | `[]` | @@ -41,8 +42,31 @@ The following configurations may be set. It is recommended to use `values.yaml` | `config.iopsecret` | IOP-Shared-Secret, stored in `/etc/wopi/iopsecret` | `nil` - generates a random secret (`randAlphaNum 24`) | | `config.appProviders` | Freeform `: ` (`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). | `[]` | diff --git a/wopiserver/templates/_helpers.tpl b/wopiserver/templates/_helpers.tpl index 2f3bad5..deb9fe6 100644 --- a/wopiserver/templates/_helpers.tpl +++ b/wopiserver/templates/_helpers.tpl @@ -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 */}} @@ -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 -}} diff --git a/wopiserver/templates/configmap.yaml b/wopiserver/templates/configmap.yaml index e8ccd5a..3bf6b87 100644 --- a/wopiserver/templates/configmap.yaml +++ b/wopiserver/templates/configmap.yaml @@ -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 diff --git a/wopiserver/templates/wopibridge/deployment.yaml b/wopiserver/templates/wopibridge/deployment.yaml new file mode 100644 index 0000000..7b29aac --- /dev/null +++ b/wopiserver/templates/wopibridge/deployment.yaml @@ -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 }} diff --git a/wopiserver/templates/wopibridge/ingress.yaml b/wopiserver/templates/wopibridge/ingress.yaml new file mode 100644 index 0000000..73eb095 --- /dev/null +++ b/wopiserver/templates/wopibridge/ingress.yaml @@ -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 }} diff --git a/wopiserver/templates/wopibridge/service.yaml b/wopiserver/templates/wopibridge/service.yaml new file mode 100644 index 0000000..829b905 --- /dev/null +++ b/wopiserver/templates/wopibridge/service.yaml @@ -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 }} diff --git a/wopiserver/values.yaml b/wopiserver/values.yaml index ba9d40a..c6e4fb8 100644 --- a/wopiserver/values.yaml +++ b/wopiserver/values.yaml @@ -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: [] @@ -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 @@ -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