From 44c8fd57bac425f51e0640f40c42bc601b7d5622 Mon Sep 17 00:00:00 2001 From: Kevin W Monroe Date: Thu, 7 Apr 2022 17:26:55 -0500 Subject: [PATCH] guard pesky functions on cni.deparated --- reactive/kubernetes_control_plane.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reactive/kubernetes_control_plane.py b/reactive/kubernetes_control_plane.py index 5452d709..cab73c05 100644 --- a/reactive/kubernetes_control_plane.py +++ b/reactive/kubernetes_control_plane.py @@ -618,6 +618,7 @@ def storage_backend_changed(): @when("leadership.is_leader") @when_not("authentication.setup") +@when_not("endpoint.cni.departed") def setup_leader_authentication(): """ Setup service accounts and tokens for the cluster. @@ -1216,6 +1217,7 @@ def register_auth_webhook(): "authentication.setup", ) @when_not("kubernetes-control-plane.auth-webhook-tokens.setup") +@when_not("endpoint.cni.departed") def setup_auth_webhook_tokens(): """Reconfigure authentication to setup auth-webhook tokens. @@ -1368,6 +1370,11 @@ def etcd_data_change(etcd): def get_dns_info(): + # Fail fast if our CNI is departing (we wont have valid dns details) + if is_flag_set("endpoint.cni.departed"): + hookenv.log("CNI is departing; DNS is not ready") + return False, None, None, None + dns_provider = endpoint_from_flag("dns-provider.available") try: goal_state_rels = hookenv.goal_state().get("relations", {}) @@ -1657,6 +1664,7 @@ def reconfigure_cdk_addons(): "leadership.set.cluster_tag", ) @when_not("upgrade.series.in-progress") +@when_not("endpoint.cni.departed") def configure_cdk_addons(): """Configure CDK addons""" remove_state("cdk-addons.reconfigure") @@ -2184,6 +2192,7 @@ def shutdown(): "certificates.client.cert.available", "authentication.setup", ) +@when_not("endpoint.cni.departed") def build_kubeconfig(): """Gather the relevant data for Kubernetes configuration objects and create a config object with that information."""