diff options
Diffstat (limited to 'roles')
| -rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 18 | ||||
| -rw-r--r-- | roles/openshift_manage_node/tasks/main.yml | 12 | ||||
| -rw-r--r-- | roles/openshift_node/tasks/main.yml | 1 | 
3 files changed, 23 insertions, 8 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index d4f38a7b4..23c74f61c 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -301,6 +301,23 @@ def set_fluentd_facts_if_unset(facts):              facts['common']['use_fluentd'] = use_fluentd      return facts +def set_node_schedulability(facts): +    """ Set schedulable facts if not already present in facts dict +        Args: +            facts (dict): existing facts +        Returns: +            dict: the facts dict updated with the generated schedulable +            facts if they were not already present + +    """ +    if 'node' in facts: +        if 'schedulable' not in facts['node']: +            if 'master' in facts: +                facts['node']['schedulable'] = False +            else: +                facts['node']['schedulable'] = True +    return facts +  def set_metrics_facts_if_unset(facts):      """ Set cluster metrics facts if not already present in facts dict              dict: the facts dict updated with the generated cluster metrics facts if @@ -741,6 +758,7 @@ class OpenShiftFacts(object):          facts['current_config'] = get_current_config(facts)          facts = set_url_facts_if_unset(facts)          facts = set_fluentd_facts_if_unset(facts) +        facts = set_node_schedulability(facts)          facts = set_metrics_facts_if_unset(facts)          facts = set_identity_providers_if_unset(facts)          facts = set_sdn_facts_if_unset(facts) diff --git a/roles/openshift_manage_node/tasks/main.yml b/roles/openshift_manage_node/tasks/main.yml index 74e702248..7c4f45ce6 100644 --- a/roles/openshift_manage_node/tasks/main.yml +++ b/roles/openshift_manage_node/tasks/main.yml @@ -7,15 +7,11 @@    delay: 5    with_items: openshift_nodes -- name: Handle unscheduleable node +- name: Set node schedulability    command: > -    {{ openshift.common.admin_binary }} manage-node {{ item }} --schedulable=false -  with_items: openshift_unscheduleable_nodes - -- name: Handle scheduleable node -  command: > -    {{ openshift.common.admin_binary }} manage-node {{ item }} --schedulable=true -  with_items: openshift_scheduleable_nodes +    {{ openshift.common.admin_binary }} manage-node {{ item.openshift.common.hostname }} --schedulable={{ 'true' if item.openshift.node.schedulable | bool else 'false' }} +  with_items: +    -  "{{ openshift_node_vars }}"  - name: Label nodes    command: > diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index e56a666e9..11190ab72 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -29,6 +29,7 @@        portal_net: "{{ openshift_master_portal_net | default(None) }}"        kubelet_args: "{{ openshift_node_kubelet_args | default(None) }}"        sdn_mtu: "{{ openshift_node_sdn_mtu | default(None) }}" +      schedulable: "{{ openshift_schedulable | default(openshift_scheduleable) | default(None) }}"  - name: Install Node package    yum: pkg={{ openshift.common.service_type }}-node state=present  | 
