File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,13 @@ else
140
140
fi
141
141
fi
142
142
143
+ # test if resource specification is required
144
+ resources_json=' "resources": {
145
+ "limits": { "cpu": "' ${container_cpu} ' ", "memory": "' ${container_memory} ' " },
146
+ "requests": { "cpu": "' ${container_cpu} ' ", "memory": "' ${container_memory} ' " }
147
+ }'
148
+ $kubectl run test --image test --dry-run=server 2>&1 | grep ' failed quota' --quiet || resources_json=' "resources": {}'
149
+
143
150
overrides=" $(
144
151
cat << EOT
145
152
{
@@ -156,10 +163,7 @@ cat <<EOT
156
163
"stdinOnce": true,
157
164
"tty": $tty ,
158
165
"command": $cmd ,
159
- "resources": {
160
- "limits": { "cpu": "${container_cpu} ", "memory": "${container_memory} " },
161
- "requests": { "cpu": "${container_cpu} ", "memory": "${container_memory} " }
162
- },
166
+ $resources_json ,
163
167
"volumeMounts": $volume_mounts
164
168
}
165
169
],
@@ -172,7 +176,6 @@ cat <<EOT
172
176
}
173
177
EOT
174
178
) "
175
-
176
179
# Support Kubectl <1.18
177
180
m=$( kubectl version --client -o yaml | awk -F' [ :"]+' ' $2 == "minor" {print $3+0}' )
178
181
if [ " $m " -lt 18 ]; then
You can’t perform that action at this time.
0 commit comments