add nextcloud chart as forked, add gitignore

This commit is contained in:
2024-12-06 17:09:31 +01:00
commit 3f17c9fddd
41 changed files with 4075 additions and 0 deletions

View File

@@ -0,0 +1,94 @@
{{- if or .Values.mariadb.enabled .Values.externalDatabase.host -}}
{{- if empty .Values.nextcloud.host -}}
#################################################################################
### WARNING: You did not provide an external host in your 'helm install' call ###
#################################################################################
This deployment will be incomplete until you configure nextcloud with a resolvable
host. To configure nextcloud with the URL of your service:
1. Get the nextcloud URL by running:
{{- if contains "NodePort" .Values.service.type }}
export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}")
export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "nextcloud.fullname" . }}'
export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode)
{{- if .Values.mariadb.db.password }}
export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.mariadb.fullname" . }} -o jsonpath="{.data.mariadb-password}" | base64 --decode)
{{- end }}
{{- end }}
2. Complete your nextcloud deployment by running:
{{- if .Values.mariadb.enabled }}
helm upgrade {{ .Release.Name }} nextcloud/nextcloud \
--set nextcloud.host=$APP_HOST,nextcloud.password=$APP_PASSWORD{{ if .Values.mariadb.db.password }},mariadb.db.password=$APP_DATABASE_PASSWORD{{ end }}
{{- else }}
## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ##
helm upgrade {{ .Release.Name }} nextcloud/nextcloud \
--set nextcloud.password=$APP_PASSWORD,nextcloud.host=$APP_HOST,service.type={{ .Values.service.type }},mariadb.enabled=false{{- if not (empty .Values.externalDatabase.host) }},externalDatabase.host={{ .Values.externalDatabase.host }}{{- end }}{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }}
{{- end }}
{{- else -}}
1. Get the nextcloud URL by running:
{{- if eq .Values.service.type "ClusterIP" }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ template "nextcloud.name" . }}" -o jsonpath="{.items[0].metadata.name}")
echo http://127.0.0.1:8080/
kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME 8080:80
{{- else }}
echo http://{{ .Values.nextcloud.host }}/
{{- end }}
2. Get your nextcloud login credentials by running:
echo User: {{ .Values.nextcloud.username }}
echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode)
{{- end }}
{{- else -}}
#######################################################################################################
## WARNING: You did not provide an external database host in your 'helm install' call ##
## Running Nextcloud with the integrated sqlite database is not recommended for production instances ##
#######################################################################################################
For better performance etc. you have to configure nextcloud with a resolvable database
host. To configure nextcloud to use and external database host:
1. Complete your nextcloud deployment by running:
{{- if contains "NodePort" .Values.service.type }}
export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "nextcloud.fullname" . }}'
export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
{{- else }}
export APP_HOST=127.0.0.1
{{- end }}
export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "nextcloud.fullname" . }} -o jsonpath="{.data.nextcloud-password}" | base64 --decode)
## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ##
helm upgrade {{ .Release.Name }} nextcloud/nextcloud \
--set nextcloud.password=$APP_PASSWORD,nextcloud.host=$APP_HOST,service.type={{ .Values.service.type }},mariadb.enabled=false{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }},externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST
{{- end }}

View File

@@ -0,0 +1,396 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "nextcloud.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 "nextcloud.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 a default fully qualified redis app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "nextcloud.redis.fullname" -}}
{{- printf "%s-redis" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "nextcloud.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create image name that is used in the deployment
*/}}
{{- define "nextcloud.image" -}}
{{- if .Values.image.tag -}}
{{- printf "%s:%s" .Values.image.repository .Values.image.tag -}}
{{- else -}}
{{- printf "%s:%s-%s" .Values.image.repository .Chart.AppVersion .Values.image.flavor -}}
{{- end -}}
{{- end -}}
{{- define "nextcloud.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "<1.19-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end }}
{{- end -}}
{{/*
Create environment variables used to configure the nextcloud container as well as the cron sidecar container.
*/}}
{{- define "nextcloud.env" -}}
{{- if .Values.phpClientHttpsFix.enabled }}
- name: OVERWRITEPROTOCOL
value: {{ .Values.phpClientHttpsFix.protocol | quote }}
{{- end }}
{{- if .Values.internalDatabase.enabled }}
- name: SQLITE_DATABASE
value: {{ .Values.internalDatabase.name | quote }}
{{- else if .Values.mariadb.enabled }}
- name: MYSQL_HOST
value: {{ template "mariadb.primary.fullname" .Subcharts.mariadb }}
- name: MYSQL_DATABASE
value: {{ .Values.mariadb.auth.database | quote }}
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
{{- else if .Values.postgresql.enabled }}
- name: POSTGRES_HOST
value: {{ template "postgresql.v1.primary.fullname" .Subcharts.postgresql }}
- name: POSTGRES_DB
{{- if .Values.postgresql.auth.database }}
value: {{ .Values.postgresql.auth.database | quote }}
{{ else }}
value: {{ .Values.postgresql.global.postgresql.auth.database | quote }}
{{- end }}
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
{{- else }}
{{- if eq .Values.externalDatabase.type "postgresql" }}
- name: POSTGRES_HOST
{{- if .Values.externalDatabase.existingSecret.hostKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.hostKey }}
{{- else }}
value: {{ .Values.externalDatabase.host | quote }}
{{- end }}
- name: POSTGRES_DB
{{- if .Values.externalDatabase.existingSecret.databaseKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.databaseKey }}
{{- else }}
value: {{ .Values.externalDatabase.database | quote }}
{{- end }}
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
{{- else }}
- name: MYSQL_HOST
{{- if .Values.externalDatabase.existingSecret.hostKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.hostKey }}
{{- else }}
value: {{ .Values.externalDatabase.host | quote }}
{{- end }}
- name: MYSQL_DATABASE
{{- if .Values.externalDatabase.existingSecret.databaseKey }}
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.databaseKey }}
{{- else }}
value: {{ .Values.externalDatabase.database | quote }}
{{- end }}
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
{{- end }}
{{- end }}
- name: NEXTCLOUD_ADMIN_USER
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.usernameKey }}
- name: NEXTCLOUD_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.passwordKey }}
- name: NEXTCLOUD_TRUSTED_DOMAINS
{{- if .Values.nextcloud.trustedDomains }}
value: {{ join " " .Values.nextcloud.trustedDomains | quote }}
{{- else }}
value: {{ .Values.nextcloud.host }}{{ if .Values.metrics.enabled }} {{ template "nextcloud.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local{{ end }}
{{- end }}
- name: NEXTCLOUD_DATA_DIR
value: {{ .Values.nextcloud.datadir | quote }}
{{- if .Values.nextcloud.mail.enabled }}
- name: MAIL_FROM_ADDRESS
value: {{ .Values.nextcloud.mail.fromAddress | quote }}
- name: MAIL_DOMAIN
value: {{ .Values.nextcloud.mail.domain | quote }}
- name: SMTP_SECURE
value: {{ .Values.nextcloud.mail.smtp.secure | quote }}
- name: SMTP_PORT
value: {{ .Values.nextcloud.mail.smtp.port | quote }}
- name: SMTP_AUTHTYPE
value: {{ .Values.nextcloud.mail.smtp.authtype | quote }}
- name: SMTP_HOST
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.smtpHostKey }}
- name: SMTP_NAME
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.smtpUsernameKey }}
- name: SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.smtpPasswordKey }}
{{- end }}
{{/*
Redis env vars
*/}}
{{- if .Values.redis.enabled }}
- name: REDIS_HOST
value: {{ template "nextcloud.redis.fullname" . }}-master
- name: REDIS_HOST_PORT
value: {{ .Values.redis.master.service.ports.redis | quote }}
{{- if .Values.redis.auth.enabled }}
{{- if and .Values.redis.auth.existingSecret .Values.redis.auth.existingSecretPasswordKey }}
- name: REDIS_HOST_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.redis.auth.existingSecret }}
key: {{ .Values.redis.auth.existingSecretPasswordKey }}
{{- else }}
- name: REDIS_HOST_PASSWORD
value: {{ .Values.redis.auth.password }}
{{- end }}
{{- end }}
{{- end }}{{/* end if redis.enabled */}}
{{/*
S3 as primary object store env vars
*/}}
{{- if .Values.nextcloud.objectStore.s3.enabled }}
- name: OBJECTSTORE_S3_SSL
value: {{ .Values.nextcloud.objectStore.s3.ssl | quote }}
- name: OBJECTSTORE_S3_USEPATH_STYLE
value: {{ .Values.nextcloud.objectStore.s3.usePathStyle | quote }}
{{- with .Values.nextcloud.objectStore.s3.legacyAuth }}
- name: OBJECTSTORE_S3_LEGACYAUTH
value: {{ . | quote }}
{{- end }}
- name: OBJECTSTORE_S3_AUTOCREATE
value: {{ .Values.nextcloud.objectStore.s3.autoCreate | quote }}
- name: OBJECTSTORE_S3_REGION
value: {{ .Values.nextcloud.objectStore.s3.region | quote }}
- name: OBJECTSTORE_S3_PORT
value: {{ .Values.nextcloud.objectStore.s3.port | quote }}
- name: OBJECTSTORE_S3_STORAGE_CLASS
value: {{ .Values.nextcloud.objectStore.s3.storageClass | quote }}
{{- with .Values.nextcloud.objectStore.s3.prefix }}
- name: OBJECTSTORE_S3_OBJECT_PREFIX
value: {{ . | quote }}
{{- end }}
{{- if and .Values.nextcloud.objectStore.s3.existingSecret .Values.nextcloud.objectStore.s3.secretKeys.host }}
- name: OBJECTSTORE_S3_HOST
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.objectStore.s3.existingSecret }}
key: {{ .Values.nextcloud.objectStore.s3.secretKeys.host }}
{{- else }}
- name: OBJECTSTORE_S3_HOST
value: {{ .Values.nextcloud.objectStore.s3.host | quote }}
{{- end }}
{{- if and .Values.nextcloud.objectStore.s3.existingSecret .Values.nextcloud.objectStore.s3.secretKeys.bucket }}
- name: OBJECTSTORE_S3_BUCKET
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.objectStore.s3.existingSecret }}
key: {{ .Values.nextcloud.objectStore.s3.secretKeys.bucket }}
{{- else }}
- name: OBJECTSTORE_S3_BUCKET
value: {{ .Values.nextcloud.objectStore.s3.bucket | quote }}
{{- end }}
{{- if and .Values.nextcloud.objectStore.s3.existingSecret .Values.nextcloud.objectStore.s3.secretKeys.accessKey }}
- name: OBJECTSTORE_S3_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.objectStore.s3.existingSecret }}
key: {{ .Values.nextcloud.objectStore.s3.secretKeys.accessKey }}
{{- else }}
- name: OBJECTSTORE_S3_KEY
value: {{ .Values.nextcloud.objectStore.s3.accessKey | quote }}
{{- end }}
{{- if and .Values.nextcloud.objectStore.s3.existingSecret .Values.nextcloud.objectStore.s3.secretKeys.secretKey }}
- name: OBJECTSTORE_S3_SECRET
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.objectStore.s3.existingSecret }}
key: {{ .Values.nextcloud.objectStore.s3.secretKeys.secretKey }}
{{- else }}
- name: OBJECTSTORE_S3_SECRET
value: {{ .Values.nextcloud.objectStore.s3.secretKey | quote }}
{{- end }}
{{- if and .Values.nextcloud.objectStore.s3.existingSecret .Values.nextcloud.objectStore.s3.secretKeys.sse_c_key }}
- name: OBJECTSTORE_S3_SSE_C_KEY
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.objectStore.s3.existingSecret }}
key: {{ .Values.nextcloud.objectStore.s3.secretKeys.sse_c_key }}
{{- else }}
- name: OBJECTSTORE_S3_SSE_C_KEY
value: {{ .Values.nextcloud.objectStore.s3.sse_c_key | quote }}
{{- end }}
{{- end }}{{/* end if nextcloud.objectStore.s3.enabled */}}
{{/*
Swift as primary object store env vars
*/}}
{{- if .Values.nextcloud.objectStore.swift.enabled }}
- name: OBJECTSTORE_SWIFT_AUTOCREATE
value: {{ .Values.nextcloud.objectStore.swift.autoCreate | quote }}
- name: OBJECTSTORE_SWIFT_USER_NAME
value: {{ .Values.nextcloud.objectStore.swift.user.name | quote }}
- name: OBJECTSTORE_SWIFT_USER_PASSWORD
value: {{ .Values.nextcloud.objectStore.swift.user.password | quote }}
- name: OBJECTSTORE_SWIFT_USER_DOMAIN
value: {{ .Values.nextcloud.objectStore.swift.user.domain | quote }}
- name: OBJECTSTORE_SWIFT_PROJECT_NAME
value: {{ .Values.nextcloud.objectStore.swift.project.name | quote }}
- name: OBJECTSTORE_SWIFT_PROJECT_DOMAIN
value: {{ .Values.nextcloud.objectStore.swift.project.domain | quote }}
- name: OBJECTSTORE_SWIFT_SERVICE_NAME
value: {{ .Values.nextcloud.objectStore.swift.service | quote }}
- name: OBJECTSTORE_SWIFT_REGION
value: {{ .Values.nextcloud.objectStore.swift.region | quote }}
- name: OBJECTSTORE_SWIFT_URL
value: {{ .Values.nextcloud.objectStore.swift.url | quote }}
- name: OBJECTSTORE_SWIFT_CONTAINER_NAME
value: {{ .Values.nextcloud.objectStore.swift.container | quote }}
{{- end }}{{/* end if nextcloud.objectStore.s3.enabled */}}
{{- if .Values.nextcloud.extraEnv }}
{{ toYaml .Values.nextcloud.extraEnv }}
{{- end }}
{{- end -}}
{{/*
Create volume mounts for the nextcloud container as well as the cron sidecar container.
*/}}
{{- define "nextcloud.volumeMounts" -}}
- name: nextcloud-main
mountPath: /var/www/
subPath: {{ ternary "root" (printf "%s/root" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/html
subPath: {{ ternary "html" (printf "%s/html" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
- name: nextcloud-data
mountPath: {{ .Values.nextcloud.datadir }}
subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.nextcloudData.subPath) (empty .Values.persistence.nextcloudData.subPath) }}
{{- else }}
- name: nextcloud-main
mountPath: {{ .Values.nextcloud.datadir }}
subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.subPath) (empty .Values.persistence.subPath) }}
{{- end }}
- name: nextcloud-main
mountPath: /var/www/html/config
subPath: {{ ternary "config" (printf "%s/config" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/html/custom_apps
subPath: {{ ternary "custom_apps" (printf "%s/custom_apps" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/tmp
subPath: {{ ternary "tmp" (printf "%s/tmp" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/html/themes
subPath: {{ ternary "themes" (printf "%s/themes" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
{{- range $key, $value := .Values.nextcloud.configs }}
- name: nextcloud-config
mountPath: /var/www/html/config/{{ $key }}
subPath: {{ $key }}
{{- end }}
{{- if .Values.nextcloud.configs }}
{{- range $key, $value := .Values.nextcloud.defaultConfigs }}
{{- if $value }}
- name: nextcloud-config
mountPath: /var/www/html/config/{{ $key }}
subPath: {{ $key }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.nextcloud.extraVolumeMounts }}
{{ toYaml .Values.nextcloud.extraVolumeMounts }}
{{- end }}
{{- $nginxEnabled := .Values.nginx.enabled -}}
{{- range $key, $value := .Values.nextcloud.phpConfigs }}
- name: nextcloud-phpconfig
mountPath: {{ $nginxEnabled | ternary (printf "/usr/local/etc/php-fpm.d/%s" $key | quote) (printf "/usr/local/etc/php/conf.d/%s" $key | quote) }}
subPath: {{ $key }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,22 @@
{{- if .Values.nextcloud.configs -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "nextcloud.fullname" . }}-config
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 }}
data:
{{- range $filename, $content := .Values.nextcloud.configs }}
{{ $filename }}: |-
{{- $content | nindent 4 }}
{{- end }}
{{- range $filename, $enabled := .Values.nextcloud.defaultConfigs }}
{{- if $enabled }}
{{ $filename }}: |-
{{- tpl ($.Files.Get (printf "files/defaultConfigs/%s.tpl" $filename)) $ | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}{{/* end-if configs */}}

View File

@@ -0,0 +1,18 @@
{{- if not (values .Values.nextcloud.hooks | compact | empty) }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "nextcloud.fullname" . }}-hooks
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 }}
data:
{{- range $hook, $shell := .Values.nextcloud.hooks }}
{{- if $shell }}
{{ $hook }}.sh: {{ $shell | quote }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,26 @@
{{- if or .Values.mariadb.enabled .Values.externalDatabase.enabled .Values.postgresql.enabled }}
{{- if not .Values.externalDatabase.existingSecret.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-db
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 }}
type: Opaque
data:
{{- if .Values.mariadb.enabled }}
db-username: {{ .Values.mariadb.auth.username | b64enc | quote }}
db-password: {{ .Values.mariadb.auth.password | b64enc | quote }}
{{- else if .Values.postgresql.enabled }}
db-username: {{ .Values.postgresql.global.postgresql.auth.username | b64enc | quote }}
db-password: {{ .Values.postgresql.global.postgresql.auth.password | b64enc | quote }}
{{- else }}
db-username: {{ .Values.externalDatabase.user | b64enc | quote }}
db-password: {{ .Values.externalDatabase.password | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,425 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "nextcloud.fullname" . }}
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: app
{{- with .Values.deploymentLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.hpa.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
strategy:
{{- toYaml .Values.nextcloud.strategy | nindent 4 }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: app
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: app
{{- if .Values.redis.enabled }}
{{ template "nextcloud.redis.fullname" . }}-client: "true"
{{- end }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
nextcloud-config-hash: {{ print (toJson .Values.nextcloud.defaultConfigs) "-" (toJson .Values.nextcloud.configs) | sha256sum }}
php-config-hash: {{ toJson .Values.nextcloud.phpConfigs | sha256sum }}
{{- if .Values.nginx.enabled }}
nginx-config-hash: {{ print .Values.nginx.config.default "-" .Values.nginx.config.custom | sha256sum }}
{{- end }}
hooks-hash: {{ toYaml .Values.nextcloud.hooks | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.image.pullSecrets }}
imagePullSecrets:
{{- range . }}
- name: {{ . }}
{{- end}}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: {{ include "nextcloud.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.lifecycle }}
lifecycle:
{{- with .postStartCommand }}
postStart:
exec:
command:
{{- toYaml . | nindent 18 }}
{{- end }}
{{- with .preStopCommand }}
preStop:
exec:
command:
{{- toYaml . | nindent 18 }}
{{- end }}
{{- end }}
env:
{{- include "nextcloud.env" . | nindent 12 }}
{{- if not .Values.nginx.enabled }}
ports:
- name: http
containerPort: {{ .Values.nextcloud.containerPort }}
protocol: TCP
{{- with .Values.livenessProbe }}
{{- if .enabled }}
livenessProbe:
httpGet:
path: /status.php
port: {{ $.Values.nextcloud.containerPort }}
httpHeaders:
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
successThreshold: {{ .successThreshold }}
failureThreshold: {{ .failureThreshold }}
{{- end }}
{{- end }}
{{- with .Values.readinessProbe }}
{{- if .enabled }}
readinessProbe:
httpGet:
path: /status.php
port: {{ $.Values.nextcloud.containerPort }}
httpHeaders:
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
successThreshold: {{ .successThreshold }}
failureThreshold: {{ .failureThreshold }}
{{- end }}
{{- end }}
{{- with .Values.startupProbe }}
{{- if .enabled }}
startupProbe:
httpGet:
path: /status.php
port: {{ $.Values.nextcloud.containerPort }}
httpHeaders:
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
successThreshold: {{ .successThreshold }}
failureThreshold: {{ .failureThreshold }}
{{- end }}
{{- end }}
{{- end }}{{/* end-if not nginx.enabled */}}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nextcloud.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- include "nextcloud.volumeMounts" . | trim | nindent 12 }}
{{- if .Values.nginx.enabled }}
- name: {{ .Chart.Name }}-nginx
image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag }}"
imagePullPolicy: {{ .Values.nginx.image.pullPolicy }}
{{- with .Values.nginx.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
protocol: TCP
containerPort: {{ .Values.nextcloud.containerPort }}
{{- with .Values.livenessProbe }}
{{- if .enabled }}
livenessProbe:
httpGet:
path: /status.php
port: {{ $.Values.nextcloud.containerPort }}
httpHeaders:
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
successThreshold: {{ .successThreshold }}
failureThreshold: {{ .failureThreshold }}
{{- end }}
{{- end }}
{{- with .Values.readinessProbe }}
{{- if .enabled }}
readinessProbe:
httpGet:
path: /status.php
port: {{ $.Values.nextcloud.containerPort }}
httpHeaders:
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
successThreshold: {{ .successThreshold }}
failureThreshold: {{ .failureThreshold }}
{{- end }}
{{- end }}
{{- with .Values.startupProbe }}
{{- if .enabled }}
startupProbe:
httpGet:
path: /status.php
port: {{ $.Values.nextcloud.containerPort }}
httpHeaders:
- name: Host
value: {{ $.Values.nextcloud.host | quote }}
initialDelaySeconds: {{ .initialDelaySeconds }}
periodSeconds: {{ .periodSeconds }}
timeoutSeconds: {{ .timeoutSeconds }}
successThreshold: {{ .successThreshold }}
failureThreshold: {{ .failureThreshold }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.nginx.resources | nindent 12 }}
{{- with .Values.nginx.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: nextcloud-main
mountPath: /var/www/
subPath: {{ ternary "root" (printf "%s/root" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/html
subPath: {{ ternary "html" (printf "%s/html" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
- name: nextcloud-data
mountPath: {{ .Values.nextcloud.datadir }}
subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.nextcloudData.subPath) (empty .Values.persistence.nextcloudData.subPath) }}
{{- else }}
- name: nextcloud-main
mountPath: {{ .Values.nextcloud.datadir }}
subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.subPath) (empty .Values.persistence.subPath) }}
{{- end }}
- name: nextcloud-main
mountPath: /var/www/html/config
subPath: {{ ternary "config" (printf "%s/config" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/html/custom_apps
subPath: {{ ternary "custom_apps" (printf "%s/custom_apps" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/tmp
subPath: {{ ternary "tmp" (printf "%s/tmp" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-main
mountPath: /var/www/html/themes
subPath: {{ ternary "themes" (printf "%s/themes" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }}
- name: nextcloud-nginx-config
mountPath: /etc/nginx/conf.d/
{{- with .Values.nextcloud.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}{{/* end-if nginx.enabled */}}
{{- if .Values.cronjob.enabled }}
- name: {{ .Chart.Name }}-cron
image: {{ include "nextcloud.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /cron.sh
{{- with .Values.cronjob.lifecycle }}
lifecycle:
{{- with .postStartCommand }}
postStart:
exec:
command:
{{- toYaml . | nindent 18 }}
{{- end }}
{{- with .preStopCommand }}
preStop:
exec:
command:
{{- toYaml . | nindent 18 }}
{{- end }}
{{- end }}
env:
{{- include "nextcloud.env" . | nindent 12 }}
resources:
{{- toYaml .Values.cronjob.resources | nindent 12 }}
{{- with .Values.cronjob.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- include "nextcloud.volumeMounts" . | trim | nindent 12 }}
{{- end }}{{/* end-if cronjob.enabled */}}
{{- with .Values.nextcloud.extraSidecarContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
initContainers:
{{- with .Values.nextcloud.extraInitContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.mariadb.enabled }}
- name: mariadb-isalive
image: {{ .Values.mariadb.image.registry | default "docker.io" }}/{{ .Values.mariadb.image.repository }}:{{ .Values.mariadb.image.tag }}
{{- with .Values.nextcloud.mariaDbInitContainer }}
resources:
{{- toYaml .resources | nindent 12 }}
securityContext:
{{- toYaml .securityContext | nindent 12 }}
{{- end }}
env:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.passwordKey }}
command:
- "sh"
- "-c"
- {{ printf "until mysql --host=%s-mariadb --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --execute=\"SELECT 1;\"; do echo waiting for mysql; sleep 2; done;" .Release.Name }}
{{- else if .Values.postgresql.enabled }}
- name: postgresql-isready
image: {{ .Values.postgresql.image.registry | default "docker.io" }}/{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}
{{- with .Values.nextcloud.postgreSqlInitContainer }}
resources:
{{- toYaml .resources | nindent 12 }}
securityContext:
{{- toYaml .securityContext | nindent 12 }}
{{- end }}
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.externalDatabase.existingSecret.secretName | default (printf "%s-db" .Release.Name) }}
key: {{ .Values.externalDatabase.existingSecret.usernameKey }}
- name: POSTGRES_HOST
value: {{ template "postgresql.v1.primary.fullname" .Subcharts.postgresql }}
command:
- "sh"
- "-c"
- "until pg_isready -h ${POSTGRES_HOST} -U ${POSTGRES_USER} ; do sleep 2 ; done"
{{- end }}{{/* end-if any database-initContainer */}}
- name: {{ .Chart.Name }}-upgrade
image: {{ include "nextcloud.image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
# Do upgrade then exit
# This avoids doing it in the container, which could get killed by failed liveness probes
- "true"
env:
- name: NEXTCLOUD_UPDATE
value: "1"
{{- include "nextcloud.env" . | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nextcloud.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- include "nextcloud.volumeMounts" . | trim | nindent 12 }}
{{- range $hook, $shell := .Values.nextcloud.hooks }}
{{- if $shell }}
- name: nextcloud-hooks
mountPath: /docker-entrypoint-hooks.d/{{ $hook }}/helm.sh
subPath: {{ $hook }}.sh
readOnly: true
{{- end }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: nextcloud-main
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
- name: nextcloud-data
persistentVolumeClaim:
claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }}
{{- end }}
{{- if .Values.nextcloud.configs }}
- name: nextcloud-config
configMap:
name: {{ template "nextcloud.fullname" . }}-config
{{- end }}
{{- if .Values.nextcloud.phpConfigs }}
- name: nextcloud-phpconfig
configMap:
name: {{ template "nextcloud.fullname" . }}-phpconfig
{{- end }}
{{- if .Values.nginx.enabled }}
- name: nextcloud-nginx-config
configMap:
name: {{ template "nextcloud.fullname" . }}-nginxconfig
{{- end }}
{{- if not (values .Values.nextcloud.hooks | compact | empty) }}
- name: nextcloud-hooks
configMap:
name: {{ template "nextcloud.fullname" . }}-hooks
defaultMode: 0o755
{{- end }}
{{- with .Values.nextcloud.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- with .Values.securityContext }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nextcloud.podSecurityContext }}
{{- toYaml . | nindent 8 }}
{{- else }}
{{- if .Values.nginx.enabled }}
# Will mount configuration files as www-data (id: 82) for nextcloud
fsGroup: 82
{{- else }}
# Will mount configuration files as www-data (id: 33) for nextcloud
fsGroup: 33
{{- end }}
{{- end }}{{/* end-with podSecurityContext */}}
{{- if .Values.rbac.enabled }}
serviceAccountName: {{ .Values.rbac.serviceaccount.name }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@@ -0,0 +1,23 @@
{{- if .Values.hpa.enabled }}
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "nextcloud.fullname" . }}
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: app
spec:
scaleTargetRef:
kind: Deployment
apiVersion: apps/v1
name: {{ template "nextcloud.fullname" . }}
{{- with .Values.hpa }}
minReplicas: {{ .minPods }}
maxReplicas: {{ .maxPods }}
targetCPUUtilizationPercentage: {{ .cputhreshold }}
{{- end }}{{/* end-with .hpa */}}
{{- end }}

View File

@@ -0,0 +1,46 @@
{{- if .Values.ingress.enabled }}
---
apiVersion: {{ include "nextcloud.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ template "nextcloud.fullname" . }}
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: app
{{- with .Values.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
rules:
- host: {{ .Values.nextcloud.host }}
http:
paths:
- path: {{ .Values.ingress.path }}
{{- if (eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1") }}
pathType: {{ .Values.ingress.pathType }}
{{- end }}
backend:
{{- if (eq (include "nextcloud.ingress.apiVersion" $) "networking.k8s.io/v1") }}
service:
name: {{ template "nextcloud.fullname" . }}
port:
number: {{ .Values.service.port }}
{{- else }}
serviceName: {{ template "nextcloud.fullname" . }}
servicePort: {{ .Values.service.port }}
{{- end }}
{{- with .Values.ingress.tls }}
tls:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,102 @@
{{- if .Values.metrics.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "nextcloud.fullname" . }}-metrics
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: metrics
spec:
replicas: {{ .Values.metrics.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: metrics
template:
metadata:
annotations:
{{- toYaml .Values.metrics.podAnnotations | nindent 8 }}
labels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: metrics
{{- with .Values.metrics.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.metrics.image.pullSecrets }}
imagePullSecrets:
{{- range . }}
- name: {{ . }}
{{- end}}
{{- end }}
containers:
- name: metrics-exporter
image: "{{ .Values.metrics.image.repository }}:{{ .Values.metrics.image.tag }}"
imagePullPolicy: {{ .Values.metrics.image.pullPolicy }}
env:
{{- if or .Values.metrics.token .Values.nextcloud.existingSecret.tokenKey }}
- name: NEXTCLOUD_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.tokenKey | default "nextcloud-token" }}
{{- else }}
- name: NEXTCLOUD_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.usernameKey }}
- name: NEXTCLOUD_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.nextcloud.existingSecret.secretName | default (include "nextcloud.fullname" .) }}
key: {{ .Values.nextcloud.existingSecret.passwordKey }}
{{- end }}
# NEXTCLOUD_SERVER is used by metrics-exporter to reach the Nextcloud (K8s-)Service to grab the serverinfo api endpoint
{{- if not .Values.metrics.server }}
- name: NEXTCLOUD_SERVER # deployment.namespace.svc.cluster.local
value: "http{{ if .Values.metrics.https }}s{{ end }}://{{ template "nextcloud.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }}"
{{- else }}
- name: NEXTCLOUD_SERVER
value: {{ .Values.metrics.server }}
{{- end }}
- name: NEXTCLOUD_TIMEOUT
value: {{ .Values.metrics.timeout }}
- name: NEXTCLOUD_TLS_SKIP_VERIFY
value: {{ .Values.metrics.tlsSkipVerify | quote }}
- name: NEXTCLOUD_INFO_APPS
value: {{ .Values.metrics.info.apps | quote }}
ports:
- name: metrics
containerPort: 9205
{{- with .Values.metrics.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.metrics.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.metrics.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.metrics.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.metrics.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.metrics.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,35 @@
{{- if .Values.metrics.enabled }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "nextcloud.fullname" . }}-metrics
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: metrics
{{- with .Values.metrics.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.metrics.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.metrics.service.type }}
{{- if eq .Values.metrics.service.type "LoadBalancer" }}
{{- with .Values.metrics.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
{{- end }}
ports:
- name: metrics
port: 9205
targetPort: metrics
selector:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: metrics
{{- end }}

View File

@@ -0,0 +1,40 @@
{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "nextcloud.fullname" . }}
namespace: {{ .Values.metrics.serviceMonitor.namespace | default .Release.Namespace | quote }}
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: metrics
{{- with .Values.metrics.serviceMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel | quote }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: metrics
namespaceSelector:
{{- with .Values.metrics.serviceMonitor.namespaceSelector }}
{{- toYaml . | nindent 4 }}
{{- else }}
matchNames:
- {{ .Release.Namespace | quote }}
{{- end }}
endpoints:
- port: metrics
path: "/"
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,31 @@
{{- if and .Values.persistence.enabled .Values.persistence.nextcloudData.enabled (not .Values.persistence.nextcloudData.existingClaim) }}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "nextcloud.fullname" . }}-nextcloud-data
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: app
annotations:
helm.sh/resource-policy: keep
{{- with .Values.persistence.nextcloudData.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.nextcloudData.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.nextcloudData.size | quote }}
{{- with .Values.persistence.nextcloudData.storageClass }}
{{- if (eq "-" .) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ . }}"
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,30 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "nextcloud.fullname" . }}-nextcloud
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: app
annotations:
helm.sh/resource-policy: keep
{{- with .Values.persistence.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- with .Values.persistence.storageClass }}
{{- if (eq "-" .) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ . }}"
{{- end }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,21 @@
{{- if .Values.nginx.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "nextcloud.fullname" . }}-nginxconfig
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 }}
data:
{{- if .Values.nginx.config.default }}
default.conf: |-
{{- tpl (.Files.Get "files/nginx.config.tpl") . | nindent 4 }}
{{- end }}
{{- with .Values.nginx.config.custom }}
zz-custom.conf: |-
{{- . | nindent 4 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,17 @@
{{- if .Values.nextcloud.phpConfigs -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "nextcloud.fullname" . }}-phpconfig
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 }}
data:
{{- range $key, $value := .Values.nextcloud.phpConfigs }}
{{ $key }}: |-
{{- $value | nindent 4 }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,31 @@
{{- if .Values.rbac.enabled }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ template "nextcloud.fullname" . }}-privileged
namespace: {{ .Release.Namespace }}
rules:
- apiGroups:
- extensions
resourceNames:
- privileged
resources:
- podsecuritypolicies
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ template "nextcloud.fullname" . }}-privileged
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ template "nextcloud.fullname" . }}-privileged
subjects:
- kind: ServiceAccount
name: {{ .Values.rbac.serviceaccount.name }}
namespace: {{ .Release.Namespace }}
{{- end }}

View File

@@ -0,0 +1,30 @@
{{- if not .Values.nextcloud.existingSecret.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ template "nextcloud.fullname" . }}
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 }}
type: Opaque
data:
nextcloud-username: {{ .Values.nextcloud.username | b64enc | quote }}
{{- with .Values.nextcloud.password }}
nextcloud-password: {{ . | b64enc | quote }}
{{- else }}
nextcloud-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- if and .Values.metrics.enabled .Values.metrics.token }}
nextcloud-token: {{ .Values.metrics.token | b64enc | quote }}
{{- else if and .Values.metrics.enabled (not .Values.metrics.token) }}
nextcloud-token: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
{{- if .Values.nextcloud.mail.enabled }}
smtp-username: {{ .Values.nextcloud.mail.smtp.name | default "" | b64enc | quote }}
smtp-password: {{ .Values.nextcloud.mail.smtp.password | default "" | b64enc | quote }}
smtp-host: {{ .Values.nextcloud.mail.smtp.host | default "" | b64enc | quote }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,41 @@
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "nextcloud.fullname" . }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
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: app
spec:
type: {{ .Values.service.type }}
{{- if (eq .Values.service.type "LoadBalancer") }}
{{- with .Values.service.loadBalancerIP }}
loadBalancerIP: {{ . }}
{{- end }}
{{- end }}
{{- with .Values.service.ipFamilies }}
ipFamilies:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.service.ipFamilyPolicy }}
ipFamilyPolicy: {{ . }}
{{- end }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.nextcloud.containerPort }}
protocol: TCP
name: http
{{- with .Values.service.nodePort }}
nodePort: {{ . }}
{{- end }}
selector:
app.kubernetes.io/name: {{ include "nextcloud.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: app

View File

@@ -0,0 +1,11 @@
{{- if and .Values.rbac.enabled .Values.rbac.serviceaccount.create }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.rbac.serviceaccount.name }}
{{- with .Values.rbac.serviceaccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}