Răsfoiți Sursa

Initial postgres support

Waqar Ahmed 5 ani în urmă
părinte
comite
eb3c7a6ae6

+ 43 - 12
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"

+ 16 - 0
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 }}

+ 18 - 0
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 }}

+ 1 - 1
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 }}

+ 4 - 28
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