From c7124d09eb19a0f20d8e60ccf43eccbedf1e8c29 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Tue, 21 Mar 2017 17:26:21 -0400 Subject: Adding configmap support. --- roles/lib_openshift/src/ansible/oc_volume.py | 4 +++- roles/lib_openshift/src/class/oc_volume.py | 6 +++++- roles/lib_openshift/src/doc/volume | 6 ++++++ roles/lib_openshift/src/lib/volume.py | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'roles/lib_openshift/src') diff --git a/roles/lib_openshift/src/ansible/oc_volume.py b/roles/lib_openshift/src/ansible/oc_volume.py index 955680543..660376d2f 100644 --- a/roles/lib_openshift/src/ansible/oc_volume.py +++ b/roles/lib_openshift/src/ansible/oc_volume.py @@ -17,7 +17,7 @@ def main(): vol_name=dict(default=None, type='str'), name=dict(default=None, type='str'), mount_type=dict(default=None, - choices=['emptydir', 'hostpath', 'secret', 'pvc'], + choices=['emptydir', 'hostpath', 'secret', 'pvc', 'configmap'], type='str'), mount_path=dict(default=None, type='str'), # secrets require a name @@ -25,6 +25,8 @@ def main(): # pvc requires a size claim_size=dict(default=None, type='str'), claim_name=dict(default=None, type='str'), + # configmap requires a name + configmap_name=dict(default=None, type='str'), ), supports_check_mode=True, ) diff --git a/roles/lib_openshift/src/class/oc_volume.py b/roles/lib_openshift/src/class/oc_volume.py index 3509e9178..5211a1afd 100644 --- a/roles/lib_openshift/src/class/oc_volume.py +++ b/roles/lib_openshift/src/class/oc_volume.py @@ -26,6 +26,7 @@ class OCVolume(OpenShiftCLI): secret_name, claim_size, claim_name, + configmap_name, kubeconfig='/etc/origin/master/admin.kubeconfig', verbose=False): ''' Constructor for OCVolume ''' @@ -36,7 +37,8 @@ class OCVolume(OpenShiftCLI): 'path': mount_path, 'type': mount_type, 'claimSize': claim_size, - 'claimName': claim_name} + 'claimName': claim_name, + 'configmap_name': configmap_name} self.volume, self.volume_mount = Volume.create_volume_structure(self.volume_info) self.name = resource_name self.namespace = namespace @@ -112,6 +114,8 @@ class OCVolume(OpenShiftCLI): # pvc params['claim_size'], params['claim_name'], + # configmap + params['configmap_name'], kubeconfig=params['kubeconfig'], verbose=params['debug']) diff --git a/roles/lib_openshift/src/doc/volume b/roles/lib_openshift/src/doc/volume index 8112c79c2..1d04afeef 100644 --- a/roles/lib_openshift/src/doc/volume +++ b/roles/lib_openshift/src/doc/volume @@ -80,6 +80,12 @@ options: required: false default: None aliases: [] + configmap_name: + description: + - The name of the configmap + required: false + default: None + aliases: [] author: - "Kenny Woodson " extends_documentation_fragment: [] diff --git a/roles/lib_openshift/src/lib/volume.py b/roles/lib_openshift/src/lib/volume.py index b0e48523f..c049c8b49 100644 --- a/roles/lib_openshift/src/lib/volume.py +++ b/roles/lib_openshift/src/lib/volume.py @@ -36,7 +36,7 @@ class Volume(object): volume['hostPath']['path'] = volume_info['path'] elif volume_type == 'configmap': volume['configMap'] = {} - volume['configMap']['name'] = volume_info['name'] + volume['configMap']['name'] = volume_info['configmap_name'] volume_mount = {'mountPath': volume_info['path'], 'name': volume_info['name']} -- cgit v1.2.3