2
2
set -e
3
3
4
4
kubectl=kubectl
5
- version=1.7 .0
5
+ version=1.8 .0
6
6
generator=" "
7
7
node=" "
8
8
nodefaultctx=0
9
9
nodefaultns=0
10
10
container_cpu=" ${KUBECTL_NODE_SHELL_POD_CPU:- 100m} "
11
11
container_memory=" ${KUBECTL_NODE_SHELL_POD_MEMORY:- 256Mi} "
12
+ volumes=" []"
13
+ volume_mounts=" []"
14
+ x_mode=0
12
15
labels=" ${KUBECTL_NODE_SHELL_LABELS} "
13
16
14
17
if [ -t 0 ]; then
@@ -55,6 +58,12 @@ while [ $# -gt 0 ]; do
55
58
kubectl=" $kubectl --namespace=${key##* =} "
56
59
shift
57
60
;;
61
+ -x)
62
+ x_mode=1
63
+ volumes=' [{"hostPath":{"path":"/","type":""},"name":"host-root"}]'
64
+ volume_mounts=' [{"mountPath":"/host","name":"host-root"}]'
65
+ shift
66
+ ;;
58
67
--)
59
68
shift
60
69
break
106
115
107
116
# Build the container command
108
117
if [ $# -gt 0 ]; then
109
- cmd=" [ $cmd_start $cmd_arg_prefix "
118
+ if [ " $x_mode " -eq 1 ]; then
119
+ cmd=' ['
120
+ else
121
+ cmd=" [ $cmd_start $cmd_arg_prefix ,"
122
+ fi
123
+ c=" "
110
124
while [ $# -gt 0 ]; do
111
- cmd=" $cmd , \" $( echo " $1 " | \
125
+ cmd=" ${ cmd}${c} \" $( echo " $1 " | \
112
126
awk ' {gsub(/["\\]/,"\\\\&");gsub(/\x1b/,"\\u001b");printf "%s",last;last=$0"\\n"} END{print $0}' \
113
127
) \" "
128
+ c=,
114
129
shift
115
130
done
116
131
cmd=" $cmd ]"
117
132
else
118
- cmd=" [ $cmd_start $cmd_default ]"
133
+ if [ " $x_mode " = 1 ]; then
134
+ cmd=' null'
135
+ else
136
+ cmd=" [ $cmd_start $cmd_default ]"
137
+ fi
119
138
fi
120
139
121
140
overrides=" $(
@@ -137,13 +156,15 @@ cat <<EOT
137
156
"resources": {
138
157
"limits": { "cpu": "${container_cpu} ", "memory": "${container_memory} " },
139
158
"requests": { "cpu": "${container_cpu} ", "memory": "${container_memory} " }
140
- }
159
+ },
160
+ "volumeMounts": $volume_mounts
141
161
}
142
162
],
143
163
"tolerations": [
144
164
{ "key": "CriticalAddonsOnly", "operator": "Exists" },
145
165
{ "effect": "NoExecute", "operator": "Exists" }
146
- ]
166
+ ],
167
+ "volumes": $volumes
147
168
}
148
169
}
149
170
EOT
0 commit comments