summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorVadim Rutkovsky <vrutkovs@redhat.com>2018-01-24 14:50:05 +0100
committerVadim Rutkovsky <vrutkovs@redhat.com>2018-01-24 21:03:09 +0100
commitf83c41821322d74db35493fcc3a4fcd1c0359bf5 (patch)
treeb19da11e80e5fa43a59b22dd20601108bd6aa405 /roles
parentdd5c2a24872490f34be8516e4f03a4076be35789 (diff)
downloadopenshift-f83c41821322d74db35493fcc3a4fcd1c0359bf5.tar.gz
openshift-f83c41821322d74db35493fcc3a4fcd1c0359bf5.tar.bz2
openshift-f83c41821322d74db35493fcc3a4fcd1c0359bf5.tar.xz
openshift-f83c41821322d74db35493fcc3a4fcd1c0359bf5.zip
Label masters with node-role.kubernetes.io/master. This PR also sets these labels
and scheduling status during upgrades Signed-off-by: Vadim Rutkovsky <vrutkovs@redhat.com>
Diffstat (limited to 'roles')
-rw-r--r--roles/openshift_manage_node/defaults/main.yml3
-rw-r--r--roles/openshift_manage_node/tasks/config.yml35
-rw-r--r--roles/openshift_manage_node/tasks/main.yml23
3 files changed, 39 insertions, 22 deletions
diff --git a/roles/openshift_manage_node/defaults/main.yml b/roles/openshift_manage_node/defaults/main.yml
index f0e728a3f..00e04b9f2 100644
--- a/roles/openshift_manage_node/defaults/main.yml
+++ b/roles/openshift_manage_node/defaults/main.yml
@@ -4,3 +4,6 @@ openshift_manage_node_is_master: False
# Default is to be schedulable except for master nodes.
l_openshift_manage_schedulable: "{{ openshift_schedulable | default(not openshift_manage_node_is_master) }}"
+
+openshift_master_node_labels:
+ node-role.kubernetes.io/master: 'true'
diff --git a/roles/openshift_manage_node/tasks/config.yml b/roles/openshift_manage_node/tasks/config.yml
new file mode 100644
index 000000000..300f19cbd
--- /dev/null
+++ b/roles/openshift_manage_node/tasks/config.yml
@@ -0,0 +1,35 @@
+---
+- name: Set node schedulability
+ oc_adm_manage_node:
+ node: "{{ openshift.node.nodename | lower }}"
+ schedulable: "{{ 'true' if l_openshift_manage_schedulable | bool else 'false' }}"
+ retries: 10
+ delay: 5
+ register: node_schedulable
+ until: node_schedulable is succeeded
+ when: "'nodename' in openshift.node"
+ delegate_to: "{{ openshift_master_host }}"
+
+- name: Label nodes
+ oc_label:
+ name: "{{ openshift.node.nodename }}"
+ kind: node
+ state: add
+ labels: "{{ openshift_node_labels | lib_utils_oo_dict_to_list_of_dict }}"
+ namespace: default
+ when:
+ - "'nodename' in openshift.node"
+ - openshift_node_labels | default({}) != {}
+ delegate_to: "{{ openshift_master_host }}"
+
+- name: Label master nodes
+ oc_label:
+ name: "{{ openshift.node.nodename }}"
+ kind: node
+ state: add
+ labels: "{{ openshift_master_node_labels | lib_utils_oo_dict_to_list_of_dict }}"
+ namespace: default
+ when:
+ - "'nodename' in openshift.node"
+ - "'oo_masters_to_config' in group_names"
+ delegate_to: "{{ openshift_master_host }}"
diff --git a/roles/openshift_manage_node/tasks/main.yml b/roles/openshift_manage_node/tasks/main.yml
index 9251d380b..154e2b45f 100644
--- a/roles/openshift_manage_node/tasks/main.yml
+++ b/roles/openshift_manage_node/tasks/main.yml
@@ -34,25 +34,4 @@
when: "'nodename' in openshift.node"
delegate_to: "{{ openshift_master_host }}"
-- name: Set node schedulability
- oc_adm_manage_node:
- node: "{{ openshift.node.nodename | lower }}"
- schedulable: "{{ 'true' if l_openshift_manage_schedulable | bool else 'false' }}"
- retries: 10
- delay: 5
- register: node_schedulable
- until: node_schedulable is succeeded
- when: "'nodename' in openshift.node"
- delegate_to: "{{ openshift_master_host }}"
-
-- name: Label nodes
- oc_label:
- name: "{{ openshift.node.nodename }}"
- kind: node
- state: add
- labels: "{{ openshift_node_labels | lib_utils_oo_dict_to_list_of_dict }}"
- namespace: default
- when:
- - "'nodename' in openshift.node"
- - openshift_node_labels | default({}) != {}
- delegate_to: "{{ openshift_master_host }}"
+- include_tasks: config.yml