From 690be0fb82d90e8bbe22ade103cf5c2eaca0cead Mon Sep 17 00:00:00 2001 From: Charles Butler Date: Wed, 26 Apr 2017 14:39:03 -0500 Subject: [PATCH] Fixes #43461 The master-components started state triggers a daemon recycle. The guard was to prevent the daemons from being cycled too often and interrupting normal workflow. This additional state check is guarded against the etcd connection string from changing, allowing the current behavior but triggers a re-configure and recycle of the api-control plane when etcd units are scaling up and down. --- .../reactive/kubernetes_master.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cluster/juju/layers/kubernetes-master/reactive/kubernetes_master.py b/cluster/juju/layers/kubernetes-master/reactive/kubernetes_master.py index b48cab7c1d7..e2221d17437 100644 --- a/cluster/juju/layers/kubernetes-master/reactive/kubernetes_master.py +++ b/cluster/juju/layers/kubernetes-master/reactive/kubernetes_master.py @@ -296,6 +296,22 @@ def start_master(etcd): set_state('kubernetes-master.components.started') +@when('etcd.available') +def etcd_data_change(etcd): + ''' Etcd scale events block master reconfiguration due to the + kubernetes-master.components.started state. We need a way to + handle these events consistenly only when the number of etcd + units has actually changed ''' + + # key off of the connection string + connection_string = etcd.get_connection_string() + + # If the connection string changes, remove the started state to trigger + # handling of the master components + if data_changed('etcd-connect', connection_string): + remove_state('kubernetes-master.components.started') + + @when('kube-control.connected') @when('cdk-addons.configured') def send_cluster_dns_detail(kube_control):