Skip to content

Commit

Permalink
guard pesky functions on cni.deparated
Browse files Browse the repository at this point in the history
  • Loading branch information
kwmonroe committed Apr 7, 2022
1 parent 1f42cf2 commit 44c8fd5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions reactive/kubernetes_control_plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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", {})
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit 44c8fd5

Please sign in to comment.