diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2018-03-11 19:24:51 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2018-03-11 19:24:51 +0100 |
commit | 22d3a96deaf74b7aa9aa021a73ef39e2b4da3378 (patch) | |
tree | aed221ebb63cc9e13b54cb1a75a388e6fd7283d7 | |
parent | 9c475cff32d20ec969205ea6eb1c1e6053dcdd6f (diff) | |
download | openshift-22d3a96deaf74b7aa9aa021a73ef39e2b4da3378.tar.gz openshift-22d3a96deaf74b7aa9aa021a73ef39e2b4da3378.tar.bz2 openshift-22d3a96deaf74b7aa9aa021a73ef39e2b4da3378.tar.xz openshift-22d3a96deaf74b7aa9aa021a73ef39e2b4da3378.zip |
Introduce openshift_hosted_registry_storage_class configuration variable to enable dynamicly provisioned GlusterFS volume for hosted registry
4 files changed, 20 insertions, 2 deletions
diff --git a/roles/openshift_hosted/tasks/registry.yml b/roles/openshift_hosted/tasks/registry.yml index bc4d81eb7..472009536 100644 --- a/roles/openshift_hosted/tasks/registry.yml +++ b/roles/openshift_hosted/tasks/registry.yml @@ -112,6 +112,7 @@ when: - openshift_hosted_registry_storage_glusterfs_ips|length > 0 - openshift_hosted_registry_storage_kind | default(none) in ['glusterfs'] + - openshift_hosted_registry_storage_class is not defined - name: Create OpenShift registry oc_adm_registry: diff --git a/roles/openshift_hosted/tasks/registry_storage.yml b/roles/openshift_hosted/tasks/registry_storage.yml index aa66a7867..e1b8c4e5e 100644 --- a/roles/openshift_hosted/tasks/registry_storage.yml +++ b/roles/openshift_hosted/tasks/registry_storage.yml @@ -2,3 +2,4 @@ - include_tasks: storage/glusterfs.yml when: - openshift_hosted_registry_storage_kind | default(none) == 'glusterfs' or openshift_hosted_registry_storage_glusterfs_swap + - openshift_hosted_registry_storage_class is not defined diff --git a/roles/openshift_persistent_volumes/tasks/main.yml b/roles/openshift_persistent_volumes/tasks/main.yml index b1d9c8cca..1c32a6743 100644 --- a/roles/openshift_persistent_volumes/tasks/main.yml +++ b/roles/openshift_persistent_volumes/tasks/main.yml @@ -23,7 +23,21 @@ - name: "{{ openshift_hosted_registry_storage_volume_name }}-glusterfs-claim" capacity: "{{ openshift_hosted_registry_storage_volume_size }}" access_modes: "{{ openshift_hosted_registry_storage_access_modes }}" - when: openshift_hosted_registry_storage_glusterfs_swap | default(False) + when: + - openshift_hosted_registry_storage_glusterfs_swap | default(False) + - openshift_hosted_registry_storage_class is not defined + + +- set_fact: + glusterfs_pv: [] + glusterfs_pvc: + - name: "{{ openshift_hosted_registry_storage_volume_name }}-claim" + storageclass: "{{ openshift_hosted_registry_storage_class }}" + capacity: "{{ openshift_hosted_registry_storage_volume_size }}" + access_modes: "{{ openshift_hosted_registry_storage_access_modes }}" + when: + - openshift_hosted_registry_storage_class is defined + - name: create standard pv and pvc lists # generate_pv_pvcs_list is a custom action module defined in diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml index e91e13033..f3562b671 100644 --- a/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml +++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_registry.yml @@ -12,4 +12,6 @@ - name: Create GlusterFS registry volume command: "{{ glusterfs_heketi_client }} volume create --size={{ openshift_hosted_registry_storage_volume_size | replace('Gi','') }} --name={{ openshift_hosted_registry_storage_glusterfs_path }}" - when: "openshift_hosted_registry_storage_glusterfs_path not in registry_volume.stdout" + when: + - "openshift_hosted_registry_storage_glusterfs_path not in registry_volume.stdout" + - "openshift_hosted_registry_storage_class is not defined" |