summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
authorJose A. Rivera <jarrpa@redhat.com>2017-04-17 17:46:14 -0500
committerJose A. Rivera <jarrpa@redhat.com>2017-05-04 11:44:54 +0200
commit483870112d3a079709b231f1128b979fc5e60c52 (patch)
treefb1f428a0f19623321d9d2176428be903963f072 /playbooks
parent1328328522f11db02d526f72df66c424f3dfbfa3 (diff)
downloadopenshift-483870112d3a079709b231f1128b979fc5e60c52.tar.gz
openshift-483870112d3a079709b231f1128b979fc5e60c52.tar.bz2
openshift-483870112d3a079709b231f1128b979fc5e60c52.tar.xz
openshift-483870112d3a079709b231f1128b979fc5e60c52.zip
GlusterFS: Allow swapping an existing registry's backend storage
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/byo/openshift-glusterfs/README.md8
-rw-r--r--playbooks/common/openshift-glusterfs/registry.yml47
2 files changed, 53 insertions, 2 deletions
diff --git a/playbooks/byo/openshift-glusterfs/README.md b/playbooks/byo/openshift-glusterfs/README.md
index 823ad5e29..f62aea229 100644
--- a/playbooks/byo/openshift-glusterfs/README.md
+++ b/playbooks/byo/openshift-glusterfs/README.md
@@ -39,6 +39,11 @@ registry, specify a `glusterfs_registry` group that is populated as the
`glusterfs_registry` group is specified, the cluster defined by the `glusterfs`
group will be used.
+To swap an existing hosted registry's backend storage for a GlusterFS volume,
+specify `openshift_hosted_registry_storage_glusterfs_swap=True`. To
+additoinally copy any existing contents from an existing hosted registry,
+specify `openshift_hosted_registry_storage_glusterfs_swapcopy=True`.
+
**NOTE:** For each namespace that is to have access to GlusterFS volumes an
Enpoints resource pointing to the GlusterFS cluster nodes and a corresponding
Service resource must be created. If dynamic provisioning using StorageClasses
@@ -89,4 +94,5 @@ See the documentation in the role's directory for further details.
## Role: openshift_hosted
The `openshift_hosted` role recognizes `glusterfs` as a possible storage
-backend for a hosted docker registry.
+backend for a hosted docker registry. It will also, if configured, handle the
+swap of an existing registry's backend storage to a GlusterFS volume.
diff --git a/playbooks/common/openshift-glusterfs/registry.yml b/playbooks/common/openshift-glusterfs/registry.yml
index caae79f0f..80cf7529e 100644
--- a/playbooks/common/openshift-glusterfs/registry.yml
+++ b/playbooks/common/openshift-glusterfs/registry.yml
@@ -1,4 +1,49 @@
---
- include: config.yml
-- include: ../openshift-cluster/openshift_hosted.yml
+- name: Initialize GlusterFS registry PV and PVC vars
+ hosts: oo_first_master
+ tags: hosted
+ tasks:
+ - set_fact:
+ glusterfs_pv: []
+ glusterfs_pvc: []
+
+ - set_fact:
+ glusterfs_pv:
+ - name: "{{ openshift.hosted.registry.storage.volume.name }}-glusterfs-volume"
+ capacity: "{{ openshift.hosted.registry.storage.volume.size }}"
+ access_modes: "{{ openshift.hosted.registry.storage.access.modes }}"
+ storage:
+ glusterfs:
+ endpoints: "{{ openshift.hosted.registry.storage.glusterfs.endpoints }}"
+ path: "{{ openshift.hosted.registry.storage.glusterfs.path }}"
+ readOnly: "{{ openshift.hosted.registry.storage.glusterfs.readOnly }}"
+ glusterfs_pvc:
+ - 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
+
+- name: Create persistent volumes
+ hosts: oo_first_master
+ tags:
+ - hosted
+ vars:
+ persistent_volumes: "{{ hostvars[groups.oo_first_master.0] | oo_persistent_volumes(groups, glusterfs_pv) }}"
+ persistent_volume_claims: "{{ hostvars[groups.oo_first_master.0] | oo_persistent_volume_claims(glusterfs_pvc) }}"
+ roles:
+ - role: openshift_persistent_volumes
+ when: persistent_volumes | union(glusterfs_pv) | length > 0 or persistent_volume_claims | union(glusterfs_pvc) | length > 0
+
+- name: Create Hosted Resources
+ hosts: oo_first_master
+ tags:
+ - hosted
+ pre_tasks:
+ - set_fact:
+ openshift_hosted_router_registryurl: "{{ hostvars[groups.oo_first_master.0].openshift.master.registry_url }}"
+ openshift_hosted_registry_registryurl: "{{ hostvars[groups.oo_first_master.0].openshift.master.registry_url }}"
+ when: "'master' in hostvars[groups.oo_first_master.0].openshift and 'registry_url' in hostvars[groups.oo_first_master.0].openshift.master"
+ roles:
+ - role: openshift_hosted