Adds kubectl-rsh

This commit is contained in:
Jonas Forsberg 2025-03-13 08:35:13 +01:00
parent e0e33a62db
commit 12448a8c20

View File

@ -30,7 +30,7 @@ fi
NODE="$1"
POD=$( kubectl create -n "$KUBECTL_RSH_NAMESPACE" -o name "$@" -f - <<EOF
POD=$( kubectl create -n "$KUBECTL_RSH_NAMESPACE" -o name -f - <<EOF
apiVersion: v1
kind: Pod
metadata:
@ -67,13 +67,14 @@ EOF
echo "Creating $POD in $KUBECTL_RSH_NAMESPACE namespace"
function delete_pod{
kubectl -n "$KUBECTL_RSH_NAMESPACE" "$POD" --wait-false
function remove_pod(){
echo "Removing $POD in $KUBECTL_RSH_NAMESPACE namespace"
kubectl -n "$KUBECTL_RSH_NAMESPACE" delete "$POD" --wait=false
}
trap delete_pod EXIT
trap remove_pod EXIT
echo "Waiting for pod to be ready..."
kubectl wait -n "$KUBECTL_RSH_NAMESPACE" --for=condition=Ready --timeout ${KUBECTL_RSH_POD_CREATE_TIMEOUT}m "$POD" "$@" >/dev/null
kubectl wait -n "$KUBECTL_RSH_NAMESPACE" --for=condition=Ready --timeout ${KUBECTL_RSH_POD_CREATE_TIMEOUT}m "$POD" >/dev/null
kubectl attach -n "$KUBECTL_RSH_NAMESPACE" -it "$POD" -c rsh-node "$@"
kubectl attach -n "$KUBECTL_RSH_NAMESPACE" -it "$POD"