summaryrefslogtreecommitdiffstats
path: root/roles/ands_kaas/templates/00-gfs-volumes.yml.j2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/ands_kaas/templates/00-gfs-volumes.yml.j2')
-rw-r--r--roles/ands_kaas/templates/00-gfs-volumes.yml.j211
1 files changed, 10 insertions, 1 deletions
diff --git a/roles/ands_kaas/templates/00-gfs-volumes.yml.j2 b/roles/ands_kaas/templates/00-gfs-volumes.yml.j2
index a69942d..54064e4 100644
--- a/roles/ands_kaas/templates/00-gfs-volumes.yml.j2
+++ b/roles/ands_kaas/templates/00-gfs-volumes.yml.j2
@@ -7,6 +7,10 @@ metadata:
descriptions: "{{ kaas_project }} glusterfs volumes"
objects:
{% for name, vol in kaas_project_volumes.iteritems() %}
+{% set voltypes = kaas_storage_domains | json_query("[*].volumes." + vol.volume + ".type") %}
+{% set voltype = voltypes[0] | default('host') %}
+{% set mntpaths = kaas_storage_domains | json_query("[*].volumes." + vol.volume + ".mount") %}
+{% set mntpath = mntpaths[0] | default('') %}
{% set oc_name = vol.name | default(name) | regex_replace('_','-') %}
{% set cfgpath = vol.path | default("") %}
{% set path = cfgpath if cfgpath[:1] == "/" else "/" + kaas_project + "/" + cfgpath %}
@@ -21,9 +25,14 @@ objects:
name: {{ pvname }}
spec:
persistentVolumeReclaimPolicy: Retain
+{% if voltype == 'host' %}
+ hostPath:
+ path: "{{ mntpath }}{{ path }}"
+{% else %}
glusterfs:
endpoints: {{ kaas_glusterfs_endpoints }}
- path: "{{ vol.volume }}{{path}}"
+ path: "{{ vol.volume }}{{ path }}"
+{% endif %}
readOnly: {{ not (vol.write | default(false)) }}
accessModes:
- {{ vol.access | default(vol.write | default(false) | ternary('ReadWriteMany', 'ReadOnlyMany')) }}