Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker node liveness probe #7

Merged
merged 2 commits into from
Jan 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions deploy/tmate-init-cm.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
apiVersion: v1
data:
init.sh: |
MESSAGE="Look's like you've left your host shell. Let's see if we can get you back to $DEST_POD."
echo "\n\n\n" | ssh-keygen -t rsa -N "" > /dev/null
tmate -S /tmp/tmate.sock new-session -d 2> /dev/null
tmate -S /tmp/tmate.sock send-keys "kubectl exec -n $DEST_NAMESPACE -it $DEST_POD /bin/sh" ENTER
tmate -S /tmp/tmate.sock send-keys "while :; do kubectl exec -n \$DEST_NAMESPACE -it \$DEST_POD /bin/sh && echo \"$MESSAGE\"; done" ENTER
tmate -S /tmp/tmate.sock wait tmate-ready
kubectl annotate pod $(cat /etc/podinfo/name) ssh=$(tmate -S /tmp/tmate.sock display -p '#{tmate_web}')
kubectl annotate pod -n $DEST_NAMESPACE $DEST_POD ssh.out=$(tmate -S /tmp/tmate.sock display -p '#{tmate_web}')
kubectl annotate pod $(cat /etc/podinfo/name) ssh="$(tmate -S /tmp/tmate.sock display -p '#{tmate_web}')" --overwrite
kubectl annotate pod -n $DEST_NAMESPACE $DEST_POD ssh.out="$(tmate -S /tmp/tmate.sock display -p '#{tmate_web}')" --overwrite
sleep 9999999
kind: ConfigMap
metadata:
Expand Down
8 changes: 8 additions & 0 deletions pkg/controller/sshjob/sshjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ func newPodForCR(cr *corev1.Pod) *corev1.Pod {
MountPath: "/etc/podinfo",
},
},
LivenessProbe: &corev1.Probe{
Handler: corev1.Handler{
Exec: &corev1.ExecAction{
Command: []string{"/usr/bin/tmate", "-S", "/tmp/tmate.sock", "wait", "tmate-ready"},
},
},
InitialDelaySeconds: 10,
},
Env: []corev1.EnvVar{
{
Name: "DEST_POD",
Expand Down