655af43d34bf448d9b390f07e0db1e26e19ce0d3

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Add knosh script

Diff

This diff is truncated to protect this page.

  1diff --git a/dot_local/bin/executable_knosh b/dot_local/bin/executable_knosh
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..549399b5902ae5ef2ac7dece2e6794a87a1b712f
  4--- /dev/null
  5+++ b/dot_local/bin/executable_knosh
  6@@ -0,0 +1,251 @@
  7+#!/usr/bin/env sh
  8+set -e
  9+
 10+kubectl=kubectl
 11+version=1.11.0
 12+generator=""
 13+node=""
 14+nodefaultctx=0
 15+nodefaultns=0
 16+container_cpu="${KUBECTL_NODE_SHELL_POD_CPU:-100m}"
 17+container_memory="${KUBECTL_NODE_SHELL_POD_MEMORY:-256Mi}"
 18+volumes="[]"
 19+volume_mounts="[]"
 20+x_mode=false
 21+labels="${KUBECTL_NODE_SHELL_LABELS}"
 22+pod_running_timeout="${KUBECTL_NODE_SHELL_POD_RUNNING_TIMEOUT:-1m}"
 23+image_pull_secret_name="${KUBECTL_NODE_SHELL_IMAGE_PULL_SECRET_NAME}"
 24+custom_image=""
 25+use_ipc=true
 26+use_mount=true
 27+use_pid=true
 28+use_net=true
 29+use_uts=true
 30+
 31+if [ -t 0 ]; then
 32+  tty=true
 33+else
 34+  tty=false
 35+fi
 36+while [ $# -gt 0 ]; do
 37+  key="$1"
 38+
 39+  case $key in
 40+  -v | --version)
 41+    echo "kubectl-node-shell $version"
 42+    exit 0
 43+    ;;
 44+  --context)
 45+    nodefaultctx=1
 46+    kubectl="$kubectl --context $2"
 47+    shift
 48+    shift
 49+    ;;
 50+  --kubecontext=*)
 51+    nodefaultctx=1
 52+    kubectl="$kubectl --context=${key##*=}"
 53+    shift
 54+    ;;
 55+  --kubeconfig)
 56+    kubectl="$kubectl --kubeconfig $2"
 57+    shift
 58+    shift
 59+    ;;
 60+  --kubeconfig=*)
 61+    kubectl="$kubectl --kubeconfig=${key##*=}"
 62+    shift
 63+    ;;
 64+  -n | --namespace)
 65+    nodefaultns=1
 66+    kubectl="$kubectl --namespace $2"
 67+    shift
 68+    shift
 69+    ;;
 70+  --namespace=*)
 71+    nodefaultns=1
 72+    kubectl="$kubectl --namespace=${key##*=}"
 73+    shift
 74+    ;;
 75+  -m | --mount)
 76+    volumes=$(echo "$volumes" | jq '. += [{"persistentVolumeClaim": {"claimName": "'"$2"'", "type": ""}, "name": "'"pvc"'"}]')
 77+    volume_mounts=$(echo "$volume_mounts" | jq '. += [{"mountPath": "/opt-pvc", "name": "'"pvc"'"}]')
 78+    shift
 79+    shift
 80+    ;;
 81+  -x)
 82+    x_mode=true
 83+    volumes=$(echo "$volumes" | jq '. += [{"hostPath": {"path": "/", "type": ""}, "name": "host-root"}]')
 84+    volume_mounts=$(echo "$volume_mounts" | jq '. += [{"mountPath":"/host","name":"host-root"}]')
 85+    shift
 86+    ;;
 87+  --image)
 88+    custom_image="$2"
 89+    shift
 90+    shift
 91+    ;;
 92+  --no-ipc)
 93+    use_ipc=false
 94+    shift
 95+    ;;
 96+  --no-mount)
 97+    use_mount=false
 98+    shift
 99+    ;;
100+  --no-pid)
101+    use_pid=false
102+    shift
103+    ;;
104+  --no-net)
105+    use_net=false