Quellcode durchsuchen

Revert "Fix OpenStack cloud provider"

This reverts commit 1f2276fff1e41c1d9440ee8b589042ee249b95d7.
Scott Dodson vor 8 Jahren
Ursprung
Commit
90345971ad

+ 5 - 5
playbooks/byo/openshift-cluster/upgrades/docker/docker_upgrade.yml

@@ -1,6 +1,6 @@
 
 - name: Check for appropriate Docker versions
-  hosts: oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config
+  hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config
   roles:
   - openshift_facts
   tasks:
@@ -19,19 +19,19 @@
 # don't want to carry on, potentially taking out every node. The playbook can safely be re-run
 # and will not take any action on a node already running the requested docker version.
 - name: Evacuate and upgrade nodes
-  hosts: oo_masters_to_config:oo_nodes_to_upgrade:oo_etcd_to_config
+  hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config
   serial: 1
   any_errors_fatal: true
   tasks:
   - name: Prepare for Node evacuation
     command: >
-      {{ openshift.common.client_binary }} adm manage-node {{ openshift.node.nodename }} --schedulable=false
+      {{ openshift.common.client_binary }} adm manage-node {{ openshift.common.hostname | lower }} --schedulable=false
     delegate_to: "{{ groups.oo_first_master.0 }}"
     when: l_docker_upgrade is defined and l_docker_upgrade | bool and inventory_hostname in groups.oo_nodes_to_upgrade
 
   - name: Evacuate Node for Kubelet upgrade
     command: >
-      {{ openshift.common.client_binary }} adm manage-node {{ openshift.node.nodename }} --evacuate --force
+      {{ openshift.common.client_binary }} adm manage-node {{ openshift.common.hostname | lower }} --evacuate --force
     delegate_to: "{{ groups.oo_first_master.0 }}"
     when: l_docker_upgrade is defined and l_docker_upgrade | bool and inventory_hostname in groups.oo_nodes_to_upgrade
 
@@ -40,7 +40,7 @@
 
   - name: Set node schedulability
     command: >
-      {{ openshift.common.client_binary }} adm manage-node {{ openshift.node.nodename }} --schedulable=true
+      {{ openshift.common.client_binary }} adm manage-node {{ openshift.common.hostname | lower }} --schedulable=true
     delegate_to: "{{ groups.oo_first_master.0 }}"
     when: openshift.node.schedulable | bool
     when: l_docker_upgrade is defined and l_docker_upgrade | bool and inventory_hostname in groups.oo_nodes_to_upgrade and openshift.node.schedulable | bool

+ 4 - 4
playbooks/common/openshift-cluster/redeploy-certificates.yml

@@ -212,7 +212,7 @@
   - name: Determine if node is currently scheduleable
     command: >
       {{ openshift.common.client_binary }} --config={{ hostvars[groups.oo_first_master.0].mktemp.stdout }}/admin.kubeconfig
-      get node {{ openshift.node.nodename }} -o json
+      get node {{ openshift.common.hostname | lower }} -o json
     register: node_output
     when: openshift_certificates_redeploy_ca | default(false) | bool
     delegate_to: "{{ groups.oo_first_master.0 }}"
@@ -225,7 +225,7 @@
   - name: Prepare for node evacuation
     command: >
       {{ openshift.common.client_binary }} adm --config={{ hostvars[groups.oo_first_master.0].mktemp.stdout }}/admin.kubeconfig
-      manage-node {{ openshift.node.nodename }}
+      manage-node {{ openshift.common.hostname | lower }}
       --schedulable=false
     delegate_to: "{{ groups.oo_first_master.0 }}"
     when: openshift_certificates_redeploy_ca | default(false) | bool and was_schedulable | bool
@@ -233,7 +233,7 @@
   - name: Evacuate node
     command: >
       {{ openshift.common.client_binary }} adm --config={{ hostvars[groups.oo_first_master.0].mktemp.stdout }}/admin.kubeconfig
-      manage-node {{ openshift.node.nodename }}
+      manage-node {{ openshift.common.hostname | lower }}
       --evacuate --force
     delegate_to: "{{ groups.oo_first_master.0 }}"
     when: openshift_certificates_redeploy_ca | default(false) | bool and was_schedulable | bool
@@ -241,7 +241,7 @@
   - name: Set node schedulability
     command: >
       {{ openshift.common.client_binary }} adm --config={{ hostvars[groups.oo_first_master.0].mktemp.stdout }}/admin.kubeconfig
-      manage-node {{ openshift.node.nodename }} --schedulable=true
+      manage-node {{ openshift.common.hostname | lower }} --schedulable=true
     delegate_to: "{{ groups.oo_first_master.0 }}"
     when: openshift_certificates_redeploy_ca | default(false) | bool and was_schedulable | bool
 

+ 4 - 6
playbooks/common/openshift-cluster/upgrades/upgrade_nodes.yml

@@ -17,7 +17,7 @@
   # we merge upgrade functionality into the base roles and a normal config.yml playbook run.
   - name: Determine if node is currently scheduleable
     command: >
-      {{ openshift.common.client_binary }} get node {{ openshift.node.nodename | lower }} -o json
+      {{ openshift.common.client_binary }} get node {{ openshift.common.hostname | lower }} -o json
     register: node_output
     delegate_to: "{{ groups.oo_first_master.0 }}"
     changed_when: false
@@ -29,7 +29,7 @@
 
   - name: Mark unschedulable if host is a node
     command: >
-      {{ openshift.common.client_binary }} adm manage-node {{ openshift.node.nodename | lower }} --schedulable=false
+      {{ openshift.common.client_binary }} adm manage-node {{ openshift.common.hostname | lower }} --schedulable=false
     delegate_to: "{{ groups.oo_first_master.0 }}"
     when: inventory_hostname in groups.oo_nodes_to_upgrade
     # NOTE: There is a transient "object has been modified" error here, allow a couple
@@ -41,7 +41,7 @@
 
   - name: Evacuate Node for Kubelet upgrade
     command: >
-      {{ openshift.common.client_binary }} adm manage-node {{ openshift.node.nodename | lower }} --evacuate --force
+      {{ openshift.common.client_binary }} adm manage-node {{ openshift.common.hostname | lower }} --evacuate --force
     delegate_to: "{{ groups.oo_first_master.0 }}"
     when: inventory_hostname in groups.oo_nodes_to_upgrade
   tasks:
@@ -64,12 +64,10 @@
 
   - name: Set node schedulability
     command: >
-      {{ openshift.common.client_binary }} adm manage-node {{ openshift.node.nodename | lower }} --schedulable=true
+      {{ openshift.common.client_binary }} adm manage-node {{ openshift.common.hostname | lower }} --schedulable=true
     delegate_to: "{{ groups.oo_first_master.0 }}"
     when: inventory_hostname in groups.oo_nodes_to_upgrade and was_schedulable | bool
     register: node_sched
     until: node_sched.rc == 0
     retries: 3
     delay: 1
-
-

+ 0 - 10
roles/openshift_facts/library/openshift_facts.py

@@ -148,7 +148,6 @@ def hostname_valid(hostname):
     if (not hostname or
             hostname.startswith('localhost') or
             hostname.endswith('localdomain') or
-            hostname.endswith('novalocal') or
             len(hostname.split('.')) < 2):
         return False
 
@@ -918,14 +917,6 @@ def set_sdn_facts_if_unset(facts, system_facts):
 
     return facts
 
-def set_nodename(facts):
-    if 'node' in facts and 'common' in facts:
-        if 'cloudprovider' in facts and facts['cloudprovider']['kind'] == 'openstack':
-            facts['node']['nodename'] = facts['provider']['metadata']['hostname'].replace('.novalocal', '')
-        else:
-            facts['node']['nodename'] = facts['common']['hostname'].lower()
-    return facts
-
 def migrate_oauth_template_facts(facts):
     """
     Migrate an old oauth template fact to a newer format if it's present.
@@ -1785,7 +1776,6 @@ class OpenShiftFacts(object):
         facts = set_proxy_facts(facts)
         if not safe_get_bool(facts['common']['is_containerized']):
             facts = set_installed_variant_rpm_facts(facts)
-        facts = set_nodename(facts)
         return dict(openshift=facts)
 
     def get_defaults(self, roles, deployment_type, deployment_subtype):

+ 5 - 5
roles/openshift_manage_node/tasks/main.yml

@@ -14,7 +14,7 @@
 
 - name: Wait for Node Registration
   command: >
-    {{ openshift.common.client_binary }} get node {{ hostvars[item].openshift.node.nodename }}
+    {{ openshift.common.client_binary }} get node {{ hostvars[item].openshift.common.hostname }}
     --config={{ openshift_manage_node_kubeconfig }}
     -n default
   register: omd_get_node
@@ -26,19 +26,19 @@
 
 - name: Set node schedulability
   command: >
-    {{ openshift.common.client_binary }} adm manage-node {{ hostvars[item].openshift.node.nodename }} --schedulable={{ 'true' if hostvars[item].openshift.node.schedulable | bool else 'false' }}
+    {{ openshift.common.client_binary }} adm manage-node {{ hostvars[item].openshift.common.hostname | lower }} --schedulable={{ 'true' if hostvars[item].openshift.node.schedulable | bool else 'false' }}
     --config={{ openshift_manage_node_kubeconfig }}
     -n default
   with_items: "{{ openshift_nodes }}"
-  when: hostvars[item].openshift.node.nodename is defined
+  when: hostvars[item].openshift.common.hostname is defined
 
 - name: Label nodes
   command: >
-    {{ openshift.common.client_binary }} label --overwrite node {{ hostvars[item].openshift.node.nodename }} {{ hostvars[item].openshift.node.labels | oo_combine_dict  }}
+    {{ openshift.common.client_binary }} label --overwrite node {{ hostvars[item].openshift.common.hostname | lower }} {{ hostvars[item].openshift.node.labels | oo_combine_dict  }}
     --config={{ openshift_manage_node_kubeconfig }}
     -n default
   with_items: "{{ openshift_nodes }}"
-  when: hostvars[item].openshift.node.nodename is defined and 'labels' in hostvars[item].openshift.node and hostvars[item].openshift.node.labels != {}
+  when: hostvars[item].openshift.common.hostname is defined and 'labels' in hostvars[item].openshift.node and hostvars[item].openshift.node.labels != {}
 
 - name: Delete temp directory
   file:

+ 1 - 1
roles/openshift_node/templates/node.yaml.v1.j2

@@ -33,7 +33,7 @@ networkConfig:
 {% if openshift.node.set_node_ip | bool %}
 nodeIP: {{ openshift.common.ip }}
 {% endif %}
-nodeName: {{ openshift.node.nodename }}
+nodeName: {{ openshift.common.hostname | lower }}
 podManifestConfig:
 servingInfo:
   bindAddress: 0.0.0.0:10250