mirror of
https://github.com/truenas/charts.git
synced 2024-04-21 15:21:45 +00:00
Add volumeMounts and fix volume tests.
This commit is contained in:
@@ -18,6 +18,7 @@ tests:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
sizeLimit: 1Gi
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -33,6 +34,7 @@ tests:
|
||||
volume1:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -49,6 +51,7 @@ tests:
|
||||
type: emptyDir
|
||||
medium: Memory
|
||||
sizeLimit: 1Gi
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -69,6 +72,7 @@ tests:
|
||||
type: emptyDir
|
||||
medium: "{{ .Values.some_medium }}"
|
||||
sizeLimit: "{{ .Values.some_size }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -86,6 +90,7 @@ tests:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: Memory
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -102,6 +107,7 @@ tests:
|
||||
enabled: true
|
||||
type: emptyDir
|
||||
medium: not_memory
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -115,6 +121,7 @@ tests:
|
||||
type: nfs
|
||||
server: some.server.local
|
||||
path: /nfs/path
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -132,6 +139,7 @@ tests:
|
||||
enabled: true
|
||||
type: hostpath
|
||||
hostPath: /mnt/pool/test
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -150,6 +158,7 @@ tests:
|
||||
type: hostpath
|
||||
hostPathType: "{{ .Values.some_key }}"
|
||||
hostPath: /mnt/pool/test
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -166,6 +175,7 @@ tests:
|
||||
some_volume:
|
||||
type: not_valid_persistence
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -177,6 +187,7 @@ tests:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -188,6 +199,7 @@ tests:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -199,6 +211,7 @@ tests:
|
||||
some_volume:
|
||||
type: hostPath
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -211,6 +224,7 @@ tests:
|
||||
type: nfs
|
||||
enabled: true
|
||||
path: some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -223,6 +237,7 @@ tests:
|
||||
type: nfs
|
||||
enabled: true
|
||||
server: some_server
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -234,6 +249,7 @@ tests:
|
||||
some_volume:
|
||||
type: secret
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -245,6 +261,7 @@ tests:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -257,6 +274,7 @@ tests:
|
||||
type: secret
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -274,6 +292,7 @@ tests:
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: 777
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -292,6 +311,7 @@ tests:
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "777"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -311,6 +331,7 @@ tests:
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "{{ .Values.mode }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -330,6 +351,7 @@ tests:
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "{{ .Values.mode }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -349,6 +371,7 @@ tests:
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- path: some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -363,6 +386,7 @@ tests:
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -378,6 +402,7 @@ tests:
|
||||
items:
|
||||
- key: some_key
|
||||
path: some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -402,6 +427,7 @@ tests:
|
||||
items:
|
||||
- key: "{{ .Values.key }}"
|
||||
path: "{{ .Values.path }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -420,6 +446,7 @@ tests:
|
||||
some_volume:
|
||||
type: configMap
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -432,6 +459,7 @@ tests:
|
||||
type: configMap
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -449,6 +477,7 @@ tests:
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: 777
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -467,6 +496,7 @@ tests:
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "777"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -486,6 +516,7 @@ tests:
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "{{ .Values.mode }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -505,6 +536,7 @@ tests:
|
||||
enabled: true
|
||||
objectName: some_object_name
|
||||
defaultMode: "{{ .Values.mode }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -525,6 +557,7 @@ tests:
|
||||
items:
|
||||
- key: some_key
|
||||
path: some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -546,6 +579,7 @@ tests:
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- path: some_path
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -560,6 +594,7 @@ tests:
|
||||
objectName: some_object_name
|
||||
items:
|
||||
- key: some_key
|
||||
noMount: true
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -577,6 +612,7 @@ tests:
|
||||
items:
|
||||
- key: "{{ .Values.key }}"
|
||||
path: "{{ .Values.path }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -595,6 +631,7 @@ tests:
|
||||
some_volume:
|
||||
type: pvc
|
||||
enabled: true
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -611,6 +648,7 @@ tests:
|
||||
type: pvc
|
||||
enabled: true
|
||||
existingClaim: some_existing_claim
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -628,6 +666,7 @@ tests:
|
||||
type: pvc
|
||||
enabled: true
|
||||
existingClaim: "{{ .Values.claim }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -644,6 +683,7 @@ tests:
|
||||
type: pvc
|
||||
enabled: true
|
||||
nameOverride: some_claim
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -661,6 +701,7 @@ tests:
|
||||
type: pvc
|
||||
enabled: true
|
||||
nameOverride: "{{ .Values.claim }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -677,6 +718,7 @@ tests:
|
||||
type: pvc
|
||||
enabled: true
|
||||
forceName: forced_name
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
@@ -694,6 +736,7 @@ tests:
|
||||
type: pvc
|
||||
enabled: true
|
||||
forceName: "{{ .Values.claim }}"
|
||||
noMount: true
|
||||
asserts:
|
||||
- equal:
|
||||
documentIndex: *deploymentDoc
|
||||
|
||||
@@ -1,4 +1,39 @@
|
||||
{{/* Volume Mounts included by the container. */}}
|
||||
{{- define "ix.v1.common.container.volumeMounts" -}}
|
||||
{{- $defaultType := "pvc" -}}
|
||||
{{- range $index, $item := .Values.persistence -}}
|
||||
{{- if $item.enabled -}}
|
||||
{{- if not $item.noMount -}}
|
||||
{{- $mountPath := "" -}}
|
||||
{{- if not $item.mountPath -}} {{/* Make sure that we have a mountPath */}}
|
||||
{{- fail "<mountPath> must be defined, alternatively use the <noMount> flag." -}}
|
||||
{{- end -}}
|
||||
- mountPath: {{ tpl $item.mountPath $ }}
|
||||
name: {{ tpl $index $ }}
|
||||
{{- with $item.subPath }}
|
||||
subPath: {{ tpl . $ }}
|
||||
{{- end }}
|
||||
{{- with $item.readOnly }}
|
||||
readOnly: {{ . }}
|
||||
{{- end }}
|
||||
{{- with $item.mountPropagation }}
|
||||
mountPropagation: {{ tpl . $ }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
{{- if eq (.Values.controller.type | lower) "statefulset" -}}
|
||||
{{- range $index, $vct := .Values.volumeClaimTemplates }}
|
||||
{{- if not $vct.mountPath -}} {{/* Make sure that we have a mountPath */}}
|
||||
{{- fail "<mountPath> must be defined, alternatively use the <noMount> flag." -}}
|
||||
{{- end -}}
|
||||
- mountPath: {{ $vct.mountPath }}
|
||||
name: {{ tpl (toString $index) $ }}
|
||||
{{- with $vct.subPath }}
|
||||
subPath: {{ tpl . $ }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -53,6 +53,10 @@
|
||||
{{- include "ix.v1.common.container.envFrom" $context | indent 2 -}}
|
||||
{{/* Ports */}}
|
||||
{{- include "ix.v1.common.container.ports" . | indent 2 -}}
|
||||
{{- with (include "ix.v1.common.container.volumeMounts" . | trim) }}
|
||||
volumeMounts:
|
||||
{{- . | nindent 4 }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
|
||||
@@ -168,7 +168,7 @@ service:
|
||||
enabled: true
|
||||
# enabled: false
|
||||
# -- The port number (Default port is required if enabled: true)
|
||||
port: 999999
|
||||
port: 999999 # TODO:
|
||||
# -- Port protocol.
|
||||
# Support values are `HTTP`, `HTTPS`, `TCP` and `UDP`.
|
||||
# HTTPS and HTTPS spawn a TCP service and get used for internal URL and name generation
|
||||
@@ -199,11 +199,25 @@ persistence:
|
||||
# value: somevalue
|
||||
# -- Add annotations to PVC object
|
||||
annotations: {}
|
||||
labelsList: []
|
||||
# - name: somename
|
||||
# value: somevalue
|
||||
# -- Set labels on the deployment/statefulset/daemonset
|
||||
# -- Provide additional labels which may be required.
|
||||
# -- Add labels to PVC object
|
||||
labels: {}
|
||||
# -- If you want to reuse an existing claim, the name of the existing PVC can be passed here.
|
||||
existingClaim: ""
|
||||
# -- force the complete PVC name
|
||||
# Will not add any prefix or suffix
|
||||
forceName: ""
|
||||
# -- Where to mount the volume in the main container.
|
||||
mountPath: # /config
|
||||
# -- Specify if the volume should be mounted read-only.
|
||||
readOnly: false
|
||||
# -- Creates the volume but skips the volumeMount
|
||||
noMount: false
|
||||
|
||||
# -- Example of a hostPath mount
|
||||
# [[ref]]https://kubernetes.io/docs/concepts/storage/volumes/#hostpath)
|
||||
# @default -- See below
|
||||
@@ -331,3 +345,10 @@ persistence:
|
||||
# -- If the `SizeMemoryBackedVolumes` feature gate is enabled, you can
|
||||
# specify a size for memory backed volumes.
|
||||
sizeLimit: # 1Gi
|
||||
|
||||
# -- Used in conjunction with `controller.type: statefulset` to create individual disks for each instance.
|
||||
volumeClaimTemplates: {}
|
||||
# data:
|
||||
# mountPath: /data
|
||||
# accessMode: "ReadWriteOnce"
|
||||
# size: 1Gi
|
||||
|
||||
Reference in New Issue
Block a user