kubernetes-cilium.window.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Set window root path. Default is `$session_root`.
  2. # Must be called before `new_window`.
  3. #window_root "~/Projects/kubernetes"
  4. # Create new window. If no argument is given, window name will be based on
  5. # layout file name.
  6. new_window "cilium"
  7. cilium_commands=(
  8. "cilium status"
  9. "cilium service list"
  10. "cilium endpoint list"
  11. "cilium bpf lb list"
  12. )
  13. mapfile -t pod_names < <(kubectl get --no-headers=true -n kube-system -o custom-columns='NAME:metadata.name' pods)
  14. case "$KUBECONFIG" in
  15. "${HOME}/.kube/config-mjru-cluster1")
  16. context=mj-k8s-cluster0-lb
  17. ;;
  18. "${HOME}/.kube/config-mjru-cluster2")
  19. context=mj-k8s-cluster2-lb
  20. ;;
  21. esac
  22. for pod_name in "$pod_names"
  23. do
  24. if [[ $pod_name == cilium-????? ]]
  25. then
  26. # run_cmd "viddy --no-title --interval 10s kubectl -n kube-system exec ${pod_name} -- cilium status"
  27. run_cmd "nix-shell --run 'viddy --no-title --interval 10s cilium status --context ${context}'"
  28. split_h 50
  29. run_cmd "viddy --no-title --interval 10s kubectl -n kube-system exec ${pod_name} -- cilium service list"
  30. split_v 50
  31. run_cmd "viddy --no-title --interval 10s kubectl -n kube-system exec ${pod_name} -- cilium endpoint list"
  32. select_pane 0
  33. split_v 50
  34. run_cmd "viddy --no-title --interval 10s kubectl -n kube-system exec ${pod_name} -- cilium bpf lb list"
  35. split_v 50
  36. run_cmd "nix-shell --run 'viddy --no-title --interval 10s cilium clustermesh status'"
  37. fi
  38. done
  39. # Split window into panes.
  40. #split_v 20
  41. #split_h 50
  42. # Run commands.
  43. #run_cmd "top" # runs in active pane
  44. #run_cmd "date" 1 # runs in pane 1
  45. # Paste text
  46. #send_keys "top" # paste into active pane
  47. #send_keys "date" 1 # paste into pane 1
  48. # Set active pane.
  49. #select_pane 0