Skip to content

Instantly share code, notes, and snippets.

@spacepluk
Created May 16, 2016 17:00
Show Gist options
  • Select an option

  • Save spacepluk/18e5567c208ccadbe2003cb96e03b59c to your computer and use it in GitHub Desktop.

Select an option

Save spacepluk/18e5567c208ccadbe2003cb96e03b59c to your computer and use it in GitHub Desktop.
command() {
local pods=($(IFS=$' ' get-podnames $1))
local cmd=${2:-bash}
local tmux_pane=$TMUX_PANE
local i=0
for pod in ${pods[*]}; do
if [ -z "$TMUX" ]; then
kubectl exec -i -t $pod -- "$cmd"
else
echo tmux split-window -p $((100 / ( ${#pods[@]} - $i))) "kubectl exec -i -t $pod -- $cmd"
tmux split-window -p $((100 / (${#pods[@]} - $i))) "kubectl exec -i -t $pod -- $cmd"
tmux select-pane -t $TMUX_PANE
i=$((i + 1))
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment