Browse Source

Allow configuring certificate for nextcloud

sonicaj 3 years ago
parent
commit
bcab69f042

+ 10 - 1
test/nextcloud/1.3.6/questions.yaml

@@ -17,7 +17,7 @@ groups:
 portals:
   web_portal:
     protocols:
-      - "http"
+      - "$kubernetes-resource_configmap_nginx-configuration_protocol"
     host:
       - "$variable-nextcloud.host"
     ports:
@@ -52,6 +52,15 @@ questions:
                         type: string
                         required: true
 
+  - variable: certificate
+    description: "Configure Certificate for Nextcloud"
+    label: "Certificate Configuration"
+    group: "Nextcloud Configuration"
+    schema:
+      type: int
+      $ref:
+        - "definitions/certificate"
+
   - variable: nextcloud
     description: "Nextcloud configuration details"
     label: "Nextcloud Configuration"

+ 2 - 0
test/nextcloud/1.3.6/templates/deployment.yaml

@@ -10,6 +10,7 @@ spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
           command: ['sh', '-c', "until pg_isready -h {{ template "common.names.fullname" $postgres_values }}; do echo waiting for postgres; sleep 2; done"]
           imagePullPolicy: {{ .Values.image.pullPolicy }}
       containers:
+      {{ if eq (include "nginx.certAvailable" .) "true" }}
       - name: nginx
         {{ include "common.containers.imageConfig" .Values.nginx.image | nindent 8 }}
         volumeMounts:
@@ -24,6 +25,7 @@ spec: {{ include "common.deployment.common_spec" . | nindent 2 }}
           - name: nginx-https
             containerPort: 8443
             protocol: TCP
+      {{ end }}
       - name: {{ .Chart.Name }}
         {{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
         env: {{ include "postgres.envVariableConfiguration" $postgres_values | nindent 10 }}

+ 1 - 0
test/nextcloud/1.3.6/templates/nginx-configmap.yaml

@@ -3,6 +3,7 @@ kind: ConfigMap
 metadata:
   name: "nginx-configuration"
 data:
+  protocol: {{ include "nginx.scheme" . }}
   config: |-
     http {
       # redirects all http requests to https requests

+ 4 - 0
test/nextcloud/1.3.6/templates/service.yaml

@@ -1,6 +1,10 @@
 {{ $svc := .Values.service }}
 {{ $ports := list }}
+{{ if eq (include "nginx.certAvailable" .) "true" }}
+{{ $ports = mustAppend $ports (dict "name" "nginx-https" "port" 8443 "nodePort" $svc.nodePort) }}
+{{ else }}
 {{ $ports = mustAppend $ports (dict "name" "http" "port" 80 "nodePort" $svc.nodePort) }}
+{{ end }}
 {{ $params := . }}
 {{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
 {{ include "common.classes.service" $params }}