From eb3c7a6ae606afbb6bafedf3c6f3270bbeb93f7c Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 4 Dec 2020 07:13:12 +0500 Subject: [PATCH] Initial postgres support --- test/nextcloud/2.3.2/questions.yaml | 55 +++++++++++++++---- test/nextcloud/2.3.2/templates/_helpers.tpl | 16 ++++++ .../2.3.2/templates/postgres-service.yaml | 18 ++++++ test/nextcloud/2.3.2/templates/service.yaml | 2 +- test/nextcloud/2.3.2/values.yaml | 32 ++--------- 5 files changed, 82 insertions(+), 41 deletions(-) create mode 100644 test/nextcloud/2.3.2/templates/postgres-service.yaml diff --git a/test/nextcloud/2.3.2/questions.yaml b/test/nextcloud/2.3.2/questions.yaml index 38a89adef32..979029b6261 100644 --- a/test/nextcloud/2.3.2/questions.yaml +++ b/test/nextcloud/2.3.2/questions.yaml @@ -7,8 +7,8 @@ groups: description: "Configure Storage for Nextcloud" - name: "Container Configuration" description: "Configure nextcloud container parameters" - - name: "Nginx Configuration" - description: "Use nginx with Nextcloud" + - name: "Postgresql Configuration" + description: "Configure Postgresql for nextcloud" questions: # Image related @@ -165,14 +165,6 @@ questions: additional_attrs: true attrs: [] - - variable: nginx - label: "Configure Nginx" - group: "Nginx Configuration" - schema: - type: dict - additional_attrs: true - attrs: [] - - variable: internalDatabase label: "REMOVEME" schema: @@ -188,11 +180,50 @@ questions: attrs: [] - variable: postgresql - label: "REMOVEME" + label: "Configure Postgresql" + group: "Postgresql Configuration" schema: type: dict additional_attrs: true - attrs: [] + attrs: + - variable: backupVolume + label: "Backup Volume" + schema: + type: dict + $ref: + - "normalize/ixVolume" + attrs: + - variable: mountPath + label: "Mount Path" + schema: + type: path + editable: false + default: "/postgres_backups" + - variable: datasetName + label: "Dataset Name" + schema: + type: string + default: "ix-postgres_backups" + editable: false + - variable: dataVolume + label: "Postgresql Data Volume" + schema: + type: dict + $ref: + - "normalize/ixVolume" + attrs: + - variable: mountPath + label: "Mount Path" + schema: + type: path + editable: false + default: "/var/lib/postgresql/data" + - variable: datasetName + label: "Dataset Name" + schema: + type: string + default: "ix-postgres_data" + editable: false - variable: cronjob label: "REMOVEME" diff --git a/test/nextcloud/2.3.2/templates/_helpers.tpl b/test/nextcloud/2.3.2/templates/_helpers.tpl index 0761b84d9c0..a376df3b00d 100644 --- a/test/nextcloud/2.3.2/templates/_helpers.tpl +++ b/test/nextcloud/2.3.2/templates/_helpers.tpl @@ -61,3 +61,19 @@ Retrieve host path defined in volume {{- printf "" -}} {{- end -}} {{- end -}} + +{{/* +Selector labels +*/}} +{{- define "nextcloud.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nextcloud.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Postgres Selector labels +*/}} +{{- define "nextcloud.postgres.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nextcloud.name" . }}-postgres +app.kubernetes.io/instance: {{ .Release.Name }}-postgres +{{- end }} diff --git a/test/nextcloud/2.3.2/templates/postgres-service.yaml b/test/nextcloud/2.3.2/templates/postgres-service.yaml new file mode 100644 index 00000000000..4d2837e4d5a --- /dev/null +++ b/test/nextcloud/2.3.2/templates/postgres-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "nextcloud.fullname" . }}-postgres + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }}-postgres + 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: ClusterIP + ports: + - port: 5432 + protocol: TCP + name: postgres-tcp + selector: + {{- include "nextcloud.postgres.selectorLabels" . | nindent 4 }} diff --git a/test/nextcloud/2.3.2/templates/service.yaml b/test/nextcloud/2.3.2/templates/service.yaml index 7f307f5caf7..3e2287d1960 100644 --- a/test/nextcloud/2.3.2/templates/service.yaml +++ b/test/nextcloud/2.3.2/templates/service.yaml @@ -17,4 +17,4 @@ spec: name: http nodePort: {{ default "" .Values.service.nodePort}} selector: - app.kubernetes.io/name: {{ include "nextcloud.name" . }} + {{- include "nextcloud.selectorLabels" . | nindent 4 }} diff --git a/test/nextcloud/2.3.2/values.yaml b/test/nextcloud/2.3.2/values.yaml index ee2b903969f..25692bd61ee 100644 --- a/test/nextcloud/2.3.2/values.yaml +++ b/test/nextcloud/2.3.2/values.yaml @@ -113,34 +113,18 @@ nextcloud: # - name: nfs # mountPath: "/legacy_data" -nginx: - ## You need to set an fpm version of the image for nextcloud if you want to use nginx! - enabled: false - image: - repository: nginx - tag: alpine - pullPolicy: IfNotPresent - - config: - # This generates the default nginx config as per the nextcloud documentation - default: true - # custom: |- - # worker_processes 1;.. - - resources: {} - internalDatabase: - enabled: true + enabled: false name: nextcloud ## ## External database configuration ## externalDatabase: - enabled: false + enabled: true ## Supported database engines: mysql or postgresql - type: mysql + type: postgresql ## Database host host: @@ -162,15 +146,7 @@ externalDatabase: # passwordKey: password postgresql: - enabled: false - global: - postgresql: - postgresqlUsername: nextcloud - postgresqlPassword: changeme - postgresqlDatabase: nextcloud - persistence: - enabled: false - # storageClass: "" + host: ## Cronjob to execute Nextcloud background tasks ## ref: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html#webcron