Merge pull request #48054 from juju-solutions/bug/terminate-etcd

Automatic merge from submit-queue (batch tested with PRs 48139, 48042, 47645, 48054, 48003)

Add a failsafe for etcd not returning a connection string

**What this PR does / why we need it**: Removing a kubernetes-master will fail as described on this issue: https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/311

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/311

**Special notes for your reviewer**: This is a two liner defensive code. I am not totally sold on this patch. I might not be the right place to address the above issue. However, solving the problem on the etcd side and updating the interface scope to be unit (as suggested) seems much more involving.

**Release note**:

```
Fix error when removing juju kubernetes-master unit
```
This commit is contained in:
Kubernetes Submit Queue 2017-06-27 14:08:19 -07:00 committed by GitHub
commit 89579c45a4

View File

@ -305,6 +305,11 @@ def start_master(etcd):
hookenv.status_set('maintenance',
'Configuring the Kubernetes master services.')
freeze_service_cidr()
if not etcd.get_connection_string():
# etcd is not returning a connection string. This hapens when
# the master unit disconnects from etcd and is ready to terminate.
# No point in trying to start master services and fail. Just return.
return
handle_etcd_relation(etcd)
configure_master_services()
hookenv.status_set('maintenance',