Skip to content

Commit

Permalink
Add a comment explaining why we're splitting kubectl run into create …
Browse files Browse the repository at this point in the history
…and exec
  • Loading branch information
sgibson91 committed Dec 13, 2024
1 parent bf7fd62 commit 86464bd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions deployer/commands/exec/infra_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ def root_homes(

with cluster.auth():
try:
# We are splitting the previous `kubectl run` command into a
# create and exec couplet, because using run meant that the bash
# process we start would be assigned PID 1. This is a 'special'
# PID and killing it is equivalent to sending a shutdown command
# that will cause the pod to restart, killing any processes
# running in it. By using create then exec instead, we will be
# assigned a PID other than 1 and we can safely exit the pod to
# leave long-running processes if required.
#
# Ask api-server to create a pod
subprocess.check_call(["kubectl", "create", "-f", tmpf.name])
# Exec into pod
Expand Down

0 comments on commit 86464bd

Please sign in to comment.