ソースを参照

Integrate GlusterFS into OpenShift installation

Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Jose A. Rivera 8 年 前
コミット
044219e750

+ 17 - 0
filter_plugins/oo_filters.py

@@ -773,6 +773,23 @@ def oo_persistent_volumes(hostvars, groups, persistent_volumes=None):
                                     fsType=filesystem,
                                     volumeID=volume_id)))
                         persistent_volumes.append(persistent_volume)
+                    elif kind == 'glusterfs':
+                        volume = params['volume']['name']
+                        size = params['volume']['size']
+                        access_modes = params['access']['modes']
+                        endpoints = params['glusterfs']['endpoints']
+                        path = params['glusterfs']['path']
+                        read_only = params['glusterfs']['readOnly']
+                        persistent_volume = dict(
+                            name="{0}-volume".format(volume),
+                            capacity=size,
+                            access_modes=access_modes,
+                            storage=dict(
+                                glusterfs=dict(
+                                    endpoints=endpoints,
+                                    path=path,
+                                    readOnly=read_only)))
+                        persistent_volumes.append(persistent_volume)
                     elif not (kind == 'object' or kind == 'dynamic'):
                         msg = "|failed invalid storage kind '{0}' for component '{1}'".format(
                             kind,

+ 2 - 0
playbooks/byo/openshift-cluster/cluster_hosts.yml

@@ -13,6 +13,8 @@ g_new_node_hosts: "{{ groups.new_nodes | default([]) }}"
 
 g_nfs_hosts: "{{ groups.nfs | default([]) }}"
 
+g_glusterfs_hosts: "{{ groups.glusterfs | default([]) }}"
+
 g_all_hosts: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts)
                  | union(g_lb_hosts) | union(g_nfs_hosts)
                  | union(g_new_node_hosts)| union(g_new_master_hosts)

+ 4 - 0
playbooks/common/openshift-cluster/config.yml

@@ -54,6 +54,10 @@
   tags:
   - node
 
+- include: ../openshift-glusterfs/config.yml
+  tags:
+  - glusterfs
+
 - include: openshift_hosted.yml
   tags:
   - hosted

+ 13 - 0
playbooks/common/openshift-cluster/evaluate_groups.yml

@@ -29,6 +29,10 @@
       msg: The nfs group must be limited to one host
     when: "{{ (groups[g_nfs_hosts] | default([])) | length > 1 }}"
 
+  - fail:
+      msg: This playbook requires g_glusterfs_hosts to be set
+    when: "{{ g_glusterfs_hosts is not defined }}"
+
   - name: Evaluate oo_all_hosts
     add_host:
       name: "{{ item }}"
@@ -119,3 +123,12 @@
       ansible_become: "{{ g_sudo | default(omit) }}"
     with_items: "{{ g_nfs_hosts | default([]) }}"
     changed_when: no
+
+  - name: Evaluate oo_glusterfs_to_config
+    add_host:
+      name: "{{ item }}"
+      groups: oo_glusterfs_to_config
+      ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
+      ansible_become: "{{ g_sudo | default(omit) }}"
+    with_items: "{{ g_glusterfs_hosts | default([]) }}"
+    changed_when: no