summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Castro <spinolacastro@gmail.com>2015-08-13 09:52:22 -0300
committerDiego Castro <spinolacastro@gmail.com>2015-08-13 09:52:22 -0300
commit10b8c46d02d1ec9f4edf3df4b60e3bf533e73533 (patch)
tree436e53b269a8a4ab4f2751a1b16052350a5cc5e6
parentd307f715764164c8f543d57486718f95b1987875 (diff)
parentcd989f62709db9f858205420869b9a665cc609a1 (diff)
downloadopenshift-10b8c46d02d1ec9f4edf3df4b60e3bf533e73533.tar.gz
openshift-10b8c46d02d1ec9f4edf3df4b60e3bf533e73533.tar.bz2
openshift-10b8c46d02d1ec9f4edf3df4b60e3bf533e73533.tar.xz
openshift-10b8c46d02d1ec9f4edf3df4b60e3bf533e73533.zip
Merge remote-tracking branch 'openshift/master'
-rw-r--r--filter_plugins/oo_filters.py11
-rw-r--r--playbooks/common/openshift-node/config.yml2
-rw-r--r--roles/openshift_manage_node/tasks/main.yml8
-rw-r--r--roles/openshift_node/README.md12
4 files changed, 32 insertions, 1 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 47033a88e..9c263f0dd 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -130,6 +130,16 @@ class FilterModule(object):
rval.append("%s%s%s" % (item['key'], joiner, item['value']))
return rval
+
+ @staticmethod
+ def oo_combine_dict(data, in_joiner='=', out_joiner=' '):
+ '''Take a dict in the form of { 'key': 'value', 'key': 'value' } and
+ arrange them as a string 'key=value key=value'
+ '''
+ if not issubclass(type(data), dict):
+ raise errors.AnsibleFilterError("|failed expects first param is a dict")
+
+ return out_joiner.join([ in_joiner.join([k, v]) for k, v in data.items() ])
@staticmethod
def oo_ami_selector(data, image_name):
@@ -309,6 +319,7 @@ class FilterModule(object):
"oo_ami_selector": self.oo_ami_selector,
"oo_ec2_volume_definition": self.oo_ec2_volume_definition,
"oo_combine_key_value": self.oo_combine_key_value,
+ "oo_combine_dict": self.oo_combine_dict,
"oo_split": self.oo_split,
"oo_filter_list": self.oo_filter_list,
"oo_parse_heat_stack_outputs": self.oo_parse_heat_stack_outputs
diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml
index 6ef375bbb..4010b4c9e 100644
--- a/playbooks/common/openshift-node/config.yml
+++ b/playbooks/common/openshift-node/config.yml
@@ -128,7 +128,7 @@
vars:
openshift_nodes: "{{ hostvars
| oo_select_keys(groups['oo_nodes_to_config'])
- | oo_collect('openshift.common.hostname') }}"
+ | oo_collect('openshift.common.hostname') }}"
openshift_unscheduleable_nodes: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config'] | default([]))
| oo_collect('openshift.common.hostname', {'openshift_scheduleable': False}) }}"
pre_tasks:
diff --git a/roles/openshift_manage_node/tasks/main.yml b/roles/openshift_manage_node/tasks/main.yml
index d17f3f532..472d63efe 100644
--- a/roles/openshift_manage_node/tasks/main.yml
+++ b/roles/openshift_manage_node/tasks/main.yml
@@ -16,3 +16,11 @@
command: >
{{ openshift.common.admin_binary }} manage-node {{ item }} --schedulable=true
with_items: openshift_scheduleable_nodes
+
+- name: Label nodes
+ command: >
+ {{ openshift.common.client_binary }} label --overwrite node {{ item }} {{ hostvars[item]['openshift_node_labels'] | oo_combine_dict }}
+ with_items:
+ - "{{ openshift_nodes }}"
+ when:
+ "'openshift_node_labels' in hostvars[item]"
diff --git a/roles/openshift_node/README.md b/roles/openshift_node/README.md
index 5edb3b8dd..300e6b495 100644
--- a/roles/openshift_node/README.md
+++ b/roles/openshift_node/README.md
@@ -34,6 +34,18 @@ openshift_common
Example Playbook
----------------
+Notes
+-----
+
+Currently we support re-labeling nodes but we don't re-schedule running pods nor remove existing labels. That means you will have to trigger the re-schedulling manually. To re-schedule your pods, just follow the steps below:
+
+```
+oadm manage-node --schedulable=false ${NODE}
+oadm manage-node --evacuate ${NODE}
+oadm manage-node --schedulable=true ${NODE}
+````
+
+
TODO
License