Skip to content

Add KUBECTL_NODE_SHELL_IMAGE_PULL_SECRET_NAME to customize imagePullSecrets #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions kubectl-node_shell
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ volume_mounts="[]"
x_mode=0
labels="${KUBECTL_NODE_SHELL_LABELS}"
pod_running_timeout="${KUBECTL_NODE_SHELL_POD_RUNNING_TIMEOUT:-1m}"
image_pull_secret_name="${KUBECTL_NODE_SHELL_IMAGE_PULL_SECRET_NAME}"
custom_image=""
use_ipc=true
use_mount=true
Expand Down Expand Up @@ -195,13 +196,20 @@ resources_json='"resources": {
}'
$kubectl run --image "$image" "$pod" --dry-run=server 2>&1 | grep -q 'failed quota' || resources_json='"resources": {}'

if [ -n "${image_pull_secret_name}" ]; then
image_pull_secrets='[ { "name": "'${image_pull_secret_name}'" } ]'
else
image_pull_secrets='null'
fi

overrides="$(
cat <<EOT
{
"spec": {
"nodeName": "$node",
"hostPID": true,
"hostNetwork": true,
"imagePullSecrets": $image_pull_secrets,
"containers": [
{
"securityContext": $security_context,
Expand Down