Add Unlimited Custom hostPath mounts (#201)
This commit is contained in:
parent
95c2a96a16
commit
3cda910be6
|
@ -0,0 +1,69 @@
|
||||||
|
# Unlimited Storage Mounts
|
||||||
|
|
||||||
|
We support presenting the user with a "Do it yourself" style list, in which the user can add unlimited paths on the host system to mount.
|
||||||
|
It should always be included in any App, to give users the option to customise things however they like.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```
|
||||||
|
- variable: appExtraVolumeMounts
|
||||||
|
label: "Custom app storage"
|
||||||
|
group: "Storage"
|
||||||
|
schema:
|
||||||
|
type: list
|
||||||
|
default: []
|
||||||
|
items:
|
||||||
|
- variable: volumeMount
|
||||||
|
label: "Custom Storage"
|
||||||
|
schema:
|
||||||
|
type: dict
|
||||||
|
attrs:
|
||||||
|
- variable: enabled
|
||||||
|
label: "Enabled"
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
required: true
|
||||||
|
hidden: true
|
||||||
|
editable: false
|
||||||
|
- variable: setPermissions
|
||||||
|
label: "Automatic Permissions"
|
||||||
|
description: "Automatically set permissions on install"
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
hidden: false
|
||||||
|
- variable: name
|
||||||
|
label: "Mountpoint Name"
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
|
required: true
|
||||||
|
editable: true
|
||||||
|
- variable: emptyDir
|
||||||
|
label: "emptyDir"
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
hidden: true
|
||||||
|
editable: false
|
||||||
|
- variable: mountPath
|
||||||
|
label: "Mount Path"
|
||||||
|
description: "Path to mount inside the pod"
|
||||||
|
schema:
|
||||||
|
type: path
|
||||||
|
required: true
|
||||||
|
default: ""
|
||||||
|
editable: true
|
||||||
|
- variable: hostPathEnabled
|
||||||
|
label: "host Path Enabled"
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
hidden: true
|
||||||
|
- variable: hostPath
|
||||||
|
label: "Host Path"
|
||||||
|
schema:
|
||||||
|
type: hostpath
|
||||||
|
required: true
|
||||||
|
```
|
|
@ -33,3 +33,7 @@ Setting permissions automatically means we `chown` the folder and all folder wit
|
||||||
However, we only do so when installing or updating an app.
|
However, we only do so when installing or updating an app.
|
||||||
|
|
||||||
These permission get based on the user and group you enter in the App configuration dialog and default to `568` (the SCALE default Apps user).
|
These permission get based on the user and group you enter in the App configuration dialog and default to `568` (the SCALE default Apps user).
|
||||||
|
|
||||||
|
### Custom Storage
|
||||||
|
|
||||||
|
Besides the earlier mentioned storage options, we also provide the option to mount as many host folders as you want. This is limited to hostPath mounts only.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
kubeVersion: ">=1.16.0-0"
|
kubeVersion: ">=1.16.0-0"
|
||||||
name: common-test
|
name: common-test
|
||||||
version: 1.3.2
|
version: 1.4.0
|
||||||
# upstream_version:
|
# upstream_version:
|
||||||
# appVersion:
|
# appVersion:
|
||||||
description: Helper chart to test different use cases of the common library
|
description: Helper chart to test different use cases of the common library
|
||||||
|
|
|
@ -25,16 +25,32 @@ appVolumeMounts:
|
||||||
emptyDir: true
|
emptyDir: true
|
||||||
datasetName: "data"
|
datasetName: "data"
|
||||||
mountPath: "/data"
|
mountPath: "/data"
|
||||||
hostPathEnabled: true
|
hostPathEnabled: false
|
||||||
hostPath: "/tmp"
|
hostPath: ""
|
||||||
test:
|
test:
|
||||||
enabled: true
|
enabled: true
|
||||||
emptyDir: true
|
emptyDir: false
|
||||||
datasetName: "test"
|
datasetName: "test"
|
||||||
mountPath: "/test"
|
mountPath: "/test"
|
||||||
hostPathEnabled: true
|
hostPathEnabled: true
|
||||||
hostPath: "/tmp"
|
hostPath: "/tmp"
|
||||||
|
|
||||||
|
appExtraVolumeMounts:
|
||||||
|
- name: "extratest1"
|
||||||
|
enabled: true
|
||||||
|
emptyDir: true
|
||||||
|
datasetName: "extratest1"
|
||||||
|
mountPath: "/extratest1"
|
||||||
|
hostPathEnabled: false
|
||||||
|
hostPath: ""
|
||||||
|
- name: "extratest2"
|
||||||
|
enabled: true
|
||||||
|
emptyDir: false
|
||||||
|
datasetName: "extratest2"
|
||||||
|
mountPath: "/extratest2"
|
||||||
|
hostPathEnabled: true
|
||||||
|
hostPath: "/tmp"
|
||||||
|
|
||||||
appAdditionalServicesEnabled: true
|
appAdditionalServicesEnabled: true
|
||||||
appAdditionalServices:
|
appAdditionalServices:
|
||||||
extra-tcp:
|
extra-tcp:
|
||||||
|
|
|
@ -33,16 +33,32 @@ appVolumeMounts:
|
||||||
emptyDir: true
|
emptyDir: true
|
||||||
datasetName: "data"
|
datasetName: "data"
|
||||||
mountPath: "/data"
|
mountPath: "/data"
|
||||||
hostPathEnabled: true
|
hostPathEnabled: false
|
||||||
hostPath: "/tmp"
|
hostPath: ""
|
||||||
test:
|
test:
|
||||||
enabled: true
|
enabled: true
|
||||||
emptyDir: true
|
emptyDir: false
|
||||||
datasetName: "test"
|
datasetName: "test"
|
||||||
mountPath: "/test"
|
mountPath: "/test"
|
||||||
hostPathEnabled: true
|
hostPathEnabled: true
|
||||||
hostPath: "/tmp"
|
hostPath: "/tmp"
|
||||||
|
|
||||||
|
appExtraVolumeMounts:
|
||||||
|
- name: "extratest1"
|
||||||
|
enabled: true
|
||||||
|
emptyDir: true
|
||||||
|
datasetName: "extratest1"
|
||||||
|
mountPath: "/extratest1"
|
||||||
|
hostPathEnabled: false
|
||||||
|
hostPath: ""
|
||||||
|
- name: "extratest2"
|
||||||
|
enabled: true
|
||||||
|
emptyDir: false
|
||||||
|
datasetName: "extratest2"
|
||||||
|
mountPath: "/extratest2"
|
||||||
|
hostPathEnabled: true
|
||||||
|
hostPath: "/tmp"
|
||||||
|
|
||||||
appAdditionalServicesEnabled: true
|
appAdditionalServicesEnabled: true
|
||||||
appAdditionalServices:
|
appAdditionalServices:
|
||||||
extra-tcp:
|
extra-tcp:
|
||||||
|
|
|
@ -21,11 +21,27 @@ appVolumeMounts:
|
||||||
hostPath: ""
|
hostPath: ""
|
||||||
test:
|
test:
|
||||||
enabled: true
|
enabled: true
|
||||||
emptyDir: true
|
emptyDir: false
|
||||||
datasetName: "test"
|
datasetName: "test"
|
||||||
mountPath: "/test"
|
mountPath: "/test"
|
||||||
|
hostPathEnabled: true
|
||||||
|
hostPath: "/tmp"
|
||||||
|
|
||||||
|
appExtraVolumeMounts:
|
||||||
|
- name: "extratest1"
|
||||||
|
enabled: true
|
||||||
|
emptyDir: true
|
||||||
|
datasetName: "extratest1"
|
||||||
|
mountPath: "/extratest1"
|
||||||
hostPathEnabled: false
|
hostPathEnabled: false
|
||||||
hostPath: ""
|
hostPath: ""
|
||||||
|
- name: "extratest2"
|
||||||
|
enabled: true
|
||||||
|
emptyDir: false
|
||||||
|
datasetName: "extratest2"
|
||||||
|
mountPath: "/extratest2"
|
||||||
|
hostPathEnabled: true
|
||||||
|
hostPath: "/tmp"
|
||||||
|
|
||||||
appAdditionalServicesEnabled: true
|
appAdditionalServicesEnabled: true
|
||||||
appAdditionalServices:
|
appAdditionalServices:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
kubeVersion: ">=1.16.0-0"
|
kubeVersion: ">=1.16.0-0"
|
||||||
name: common
|
name: common
|
||||||
version: 1.5.0
|
version: 1.6.0
|
||||||
# upstream_version: 3.0.1
|
# upstream_version: 3.0.1
|
||||||
# appVersion:
|
# appVersion:
|
||||||
description: Function library for TrueCharts
|
description: Function library for TrueCharts
|
||||||
|
|
|
@ -65,7 +65,7 @@ The main container included in the controller.
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- include "common.storage.configuredAppVolumeMounts" . | indent 2 }}
|
{{ include "common.storage.allContainerVolumeMounts" . | nindent 2 }}
|
||||||
{{- if .Values.additionalVolumeMounts }}
|
{{- if .Values.additionalVolumeMounts }}
|
||||||
{{- toYaml .Values.additionalVolumeMounts | nindent 2 }}
|
{{- toYaml .Values.additionalVolumeMounts | nindent 2 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -25,7 +25,7 @@ Volumes included by the controller.
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- include "common.storage.configuredAppVolumes" . }}
|
{{ include "common.storage.allAppVolumes" . | nindent 0 }}
|
||||||
{{- if .Values.additionalVolumes }}
|
{{- if .Values.additionalVolumes }}
|
||||||
{{- toYaml .Values.additionalVolumes | nindent 0 }}
|
{{- toYaml .Values.additionalVolumes | nindent 0 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -1,40 +1,76 @@
|
||||||
{{/*
|
{{/*
|
||||||
Define appVolumeMounts for container
|
Define appVolumeMounts for container
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "common.storage.configuredAppVolumeMounts" -}}
|
{{- define "common.storage.configureAppVolumeMountsInContainer" -}}
|
||||||
{{- if .Values.appVolumeMounts }}
|
{{ range $name, $avm := . }}
|
||||||
{{- range $name, $avm := .Values.appVolumeMounts -}}
|
{{- if (default true $avm.enabled) -}}
|
||||||
{{- if $avm.enabled }}
|
{{ if $avm.name }}
|
||||||
|
{{ $name = $avm.name }}
|
||||||
|
{{ end }}
|
||||||
- name: {{ $name }}
|
- name: {{ $name }}
|
||||||
mountPath: {{ $avm.mountPath }}
|
mountPath: {{ $avm.mountPath }}
|
||||||
{{- if $avm.subPath }}
|
{{ if $avm.subPath }}
|
||||||
subPath: {{ $avm.subPath }}
|
subPath: {{ $avm.subPath }}
|
||||||
{{- end }}
|
{{ end }}
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{ end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Define hostPath for appVolumes
|
Define hostPath for appVolumes
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "common.storage.configuredAppVolumes" -}}
|
{{- define "common.storage.configureAppVolumes" -}}
|
||||||
{{- if .Values.appVolumeMounts }}
|
{{- range $name, $av := $.volMounts -}}
|
||||||
{{- range $name, $av := .Values.appVolumeMounts -}}
|
{{ if (default true $av.enabled) }}
|
||||||
{{- if $av.enabled }}
|
{{ if $av.name }}
|
||||||
|
{{ $name = $av.name }}
|
||||||
|
{{ end }}
|
||||||
- name: {{ $name }}
|
- name: {{ $name }}
|
||||||
{{- if $av.emptyDir }}
|
{{ if $av.emptyDir }}
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
{{- else }}
|
{{- else -}}
|
||||||
hostPath:
|
hostPath:
|
||||||
{{ if $av.hostPathEnabled }}
|
{{ if $av.hostPathEnabled }}
|
||||||
path: {{ required "hostPath not set" $av.hostPath }}
|
path: {{ required "hostPath not set" $av.hostPath }}
|
||||||
{{- else }}
|
{{ else }}
|
||||||
{{- $volDict := dict "datasetName" $av.datasetName "ixVolumes" $.Values.ixVolumes -}}
|
{{- $ixVolDict := dict "datasetName" $av.datasetName "ixVolumes" $.ixVolumes -}}
|
||||||
path: {{ include "common.storage.retrieveHostPathFromiXVolume" $volDict }}
|
path: {{ include "common.storage.retrieveHostPathFromiXVolume" $ixVolDict }}
|
||||||
{{- end }}
|
{{ end }}
|
||||||
{{- end }}
|
{{ end }}
|
||||||
{{- end }}
|
{{ end }}
|
||||||
{{- end }}
|
{{- end -}}
|
||||||
{{- end }}
|
{{- end -}}
|
||||||
|
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get all volumes configuration
|
||||||
|
*/}}
|
||||||
|
{{- define "common.storage.allAppVolumes" -}}
|
||||||
|
|
||||||
|
{{- $volDict := dict "volMounts" .Values.appVolumeMounts "ixVolumes" .Values.ixVolumes -}}
|
||||||
|
{{- $volExtraDict := dict "volMounts" .Values.appExtraVolumeMounts "ixVolumes" .Values.ixVolumes -}}
|
||||||
|
|
||||||
|
{{- if .Values.appVolumeMounts -}}
|
||||||
|
{{- include "common.storage.configureAppVolumes" $volDict | nindent 0 -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Values.appExtraVolumeMounts -}}
|
||||||
|
{{- include "common.storage.configureAppVolumes" $volExtraDict | nindent 0 -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Get all container volume moutns configuration
|
||||||
|
*/}}
|
||||||
|
{{- define "common.storage.allContainerVolumeMounts" -}}
|
||||||
|
|
||||||
|
{{- if .Values.appVolumeMounts -}}
|
||||||
|
{{- include "common.storage.configureAppVolumeMountsInContainer" .Values.appVolumeMounts | nindent 0 -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- if .Values.appExtraVolumeMounts -}}
|
||||||
|
{{- include "common.storage.configureAppVolumeMountsInContainer" .Values.appExtraVolumeMounts | nindent 0 -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -55,7 +55,7 @@ spec:
|
||||||
#securityContext:
|
#securityContext:
|
||||||
#
|
#
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
{{- include "common.storage.configuredAppVolumeMounts" . | indent 12 }}
|
{{- include "common.storage.allContainerVolumeMounts" . | indent 12 }}
|
||||||
{{- with (include "common.controller.volumes" . | trim) }}
|
{{- with (include "common.controller.volumes" . | trim) }}
|
||||||
volumes:
|
volumes:
|
||||||
{{- . | nindent 8 }}
|
{{- . | nindent 8 }}
|
||||||
|
|
|
@ -493,8 +493,8 @@ fixMountPermissions: true
|
||||||
# hostPath: ""
|
# hostPath: ""
|
||||||
# setPermissions: true
|
# setPermissions: true
|
||||||
|
|
||||||
#
|
# appExtraVolumeMounts:
|
||||||
# data:
|
# - name: "data"
|
||||||
# enabled: false
|
# enabled: false
|
||||||
# emptyDir: false
|
# emptyDir: false
|
||||||
# datasetName: "data"
|
# datasetName: "data"
|
||||||
|
@ -502,6 +502,7 @@ fixMountPermissions: true
|
||||||
# subPath: some-subpath
|
# subPath: some-subpath
|
||||||
# hostPathEnabled: false
|
# hostPathEnabled: false
|
||||||
# hostPath: ""
|
# hostPath: ""
|
||||||
|
# setPermissions: true
|
||||||
|
|
||||||
# appIngress:
|
# appIngress:
|
||||||
# main:
|
# main:
|
||||||
|
|
Loading…
Reference in New Issue