Skip to content

Commit e52ee65

Browse files
arothste-blkkvaps
authored andcommitted
add container cpu and memory limits and requests (#38)
1 parent c1b05c6 commit e52ee65

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

kubectl-node_shell

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33

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

98+
container_cpu="${KUBECTL_NODE_SHELL_POD_CPU:-100m}"
99+
container_memory="${KUBECTL_NODE_SHELL_POD_MEMORY:-256Mi}"
98100
overrides="$(
99101
cat <<EOT
100102
{
@@ -112,7 +114,17 @@ overrides="$(
112114
"stdin": true,
113115
"stdinOnce": true,
114116
"tty": $tty,
115-
"command": $cmd
117+
"command": $cmd,
118+
"resources": {
119+
"limits": {
120+
"cpu": "${container_cpu}",
121+
"memory": "${container_memory}"
122+
},
123+
"requests": {
124+
"cpu": "${container_cpu}",
125+
"memory": "${container_memory}"
126+
}
127+
}
116128
}
117129
],
118130
"tolerations": [

0 commit comments

Comments
 (0)