adapt owncloud helm chart from mumme-it/owncloud

This commit is contained in:
2025-01-14 20:13:16 +01:00
parent c3e37f9eac
commit 9961132e7b
18 changed files with 360 additions and 225 deletions

View File

@ -2,7 +2,7 @@
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
@ -16,27 +16,6 @@
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 "owncloud.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
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
2. Initial login credentials:
Username: {{ .Values.admin.username }}
Password: [stored in secret {{ .Values.admin.existingSecret }}]
3. Database configuration:
{{- if .Values.database.external.enabled }}
Using external database at {{ .Values.database.external.host }}:{{ .Values.database.external.port }}
Database: {{ .Values.database.external.database }}
Username: {{ .Values.database.external.username }}
Password: [stored in secret {{ .Values.database.external.existingSecret }}]
{{- else }}
Using internal database
{{- end }}
4. Persistence information:
Data directory: {{ .Values.persistence.mountPath }}
For more information about OwnCloud configuration, please refer to:
https://doc.owncloud.com/server/admin_manual/configuration/

View File

@ -5,12 +5,18 @@ metadata:
labels:
{{- include "owncloud.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "owncloud.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "owncloud.selectorLabels" . | nindent 8 }}
spec:
@ -18,84 +24,92 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "owncloud.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: TZ
value: {{ .Values.env.TZ | quote }}
- name: OWNCLOUD_DOMAIN
value: {{ .Values.env.OWNCLOUD_DOMAIN | quote }}
- name: OWNCLOUD_TRUSTED_DOMAINS
value: {{ .Values.env.OWNCLOUD_TRUSTED_DOMAINS | quote }}
- name: OWNCLOUD_DB_TYPE
value: {{ .Values.database.type | quote }}
{{- if .Values.database.external.enabled }}
- name: OWNCLOUD_DB_HOST
value: {{ .Values.database.external.host | quote }}
- name: OWNCLOUD_DB_PORT
value: {{ .Values.database.external.port | quote }}
- name: OWNCLOUD_DB_NAME
value: {{ .Values.database.external.database | quote }}
- name: OWNCLOUD_DB_USERNAME
value: {{ .Values.database.external.username | quote }}
- name: OWNCLOUD_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.database.external.existingSecret }}
key: {{ .Values.database.external.existingSecretKey }}
{{- end }}
- name: OWNCLOUD_ADMIN_USERNAME
value: {{ .Values.admin.username | quote }}
- name: OWNCLOUD_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.admin.existingSecret }}
key: {{ .Values.admin.existingSecretKey }}
- name: OWNCLOUD_REDIS_ENABLED
value: {{ .Values.env.OWNCLOUD_REDIS_ENABLED | quote }}
- name: PHP_MEMORY_LIMIT
value: {{ .Values.env.PHP_MEMORY_LIMIT | quote }}
- name: PHP_UPLOAD_LIMIT
value: {{ .Values.env.PHP_UPLOAD_LIMIT | quote }}
- name: OWNCLOUD_DOMAIN
value: {{ .Values.owncloudDomain | quote }}
- name: OWNCLOUD_ADMIN_USERNAME
value: {{ .Values.owncloud.username | quote }}
- name: OWNCLOUD_ADMIN_PASSWORD
value: {{ .Values.owncloud.password | quote }}
- name: OWNCLOUD_INTEGRITY_CHECK_DISABLED
value: {{ .Values.owncloud.integrity.disabled | quote }}
- name: OWNCLOUD_UPDATE_CHECKER
value: {{ .Values.owncloud.updatecheck | quote }}
{{- if .Values.mariadb.enabled }}
- name: MARIADB_HOST
value: {{ template "owncloud.mariadb.fullname" . }}
- name: MARIADB_PORT_NUMBER
value: "3306"
- name: OWNCLOUD_DATABASE_NAME
value: {{ .Values.mariadb.db.name | quote }}
- name: OWNCLOUD_DATABASE_USER
value: {{ .Values.mariadb.db.user | quote }}
- name: OWNCLOUD_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "owncloud.mariadb.fullname" . }}
key: mariadb-password
{{- else }}
- name: OWNCLOUD_DB_TYPE
value: {{ .Values.externalDatabase.type | quote }}
- name: OWNCLOUD_DB_HOST
value: {{ .Values.externalDatabase.host | quote }}
- name: OWNCLOUD_DATABASE_PORT_NUMBER
value: {{ .Values.externalDatabase.port | quote }}
- name: OWNCLOUD_DB_NAME
value: {{ .Values.externalDatabase.name | quote }}
- name: OWNCLOUD_DB_USERNAME
value: {{ .Values.externalDatabase.user | quote }}
- name: OWNCLOUD_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" .Release.Name "externaldb" }}
key: db-password
{{- end }}
{{- if .Values.redis.enabled }}
- name: OWNCLOUD_REDIS_ENABLED
value: true
- name: OWNCLOUD_REDIS_HOST
value: {{ .Values.redis.host | quote }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
containerPort: 8080
protocol: TCP
volumeMounts:
- name: owncloud-data
mountPath: {{ .Values.persistence.mountPath }}
livenessProbe:
httpGet:
path: /status.php
port: http
initialDelaySeconds: 30
periodSeconds: 10
httpHeaders:
- name: Host
value: {{ .Values.owncloud.domain | quote }}
initialDelaySeconds: 120
timeoutSeconds: 5
failureThreshold: 6
readinessProbe:
httpGet:
path: /status.php
port: http
httpHeaders:
- name: Host
value: {{ .Values.owncloud.domain | quote }}
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 3
periodSeconds: 5
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: owncloud-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
{{- if .Values.persistence.existingClaim }}
claimName: {{ .Values.persistence.existingClaim }}
{{- else }}
claimName: {{ include "owncloud.fullname" . }}-data
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
volumeMounts:
- name: owncloud-data
mountPath: /mnt/data
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
@ -108,3 +122,7 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: owncloud-data
persistentVolumeClaim:
claimName: {{ include "owncloud.fullname" . }}

View File

@ -0,0 +1,28 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "owncloud.fullname" . }}
labels:
{{- include "owncloud.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "owncloud.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}

View File

@ -1,20 +1,20 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "owncloud.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1
{{- 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 "owncloud.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
cert-manager.io/cluster-issuer: letsencrypt
nginx.ingress.kubernetes.io/proxy-body-size: 1000m
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
@ -31,13 +31,10 @@ spec:
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: {{ .pathType }}
- path: {{ . }}
backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -1,17 +1,28 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
{{- if .Values.persistence.owncloud.nfs.enabled -}}
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ include "owncloud.fullname" . }}
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 100Gi
nfs:
server: {{ .Values.persistence.owncloud.nfs.server }}
path: {{ .Values.persistence.owncloud.nfs.path }}
{{end}}
---
{{- if .Values.persistence.enabled -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "owncloud.fullname" . }}-data
labels:
{{- include "owncloud.labels" . | nindent 4 }}
name: {{ include "owncloud.fullname" . }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass | quote }}
{{- end }}
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}
storage: 100Gi
storageClassName: standard
{{- end -}}

View File

@ -0,0 +1,14 @@
{{- if not .Values.mariadb.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-%s" .Release.Name "externaldb" }}
labels:
app: {{ printf "%s-%s" .Release.Name "externaldb" }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
type: Opaque
data:
db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }}
{{- end }}

View File

@ -8,11 +8,8 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
targetPort: 8080
protocol: TCP
name: http
{{- if and (eq .Values.service.type "NodePort") .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
selector:
{{- include "owncloud.selectorLabels" . | nindent 4 }}

View File

@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "owncloud.serviceAccountName" . }}
labels:
{{- include "owncloud.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,13 @@
{{- if .Values.persistence.enabled -}}
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ include "owncloud.fullname" . }}
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-standard
reclaimPolicy: Retain
allowVolumeExpansion: true
mountOptions:
- debug
{{- end -}}

View File

@ -1,15 +0,0 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "owncloud.fullname" . }}-test-connection"
labels:
{{- include "owncloud.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "owncloud.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never