From 3cc2d6b019fa8a05ba480a7425cd654aa051355f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Thu, 6 Oct 2016 14:39:18 +0200 Subject: Check that OpenStack hostnames are resolvable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If they’re not, then use IP instead --- roles/openshift_facts/library/openshift_facts.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'roles') diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 9ffd399bc..0ee018c5c 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -364,12 +364,15 @@ def normalize_openstack_facts(metadata, facts): facts['network']['ip'] = local_ipv4 facts['network']['public_ip'] = metadata['ec2_compat']['public-ipv4'] - # TODO: verify local hostname makes sense and is resolvable - facts['network']['hostname'] = metadata['hostname'] - - # TODO: verify that public hostname makes sense and is resolvable - pub_h = metadata['ec2_compat']['public-hostname'] - facts['network']['public_hostname'] = pub_h + for f_var, h_var, ip_var in [('hostname', 'hostname', 'local-ipv4'), + ('public_hostname', 'public-hostname', 'public-ipv4')]: + try: + if socket.gethostbyname(metadata['ec2_compat'][h_var]) == metadata['ec2_compat'][ip_var]: + facts['network'][f_var] = metadata['ec2_compat'][h_var] + else: + facts['network'][f_var] = metadata['ec2_compat'][ip_var] + except socket.gaierror: + facts['network'][f_var] = metadata['ec2_compat'][ip_var] return facts -- cgit v1.2.1 From 1bc6d4390661fe18bebbc020b2c7b25972e80b41 Mon Sep 17 00:00:00 2001 From: Dan Mace Date: Fri, 7 Oct 2016 16:28:17 -0400 Subject: Retry failed master startup once Master startup can fail when ec2 transparently reallocates the block storage, causing etcd writes to temporarily fail. Retry failures blindly just once to allow time for this transient condition to to resolve and for systemd to restart the master (which will eventually succeed). https://github.com/coreos/etcd/issues/3864 https://github.com/openshift/origin/issues/6065 https://github.com/openshift/origin/issues/6447 --- roles/openshift_master/tasks/main.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'roles') diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index ce2f96723..645871ab4 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -168,10 +168,21 @@ - include: set_loopback_context.yml when: openshift.common.version_gte_3_2_or_1_2 +# TODO: Master startup can fail when ec2 transparently reallocates the block +# storage, causing etcd writes to temporarily fail. Retry failures blindly just +# once to allow time for this transient condition to to resolve and for systemd +# to restart the master (which will eventually succeed). +# +# https://github.com/coreos/etcd/issues/3864 +# https://github.com/openshift/origin/issues/6065 +# https://github.com/openshift/origin/issues/6447 - name: Start and enable master service: name={{ openshift.common.service_type }}-master enabled=yes state=started when: not openshift_master_ha | bool register: start_result + until: not start_result | failed + retries: 1 + delay: 60 notify: Verify API Server - name: Check for non-HA master service presence -- cgit v1.2.1 From 44d0816ecd1e55b98e4e76361072667c2ffdae40 Mon Sep 17 00:00:00 2001 From: Scott Dodson Date: Fri, 7 Oct 2016 16:12:59 -0400 Subject: Improve how we handle containerized node failure on first startup --- roles/openshift_node/tasks/main.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'roles') diff --git a/roles/openshift_node/tasks/main.yml b/roles/openshift_node/tasks/main.yml index be07bd2d3..8e9c9f511 100644 --- a/roles/openshift_node/tasks/main.yml +++ b/roles/openshift_node/tasks/main.yml @@ -152,17 +152,9 @@ - name: Start and enable node service: name={{ openshift.common.service_type }}-node enabled=yes state=started register: node_start_result - ignore_errors: yes - -- name: Wait 30 seconds for docker initialization whenever node has failed - pause: - seconds: 30 - when: node_start_result | failed - -- name: Start and enable node again - service: name={{ openshift.common.service_type }}-node enabled=yes state=started - register: node_start_result - when: node_start_result | failed + until: not node_start_result | failed + retries: 1 + delay: 30 - set_fact: node_service_status_changed: "{{ node_start_result | changed }}" -- cgit v1.2.1 From ebef73fe94a0329011ca35ba33272789826ce282 Mon Sep 17 00:00:00 2001 From: Scott Dodson Date: Mon, 10 Oct 2016 09:43:15 -0400 Subject: Apply same pattern to HA master services --- roles/openshift_master/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'roles') diff --git a/roles/openshift_master/tasks/main.yml b/roles/openshift_master/tasks/main.yml index 645871ab4..1a59717c7 100644 --- a/roles/openshift_master/tasks/main.yml +++ b/roles/openshift_master/tasks/main.yml @@ -213,6 +213,9 @@ state: started when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' and inventory_hostname == openshift_master_hosts[0] register: start_result + until: not start_result | failed + retries: 1 + delay: 60 - set_fact: master_api_service_status_changed: "{{ start_result | changed }}" @@ -229,6 +232,9 @@ state: started when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' and inventory_hostname != openshift_master_hosts[0] register: start_result + until: not start_result | failed + retries: 1 + delay: 60 - set_fact: master_api_service_status_changed: "{{ start_result | changed }}" @@ -262,6 +268,9 @@ state: started when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' and inventory_hostname == openshift_master_hosts[0] register: start_result + until: not start_result | failed + retries: 1 + delay: 60 - pause: seconds: 15 @@ -274,6 +283,9 @@ state: started when: openshift_master_ha | bool and openshift.master.cluster_method == 'native' and inventory_hostname != openshift_master_hosts[0] register: start_result + until: not start_result | failed + retries: 1 + delay: 60 - set_fact: master_controllers_service_status_changed: "{{ start_result | changed }}" -- cgit v1.2.1 From 492a513a253eb7a61b47f312f1002a62c7a7bfb0 Mon Sep 17 00:00:00 2001 From: Scott Dodson Date: Mon, 10 Oct 2016 11:52:41 -0400 Subject: Fix config and namespace for registry volume detection --- .../tasks/registry/storage/persistent_volume.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/openshift_hosted/tasks/registry/storage/persistent_volume.yml b/roles/openshift_hosted/tasks/registry/storage/persistent_volume.yml index 60eefd71a..0172f5ca0 100644 --- a/roles/openshift_hosted/tasks/registry/storage/persistent_volume.yml +++ b/roles/openshift_hosted/tasks/registry/storage/persistent_volume.yml @@ -3,7 +3,11 @@ registry_volume_claim: "{{ openshift.hosted.registry.storage.volume.name }}-claim" - name: Determine if volume is already attached to dc/docker-registry - command: "{{ openshift.common.client_binary }} get -o template dc/docker-registry --template=\\{\\{.spec.template.spec.volumes\\}\\} --output-version=v1" + command: > + {{ openshift.common.client_binary }} + --config={{ openshift_hosted_kubeconfig }} + --namespace={{ openshift.hosted.registry.namespace | default('default') }} + get -o template dc/docker-registry --template=\\{\\{.spec.template.spec.volumes\\}\\} --output-version=v1 changed_when: false failed_when: false register: registry_volumes_output @@ -13,7 +17,10 @@ - name: Add volume to dc/docker-registry command: > - {{ openshift.common.client_binary }} volume dc/docker-registry + {{ openshift.common.client_binary }} + --config={{ openshift_hosted_kubeconfig }} + --namespace={{ openshift.hosted.registry.namespace | default('default') }} + volume dc/docker-registry --add --overwrite -t persistentVolumeClaim --claim-name={{ registry_volume_claim }} --name=registry-storage when: not volume_attached | bool -- cgit v1.2.1