Skip to content

Commit

Permalink
Add support for hostpath persistent volume definitions
Browse files Browse the repository at this point in the history
hostpath volumes [1] mount a file or directory from the host node’s
filesystem into a pod. This adds support for declaring a hostPath
volume as a persistent volume and do a persistent volume claim for
one for the hosted registry.

[1]: https://kubernetes.io/docs/concepts/storage/volumes/#hostpath
  • Loading branch information
David Moreau-Simard committed Nov 6, 2017
1 parent 5efcf4a commit 9225c4a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions filter_plugins/oo_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,25 @@ def oo_component_persistent_volumes(hostvars, groups, component, subcomponent=No
path=path,
readOnly=read_only)))

elif kind == 'hostpath':
volume = params['volume']['name']
size = params['volume']['size']
if 'labels' in params:
labels = params['labels']
else:
labels = dict()
access_modes = params['access']['modes']
path = params['hostpath']['path']
persistent_volume = dict(
name="{0}-volume".format(volume),
capacity=size,
labels=labels,
access_modes=access_modes,
storage=dict(
hostPath=dict(
path=path,
)))

elif not (kind == 'object' or kind == 'dynamic'):
msg = "|failed invalid storage kind '{0}' for component '{1}'".format(
kind,
Expand Down
2 changes: 1 addition & 1 deletion roles/openshift_hosted/tasks/registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
type: persistentVolumeClaim
claim_name: "{{ openshift.hosted.registry.storage.volume.name }}-claim"
when:
- openshift.hosted.registry.storage.kind | default(none) in ['nfs', 'openstack', 'glusterfs']
- openshift.hosted.registry.storage.kind | default(none) in ['nfs', 'openstack', 'glusterfs', 'hostpath']

- name: Create OpenShift registry
oc_adm_registry:
Expand Down

0 comments on commit 9225c4a

Please sign in to comment.