'add-seafile'
This commit is contained in:
20
seafile/templates/NOTES.txt
Normal file
20
seafile/templates/NOTES.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- with .Values.ingress }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .host }}/
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "seafile.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "seafile.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "seafile.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "seafile.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
||||
62
seafile/templates/_helpers.tpl
Normal file
62
seafile/templates/_helpers.tpl
Normal file
@@ -0,0 +1,62 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "seafile.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "seafile.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "seafile.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "seafile.labels" -}}
|
||||
helm.sh/chart: {{ include "seafile.chart" . }}
|
||||
{{ include "seafile.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "seafile.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "seafile.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "seafile.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "seafile.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
54
seafile/templates/configmap.yaml
Normal file
54
seafile/templates/configmap.yaml
Normal file
@@ -0,0 +1,54 @@
|
||||
{{- if .Values.onlyoffice.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: netdisc-config
|
||||
data:
|
||||
seahub_settings.py: |
|
||||
ENABLE_ONLYOFFICE = True
|
||||
VERIFY_ONLYOFFICE_CERTIFICATE = False
|
||||
ONLYOFFICE_APIJS_URL = '/onlyofficeds/web-apps/apps/api/documents/api.js'
|
||||
ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx','odt', 'fodt', 'odp', 'fodp', 'ods', 'fods')
|
||||
ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')
|
||||
ONLYOFFICE_JWT_SECRET = '{{.Values.onlyoffice.token}}'
|
||||
CSRF_TRUSTED_ORIGINS = ["https://{{ .Values.ingress.host }}"]
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: nginx-config
|
||||
data:
|
||||
nginx.config: |
|
||||
# 将以下内容放入 /shared/nginx/conf/seafile.nginx.conf 顶部
|
||||
upstream docservice {
|
||||
server onlyoffice;
|
||||
}
|
||||
map $http_x_forwarded_proto $the_scheme {
|
||||
default $http_x_forwarded_proto;
|
||||
"" $scheme;
|
||||
}
|
||||
|
||||
map $http_x_forwarded_host $the_host {
|
||||
default $http_x_forwarded_host;
|
||||
"" $host;
|
||||
}
|
||||
|
||||
map $http_upgrade $proxy_connection {
|
||||
default upgrade;
|
||||
"" close;
|
||||
}
|
||||
|
||||
# 将以下内容放入/shared/nginx/conf/seafile.nginx.conf中的 server{} 块中
|
||||
location /onlyofficeds/ {
|
||||
proxy_pass http://onlyoffice/;
|
||||
proxy_http_version 1.1;
|
||||
client_max_body_size 100M;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_connect_timeout 3600s;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $proxy_connection;
|
||||
proxy_set_header X-Forwarded-Host $the_host/onlyofficeds;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
{{- end }}
|
||||
76
seafile/templates/deployment.yaml
Normal file
76
seafile/templates/deployment.yaml
Normal file
@@ -0,0 +1,76 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "seafile.fullname" . }}
|
||||
labels:
|
||||
{{- include "seafile.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "seafile.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "seafile.labels" . | nindent 8 }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "seafile.serviceAccountName" . }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
env:
|
||||
{{- printf "- name: DB_HOST" | nindent 12 -}}
|
||||
{{- if .Values.mariadb.enabled }}
|
||||
{{- printf "value: %s-%s" $.Release.Name "mariadb" | nindent 14 -}}
|
||||
{{- else }}
|
||||
{{- printf "value: %s" .Values.mariadb.serviceDomainName | nindent 14 -}}
|
||||
{{- end }}
|
||||
{{- toYaml .Values.env | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
tcpSocket:
|
||||
port: 80
|
||||
timeoutSeconds: 1
|
||||
initialDelaySeconds: 50
|
||||
readinessProbe:
|
||||
failureThreshold: 3
|
||||
periodSeconds: 30
|
||||
successThreshold: 1
|
||||
tcpSocket:
|
||||
port: 80
|
||||
timeoutSeconds: 1
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: "/shared"
|
||||
readOnly: false
|
||||
{{- if .Values.onlyoffice.enabled }}
|
||||
- mountPath: /opt/custom/seahub_settings.py
|
||||
name: netdisc-config
|
||||
subPath: seahub_settings.py
|
||||
- mountPath: /opt/custom/nginx.config
|
||||
name: nginx-config
|
||||
subPath: nginx.config
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: seafile-data
|
||||
{{- if .Values.onlyoffice.enabled }}
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: netdisc-config
|
||||
name: netdisc-config
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: nginx-config
|
||||
name: nginx-config
|
||||
{{- end }}
|
||||
7
seafile/templates/incloude.yaml
Normal file
7
seafile/templates/incloude.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
{{- include "onlyoffice.service" . -}}
|
||||
{{- include "onlyoffice.configmap" . -}}
|
||||
{{- include "onlyoffice.deployment" . -}}
|
||||
{{- if .Values.memcached.enabled }}
|
||||
{{- include "memcached.service" . -}}
|
||||
{{- include "memcached.deployment" . -}}
|
||||
{{- end }}
|
||||
42
seafile/templates/ingress.yaml
Normal file
42
seafile/templates/ingress.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "seafile.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
|
||||
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
|
||||
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
{{- else -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
{{- end }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "seafile.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/frontend-entry-points: http,https
|
||||
traefik.ingress.kubernetes.io/router.middlewares: {{ $.Release.Namespace }}-redirect-https@kubernetescrd
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- {{ .Values.ingress.host }}
|
||||
secretName: {{ .Values.ingress.tls.secretName }}
|
||||
rules:
|
||||
{{- with .Values.ingress }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
backend:
|
||||
service:
|
||||
name: {{ $fullName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
16
seafile/templates/longhorn.yaml
Normal file
16
seafile/templates/longhorn.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: longhorn-retain
|
||||
annotations:
|
||||
storageclass.kubernetes.io/is-default-class: "false"
|
||||
provisioner: driver.longhorn.io
|
||||
allowVolumeExpansion: true
|
||||
reclaimPolicy: "Retain"
|
||||
volumeBindingMode: Immediate
|
||||
parameters:
|
||||
numberOfReplicas: "3"
|
||||
staleReplicaTimeout: "30"
|
||||
fromBackup: ""
|
||||
fsType: "ext4"
|
||||
dataLocality: "disabled"
|
||||
28
seafile/templates/memcache/deployment.yaml
Normal file
28
seafile/templates/memcache/deployment.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
{{- define "memcached.deployment" -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: memcached
|
||||
name: seafile-memcached
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: memcached
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: memcached
|
||||
spec:
|
||||
containers:
|
||||
- command:
|
||||
- memcached
|
||||
- -m
|
||||
- "256"
|
||||
image: {{ .Values.memcached.image }}
|
||||
name: seafile-memcached
|
||||
imagePullPolicy: {{ .Values.memcached.imagePullPolicy }}
|
||||
restartPolicy: Always
|
||||
{{ end -}}
|
||||
17
seafile/templates/memcache/service.yaml
Normal file
17
seafile/templates/memcache/service.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
{{- define "memcached.service" -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: memcached
|
||||
name: memcached
|
||||
spec:
|
||||
ports:
|
||||
- name: "11211"
|
||||
port: 11211
|
||||
targetPort: 11211
|
||||
selector:
|
||||
app: memcached
|
||||
type: ClusterIP
|
||||
{{ end -}}
|
||||
11
seafile/templates/onlyoffice/configmap.yaml
Normal file
11
seafile/templates/onlyoffice/configmap.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- define "onlyoffice.configmap" }}
|
||||
{{- if .Values.onlyoffice.enabled -}}
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
postgresql.conf: huge_pages = off
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: onlyoffice-postgresql
|
||||
{{- end }}
|
||||
{{ end -}}
|
||||
46
seafile/templates/onlyoffice/deployment.yaml
Normal file
46
seafile/templates/onlyoffice/deployment.yaml
Normal file
@@ -0,0 +1,46 @@
|
||||
{{- define "onlyoffice.deployment" -}}
|
||||
{{- if .Values.onlyoffice.enabled }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: onlyoffice
|
||||
name: onlyoffice
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: onlyoffice
|
||||
replicas: 1
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: onlyoffice
|
||||
spec:
|
||||
containers:
|
||||
- name: onlyoffice
|
||||
image: {{ .Values.onlyoffice.image }}
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: JWT_SECRET
|
||||
value: {{ .Values.onlyoffice.token }}
|
||||
- name: JWT_ENABLED
|
||||
value: 'true'
|
||||
- name: USE_UNAUTHORIZED_STORAGE
|
||||
value: 'true'
|
||||
volumeMounts:
|
||||
- mountPath: /etc/postgresql/14/main/conf.d/postgresql.conf
|
||||
name: postgresql-conf
|
||||
subPath: postgresql.conf
|
||||
volumes:
|
||||
- configMap:
|
||||
defaultMode: 420
|
||||
name: onlyoffice-postgresql
|
||||
name: postgresql-conf
|
||||
{{- end }}
|
||||
{{ end -}}
|
||||
17
seafile/templates/onlyoffice/service.yaml
Normal file
17
seafile/templates/onlyoffice/service.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
{{- define "onlyoffice.service" -}}
|
||||
{{- if .Values.onlyoffice.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: onlyoffice
|
||||
spec:
|
||||
ports:
|
||||
- name: onlyoffice
|
||||
port: 80
|
||||
protocol: TCP
|
||||
targetPort: 80
|
||||
selector:
|
||||
app: onlyoffice
|
||||
type: ClusterIP
|
||||
{{- end }}
|
||||
{{ end -}}
|
||||
12
seafile/templates/pvc.yaml
Normal file
12
seafile/templates/pvc.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: seafile-data
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{.Values.persistence.seafile.size}}
|
||||
storageClassName: {{.Values.persistence.seafile.storageClass}}
|
||||
volumeMode: Filesystem
|
||||
15
seafile/templates/service.yaml
Normal file
15
seafile/templates/service.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "seafile.fullname" . }}
|
||||
labels:
|
||||
{{- include "seafile.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
{{- include "seafile.selectorLabels" . | nindent 4 }}
|
||||
13
seafile/templates/serviceaccount.yaml
Normal file
13
seafile/templates/serviceaccount.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "seafile.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "seafile.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
|
||||
{{- end }}
|
||||
8
seafile/templates/treafik.yaml
Normal file
8
seafile/templates/treafik.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: traefik.containo.us/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: redirect-https
|
||||
spec:
|
||||
redirectScheme:
|
||||
permanent: true
|
||||
scheme: https
|
||||
Reference in New Issue
Block a user