Allow using host path or ix volume for persistent data storage

This commit is contained in:
Waqar Ahmed 2020-12-04 00:48:31 +05:00
parent aa33f73fda
commit 8e719a4787
3 changed files with 68 additions and 0 deletions

View File

@ -3,6 +3,8 @@ groups:
description: "Image to be used for container"
- name: "Nextcloud Configuration"
description: "Configuration details for Nextcloud workload"
- name: "Storage Configuration"
description: "Configure Storage for Nextcloud"
questions:
# Image related
@ -101,3 +103,52 @@ questions:
max: 65535
default: 9000
required: true
- variable: configureiXVolume
label: "Configure iX Volume"
group: "Storage Configuration"
description: "Use iX Volume for persistent storage"
schema:
type: boolean
default: true
required: true
show_subquestions_if: true
subquestions:
- variable: volume
label: "Configure iXVolume"
group: "Storage Configuration"
schema:
type: dict
$ref:
- "normalize/ixVolume"
attrs:
- variable: mountPath
label: "Mount Path"
description: "Path where the volume will be mounted inside the pod"
schema:
type: path
editable: false
default: "/var/www"
- variable: datasetName
label: "Dataset Name"
schema:
type: string
required: true
- variable: configureHostPath
label: "Configure Host Path for storage"
description: "Use a path on host for persistent data storage"
group: "Storage Configuration"
schema:
type: boolean
default: false
required: true
show_if: [["configureiXVolume", "=", false]]
show_subquestions_if: true
subquestions:
- variable: volumeHostPath
label: "Host Path"
group: "Storage Configuration"
schema:
type: hostpath
required: true

View File

@ -47,3 +47,17 @@ 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 -}}
{{/*
Retrieve host path defined in volume
*/}}
{{- define "configuredHostPath" -}}
{{- if .Values.configureiXVolume -}}
{{- $volDict := first .Values.ixVolumes -}}
{{- $volDict.hostPath -}}
{{- else if .Values.configureHostPath -}}
{{- .Values.volumeHostPath -}}
{{- else -}}
{{- printf "" -}}
{{- end -}}
{{- end -}}

View File

@ -328,6 +328,9 @@ spec:
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }}
{{- else if ne (include "configuredHostPath" .) "" }}
hostPath:
path: {{ template "configuredHostPath" . }}
{{- else }}
emptyDir: {}
{{- end }}