Skip to content

Commit 4884f4b

Browse files
huandukvaps
andauthored
add KUBECTL_NODE_SHELL_IMAGE_PULL_SECRET_NAME to enable imagePullSecrets (#62)
Co-authored-by: Andrei Kvapil <[email protected]>
1 parent da5cdcd commit 4884f4b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

kubectl-node_shell

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ volume_mounts="[]"
1414
x_mode=0
1515
labels="${KUBECTL_NODE_SHELL_LABELS}"
1616
pod_running_timeout="${KUBECTL_NODE_SHELL_POD_RUNNING_TIMEOUT:-1m}"
17+
image_pull_secret_name="${KUBECTL_NODE_SHELL_IMAGE_PULL_SECRET_NAME}"
1718
custom_image=""
1819
use_ipc=true
1920
use_mount=true
@@ -195,13 +196,20 @@ resources_json='"resources": {
195196
}'
196197
$kubectl run --image "$image" "$pod" --dry-run=server 2>&1 | grep -q 'failed quota' || resources_json='"resources": {}'
197198

199+
if [ -n "${image_pull_secret_name}" ]; then
200+
image_pull_secrets='[ { "name": "'${image_pull_secret_name}'" } ]'
201+
else
202+
image_pull_secrets='null'
203+
fi
204+
198205
overrides="$(
199206
cat <<EOT
200207
{
201208
"spec": {
202209
"nodeName": "$node",
203210
"hostPID": true,
204211
"hostNetwork": true,
212+
"imagePullSecrets": $image_pull_secrets,
205213
"containers": [
206214
{
207215
"securityContext": $security_context,

0 commit comments

Comments
 (0)