Skip to content

Commit 0af3f62

Browse files
authored
add container cpu and memory limits and requests (#38)
1 parent c1b05c6 commit 0af3f62

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

kubectl-node_shell

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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)