From 8ff6f015e2e4ab10063d5d76ef0a454466b818a9 Mon Sep 17 00:00:00 2001
From: Mangirdas <m.judeikis@gmail.com>
Date: Sun, 19 Nov 2017 18:18:03 +0000
Subject: Add check for gluterFS DS to stop restarts

---
 roles/openshift_storage_glusterfs/tasks/glusterfs_deploy.yml | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'roles')

diff --git a/roles/openshift_storage_glusterfs/tasks/glusterfs_deploy.yml b/roles/openshift_storage_glusterfs/tasks/glusterfs_deploy.yml
index ef37762f9..30e83e79b 100644
--- a/roles/openshift_storage_glusterfs/tasks/glusterfs_deploy.yml
+++ b/roles/openshift_storage_glusterfs/tasks/glusterfs_deploy.yml
@@ -77,6 +77,14 @@
     files:
     - "{{ mktemp.stdout }}/glusterfs-template.yml"
 
+- name: Check GlusterFS DaemonSet status
+  oc_obj:
+    namespace: "{{ glusterfs_namespace }}"
+    kind: daemonset
+    name: glusterfs-{{ glusterfs_name }}
+    state: list
+  register: glusterfs_ds
+
 - name: Deploy GlusterFS pods
   oc_process:
     namespace: "{{ glusterfs_namespace }}"
@@ -88,6 +96,8 @@
       NODE_LABELS: "{{ glusterfs_nodeselector }}"
       CLUSTER_NAME: "{{ glusterfs_name }}"
       GB_GLFS_LRU_COUNT: "{{ glusterfs_block_host_vol_max }}"
+  when: (glusterfs_ds.results.results[0].status is not defined) or
+        (glusterfs_ds.results.results[0].status.numberReady | default(0) < glusterfs_ds.results.results[0].status.desiredNumberScheduled | default(glusterfs_nodes | count))
 
 - name: Wait for GlusterFS pods
   oc_obj:
-- 
cgit v1.2.3