From 1901e0708a3238a2950faca56f2fc411ea0cd984 Mon Sep 17 00:00:00 2001 From: Thomas Blarre Date: Sat, 9 Nov 2024 16:19:21 +0000 Subject: [PATCH] Starting work on nextcloud-syncthing --- nextcloud-syncthing-argocd-apps/.helmignore | 23 +++++++ nextcloud-syncthing-argocd-apps/Chart.yaml | 5 ++ .../templates/_helpers.tpl | 62 +++++++++++++++++++ nextcloud-syncthing-argocd-apps/values.yaml | 0 nextcloud-syncthing-requirements/.helmignore | 23 +++++++ nextcloud-syncthing-requirements/Chart.yaml | 5 ++ .../templates/_helpers.tpl | 62 +++++++++++++++++++ .../templates/db-cluster.yaml | 10 +++ .../templates/pvc-data.yaml | 11 ++++ .../templates/pvc-nextcloud-config.yaml | 13 ++++ .../templates/pvc-syncthing-config.yaml | 13 ++++ nextcloud-syncthing-requirements/values.yaml | 18 ++++++ 12 files changed, 245 insertions(+) create mode 100644 nextcloud-syncthing-argocd-apps/.helmignore create mode 100644 nextcloud-syncthing-argocd-apps/Chart.yaml create mode 100644 nextcloud-syncthing-argocd-apps/templates/_helpers.tpl create mode 100644 nextcloud-syncthing-argocd-apps/values.yaml create mode 100644 nextcloud-syncthing-requirements/.helmignore create mode 100644 nextcloud-syncthing-requirements/Chart.yaml create mode 100644 nextcloud-syncthing-requirements/templates/_helpers.tpl create mode 100644 nextcloud-syncthing-requirements/templates/db-cluster.yaml create mode 100644 nextcloud-syncthing-requirements/templates/pvc-data.yaml create mode 100644 nextcloud-syncthing-requirements/templates/pvc-nextcloud-config.yaml create mode 100644 nextcloud-syncthing-requirements/templates/pvc-syncthing-config.yaml create mode 100644 nextcloud-syncthing-requirements/values.yaml diff --git a/nextcloud-syncthing-argocd-apps/.helmignore b/nextcloud-syncthing-argocd-apps/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/nextcloud-syncthing-argocd-apps/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/nextcloud-syncthing-argocd-apps/Chart.yaml b/nextcloud-syncthing-argocd-apps/Chart.yaml new file mode 100644 index 0000000..831c157 --- /dev/null +++ b/nextcloud-syncthing-argocd-apps/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: nextcloud-syncthing-argocd-apps +description: A Helm chart to deploy Nextcloud and Syncthing using a common data folder +type: application +version: 0.1.0 diff --git a/nextcloud-syncthing-argocd-apps/templates/_helpers.tpl b/nextcloud-syncthing-argocd-apps/templates/_helpers.tpl new file mode 100644 index 0000000..43e66f1 --- /dev/null +++ b/nextcloud-syncthing-argocd-apps/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nextcloud-syncthing-argocd-apps.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-syncthing-argocd-apps.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 "nextcloud-syncthing-argocd-apps.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nextcloud-syncthing-argocd-apps.labels" -}} +helm.sh/chart: {{ include "nextcloud-syncthing-argocd-apps.chart" . }} +{{ include "nextcloud-syncthing-argocd-apps.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nextcloud-syncthing-argocd-apps.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nextcloud-syncthing-argocd-apps.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nextcloud-syncthing-argocd-apps.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nextcloud-syncthing-argocd-apps.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/nextcloud-syncthing-argocd-apps/values.yaml b/nextcloud-syncthing-argocd-apps/values.yaml new file mode 100644 index 0000000..e69de29 diff --git a/nextcloud-syncthing-requirements/.helmignore b/nextcloud-syncthing-requirements/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/nextcloud-syncthing-requirements/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/nextcloud-syncthing-requirements/Chart.yaml b/nextcloud-syncthing-requirements/Chart.yaml new file mode 100644 index 0000000..c4cb2d0 --- /dev/null +++ b/nextcloud-syncthing-requirements/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: nextcloud-syncthing-requirements +description: A Helm chart for deploying the database and the pvcs for Nextcloud and Syncthing +type: application +version: 0.1.0 diff --git a/nextcloud-syncthing-requirements/templates/_helpers.tpl b/nextcloud-syncthing-requirements/templates/_helpers.tpl new file mode 100644 index 0000000..2cd676c --- /dev/null +++ b/nextcloud-syncthing-requirements/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "nextcloud-syncthing-requirements.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-syncthing-requirements.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 "nextcloud-syncthing-requirements.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "nextcloud-syncthing-requirements.labels" -}} +helm.sh/chart: {{ include "nextcloud-syncthing-requirements.chart" . }} +{{ include "nextcloud-syncthing-requirements.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "nextcloud-syncthing-requirements.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nextcloud-syncthing-requirements.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "nextcloud-syncthing-requirements.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "nextcloud-syncthing-requirements.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/nextcloud-syncthing-requirements/templates/db-cluster.yaml b/nextcloud-syncthing-requirements/templates/db-cluster.yaml new file mode 100644 index 0000000..47b69cf --- /dev/null +++ b/nextcloud-syncthing-requirements/templates/db-cluster.yaml @@ -0,0 +1,10 @@ +{{- if .Values.nextcloud.enable -}} +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: nextcloud-db +spec: + instances: {{ .Values.nextcloud.dbCluster.numInstances }} + storage: + size: {{ .Values.nextcloud.dbCluster.size }} +{{- end }} \ No newline at end of file diff --git a/nextcloud-syncthing-requirements/templates/pvc-data.yaml b/nextcloud-syncthing-requirements/templates/pvc-data.yaml new file mode 100644 index 0000000..9663217 --- /dev/null +++ b/nextcloud-syncthing-requirements/templates/pvc-data.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: data +spec: + storageClassName: {{ .Values.dataPvc.storageClassName }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.dataPvc.size }} \ No newline at end of file diff --git a/nextcloud-syncthing-requirements/templates/pvc-nextcloud-config.yaml b/nextcloud-syncthing-requirements/templates/pvc-nextcloud-config.yaml new file mode 100644 index 0000000..95041d0 --- /dev/null +++ b/nextcloud-syncthing-requirements/templates/pvc-nextcloud-config.yaml @@ -0,0 +1,13 @@ +{{- if .Values.nextcloud.enable -}} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nextcloud-config-pvc +spec: + storageClassName: {{ .Values.nextcloud.configPvc.storageClassName }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.nextcloud.configPvc.size }} +{{- end }} \ No newline at end of file diff --git a/nextcloud-syncthing-requirements/templates/pvc-syncthing-config.yaml b/nextcloud-syncthing-requirements/templates/pvc-syncthing-config.yaml new file mode 100644 index 0000000..324109d --- /dev/null +++ b/nextcloud-syncthing-requirements/templates/pvc-syncthing-config.yaml @@ -0,0 +1,13 @@ +{{- if .Values.syncthing.enable -}} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: syncthing-config-pvc +spec: + storageClassName: {{ .Values.syncthing.configPvc.storageClassName }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.syncthing.configPvc.size }} +{{- end }} \ No newline at end of file diff --git a/nextcloud-syncthing-requirements/values.yaml b/nextcloud-syncthing-requirements/values.yaml new file mode 100644 index 0000000..d9feb44 --- /dev/null +++ b/nextcloud-syncthing-requirements/values.yaml @@ -0,0 +1,18 @@ +nextcloud: + enable: true + dbCluster: + numInstances: 3 + size: 4Gi + configPvc: + storageClassName: default + size: 1Gi + +syncthing: + enable: true + configPvc: + storageClassName: default + size: 100Mi + +dataPvc: + storageClassName: default + size: 100Mi \ No newline at end of file