Skip to content

Commit

Permalink
Merge pull request #5750 from sbueringer/pr-disable-leader-elect-tilt
Browse files Browse the repository at this point in the history
🌱 tilt: disable leader election when debugging is enabled
  • Loading branch information
k8s-ci-robot authored Nov 29, 2021
2 parents aafe20b + 3c02f0a commit 6eb2002
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ def enable_providers():
enable_provider(name, settings.get("debug").get(name, {}))

def kustomize_with_envsubst(path, enable_debug = False):
# we need to ditch the readiness and liveness probes when debugging, otherwise K8s will restart the pod whenever execution
# We need to ditch leader election, the readiness and liveness probes when debugging, otherwise K8s will restart the pod whenever execution
# has paused.
if enable_debug:
yq_cmd_line = "| {} eval 'del(.. | select(has\"livenessProbe\")).livenessProbe | del(.. | select(has\"readinessProbe\")).readinessProbe' -".format(yq_cmd)
yq_cmd_line = "| {} eval 'del(.. | select(. == \"--leader-elect\")) | del(.. | select(has\"livenessProbe\")).livenessProbe | del(.. | select(has\"readinessProbe\")).readinessProbe' -".format(yq_cmd)
else:
yq_cmd_line = ""
return str(local("{} build {} | {} {}".format(kustomize_cmd, path, envsubst_cmd, yq_cmd_line), quiet = True))
Expand Down

0 comments on commit 6eb2002

Please sign in to comment.