Skip to content

Commit

Permalink
add container cpu and memory limits and requests (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
arothste-blk authored and kvaps committed Jan 13, 2022
1 parent c1b05c6 commit e52ee65
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions kubectl-node_shell
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

kubectl=kubectl
version=1.5.4
version=1.5.5
generator=""
node=""
nodefaultctx=0
Expand Down Expand Up @@ -95,6 +95,8 @@ pod="nsenter-$(env LC_ALL=C tr -dc a-z0-9 </dev/urandom | head -c 6)"
# Check the node
$kubectl get node "$node" >/dev/null || exit 1

container_cpu="${KUBECTL_NODE_SHELL_POD_CPU:-100m}"
container_memory="${KUBECTL_NODE_SHELL_POD_MEMORY:-256Mi}"
overrides="$(
cat <<EOT
{
Expand All @@ -112,7 +114,17 @@ overrides="$(
"stdin": true,
"stdinOnce": true,
"tty": $tty,
"command": $cmd
"command": $cmd,
"resources": {
"limits": {
"cpu": "${container_cpu}",
"memory": "${container_memory}"
},
"requests": {
"cpu": "${container_cpu}",
"memory": "${container_memory}"
}
}
}
],
"tolerations": [
Expand Down

0 comments on commit e52ee65

Please sign in to comment.