Skip to content

Commit

Permalink
Improve status reporting around the auth-webhook and skip trying to c…
Browse files Browse the repository at this point in the history
…reate secrets before apiserver is available
  • Loading branch information
johnsca committed May 4, 2021
1 parent 0c3ead8 commit 7df111e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions reactive/kubernetes_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,10 @@ def set_final_status():
)
return

auth_setup = is_flag_set("authentication.setup")
webhook_tokens_setup = is_flag_set("kubernetes-master.auth-webhook-tokens.setup")
if auth_setup and not webhook_tokens_setup:
hookenv.status_set("waiting", "Failed to setup auth-webhook tokens; will retry")
is_leader = is_state("leadership.is_leader")
authentication_setup = is_state("authentication.setup")
if not is_leader and not authentication_setup:
hookenv.status_set("waiting", "Waiting on leader's crypto keys.")
return

if is_state("kubernetes-master.components.started"):
Expand All @@ -879,10 +879,10 @@ def set_final_status():

# Note that after this point, kubernetes-master.components.started is
# always True.
is_leader = is_state("leadership.is_leader")
authentication_setup = is_state("authentication.setup")
if not is_leader and not authentication_setup:
hookenv.status_set("waiting", "Waiting on leader's crypto keys.")

webhook_tokens_setup = is_flag_set("kubernetes-master.auth-webhook-tokens.setup")
if not webhook_tokens_setup:
hookenv.status_set("waiting", "Failed to setup auth-webhook tokens; will retry")
return

addons_configured = is_state("cdk-addons.configured")
Expand Down Expand Up @@ -1148,6 +1148,7 @@ def register_auth_webhook():

@when(
"kubernetes-master.apiserver.configured",
"kubernetes-master.components.started",
"kubernetes-master.auth-webhook-service.started",
"authentication.setup",
)
Expand Down

0 comments on commit 7df111e

Please sign in to comment.