summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2015-06-22 15:19:53 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2015-06-22 15:48:07 -0400
commit66dd4499a7e17b985f6033370e5e8b5a9c8f04ac (patch)
tree68a46a290072f5d4f6d7fe81ebf81d9b02f4ff23
parenta7ac3f7b513fe57ddccad15bdb6c7e9091f16bcd (diff)
downloadopenshift-66dd4499a7e17b985f6033370e5e8b5a9c8f04ac.tar.gz
openshift-66dd4499a7e17b985f6033370e5e8b5a9c8f04ac.tar.bz2
openshift-66dd4499a7e17b985f6033370e5e8b5a9c8f04ac.tar.xz
openshift-66dd4499a7e17b985f6033370e5e8b5a9c8f04ac.zip
Adding support for labeling nodes as unscheduleable
For idempotency it first checks the output of 'oc get node <hostname>' to see if any action needs to be taken. The trick was waiting to make sure that the node autoregistration had actually happened. If you set openshift_scheduleable=False in the inventory then the node will be marked as unscheduleable. Likewise setting it to True undoes the change. Having openshift_scheduleable undefined is the same as True since that is the default state of a Node.
-rw-r--r--roles/openshift_node/tasks/main.yml21
1 files changed, 21 insertions, 0 deletions
diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml
index 770b55351..4789dec85 100644
--- a/roles/openshift_node/tasks/main.yml
+++ b/roles/openshift_node/tasks/main.yml
@@ -73,3 +73,24 @@
- name: Start and enable openshift-node
service: name=openshift-node enabled=yes state=started
+
+- name: Check scheduleable state
+ delegate_to: "{{ openshift_first_master }}"
+ command: >
+ {{ openshift.common.client_binary }} get node {{ inventory_hostname }}
+ register: ond_get_node
+ until: ond_get_node.rc == 0
+ retries: 10
+ delay: 5
+
+- name: Handle unscheduleable node
+ delegate_to: "{{ openshift_first_master }}"
+ command: >
+ {{ openshift.common.admin_binary }} manage-node {{ inventory_hostname }} --schedulable=false
+ when: openshift_scheduleable is defined and openshift_scheduleable == False and "SchedulingDisabled" not in ond_get_node.stdout
+
+- name: Handle scheduleable node
+ delegate_to: "{{ openshift_first_master }}"
+ command: >
+ {{ openshift.common.admin_binary }} manage-node {{ inventory_hostname }} --schedulable=true
+ when: (openshift_scheduleable is not defined or openshift_scheduleable == True) and "SchedulingDisabled" in ond_get_node.stdout