-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nextcloud): add support of imaginary an externalPreviewProvider #…
- Loading branch information
Showing
11 changed files
with
346 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: test-nextcloud | ||
namespace: nextcloud | ||
spec: | ||
template: | ||
metadata: | ||
name: test-nextcloud | ||
spec: | ||
initContainers: | ||
- name: 05-create-nextcloud-file | ||
image: curlimages/curl | ||
command: | ||
- /bin/sh | ||
- -c | ||
- | | ||
set -e | ||
echo "download image:" | ||
curl -s "https://upload.wikimedia.org/wikipedia/commons/d/df/Open_data.png" -o test_upload.png | ||
echo "upload to nextcloud:" | ||
curl \ | ||
-s \ | ||
-w "%{http_code}" \ | ||
-u admin:changeme \ | ||
-T test_upload.png \ | ||
"http://nextcloud.nextcloud.svc.cluster.local:8080/remote.php/dav/files/admin/test_upload.png" || exit 1; | ||
echo "done" | ||
- name: 10-generate-preview | ||
image: docker.io/library/nextcloud:latest | ||
command: | ||
- /bin/sh | ||
- -c | ||
- | | ||
set -e | ||
echo "fetch preview:" | ||
OUTPUT=$(curl \ | ||
-s \ | ||
-w "%{http_code}" \ | ||
-u admin:changeme \ | ||
"http://nextcloud.nextcloud.svc.cluster.local:8080/index.php/core/preview.png?file=test_upload.png&x=128&y=128&mimeFallback=true&a=0" \ | ||
-o - | file -) | ||
echo "${OUTPUT}"; | ||
if ! echo "${OUTPUT}" | grep -q "PNG"; then | ||
echo "PNG was not detected" | ||
exit 1; | ||
fi | ||
if ! echo "${OUTPUT}" | grep -q "256 x 256"; then | ||
echo "Image size is incorrect" | ||
exit 1; | ||
fi | ||
echo "done" | ||
containers: | ||
- name: final | ||
image: curlimages/curl | ||
command: | ||
- /bin/sh | ||
- -c | ||
- | | ||
set -e | ||
echo "All tests run successfull (initContainer in given order)" | ||
restartPolicy: Never |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
charts/nextcloud/files/defaultConfigs/imaginary.config.php.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
$CONFIG = array ( | ||
'preview_imaginary_url' => 'http://{{ template "nextcloud.fullname" . }}-imaginary', | ||
'enable_previews' => true, | ||
'enabledPreviewProviders' => array ( | ||
'OC\Preview\Imaginary', | ||
'OC\Preview\ImaginaryPDF', | ||
/* | ||
defaults: | ||
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#enabledpreviewproviders | ||
*/ | ||
'OC\Preview\BMP', | ||
// 'OC\Preview\GIF', | ||
// 'OC\Preview\JPEG', | ||
'OC\Preview\Krita', | ||
'OC\Preview\MarkDown', | ||
'OC\Preview\MP3', | ||
'OC\Preview\OpenDocument', | ||
// 'OC\Preview\PNG', | ||
'OC\Preview\TXT', | ||
'OC\Preview\XBitmap', | ||
), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{{- if .Values.imaginary.enabled }} | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "nextcloud.fullname" . }}-imaginary | ||
labels: | ||
app.kubernetes.io/name: {{ include "nextcloud.name" . }} | ||
helm.sh/chart: {{ include "nextcloud.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/component: imaginary | ||
spec: | ||
replicas: {{ .Values.imaginary.replicaCount }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ include "nextcloud.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: imaginary | ||
template: | ||
metadata: | ||
annotations: | ||
{{- toYaml .Values.imaginary.podAnnotations | nindent 8 }} | ||
labels: | ||
app.kubernetes.io/name: {{ include "nextcloud.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: imaginary | ||
{{- with .Values.imaginary.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
{{- with .Values.imaginary.image.pullSecrets }} | ||
imagePullSecrets: | ||
{{- range . }} | ||
- name: {{ . }} | ||
{{- end}} | ||
{{- end }} | ||
containers: | ||
- name: imaginary | ||
{{- with .Values.imaginary.image }} | ||
image: "{{ .registry }}/{{ .repository }}:{{ .tag }}" | ||
imagePullPolicy: {{ .pullPolicy }} | ||
{{- end }} | ||
env: | ||
- name: PORT | ||
value: "9000" | ||
ports: | ||
- name: http | ||
containerPort: 9000 | ||
{{- with .Values.imaginary.readinessProbe }} | ||
{{- if .enabled }} | ||
readinessProbe: | ||
httpGet: | ||
path: /health | ||
port: http | ||
scheme: HTTP | ||
failureThreshold: {{ .failureThreshold }} | ||
successThreshold: {{ .successThreshold }} | ||
periodSeconds: {{ .periodSeconds }} | ||
timeoutSeconds: {{ .timeoutSeconds }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Values.imaginary.livenessProbe }} | ||
{{- if .enabled }} | ||
livenessProbe: | ||
httpGet: | ||
path: /health | ||
port: http | ||
scheme: HTTP | ||
failureThreshold: {{ .failureThreshold }} | ||
successThreshold: {{ .successThreshold }} | ||
periodSeconds: {{ .periodSeconds }} | ||
timeoutSeconds: {{ .timeoutSeconds }} | ||
{{- end }} | ||
{{- end }} | ||
{{- with .Values.imaginary.resources }} | ||
resources: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.imaginary.securityContext }} | ||
securityContext: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.imaginary.podSecurityContext }} | ||
securityContext: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{{- if .Values.imaginary.enabled }} | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "nextcloud.fullname" . }}-imaginary | ||
labels: | ||
app.kubernetes.io/name: {{ include "nextcloud.name" . }} | ||
helm.sh/chart: {{ include "nextcloud.chart" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/component: imaginary | ||
{{- with .Values.imaginary.service.labels }} | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- with .Values.imaginary.service.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
type: {{ .Values.imaginary.service.type }} | ||
{{- with .Values.imaginary.service.loadBalancerIP }} | ||
loadBalancerIP: {{ . }} | ||
{{- end }} | ||
ports: | ||
- name: http | ||
port: 80 | ||
targetPort: http | ||
{{- with .Values.imaginary.service.nodePort }} | ||
nodePort: {{ . }} | ||
{{- end }} | ||
selector: | ||
app.kubernetes.io/name: {{ include "nextcloud.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: imaginary | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
fullnameOverride: nextcloud | ||
|
||
nextcloud: | ||
host: nextcloud | ||
trustedDomains: | ||
- 'nextcloud.nextcloud.svc.cluster.local' | ||
- 'nextcloud' | ||
defaultConfigs: | ||
imaginary.config.php: true | ||
|
||
imaginary: | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.