@@ -15,6 +15,11 @@ x_mode=0
15
15
labels=" ${KUBECTL_NODE_SHELL_LABELS} "
16
16
pod_running_timeout=" ${KUBECTL_NODE_SHELL_POD_RUNNING_TIMEOUT:- 1m} "
17
17
custom_image=" "
18
+ use_ipc=true
19
+ use_mount=true
20
+ use_pid=true
21
+ use_net=true
22
+ use_uts=true
18
23
19
24
if [ -t 0 ]; then
20
25
tty=true
@@ -71,6 +76,26 @@ while [ $# -gt 0 ]; do
71
76
shift
72
77
shift
73
78
;;
79
+ --no-ipc)
80
+ use_ipc=false
81
+ shift
82
+ ;;
83
+ --no-mount)
84
+ use_mount=false
85
+ shift
86
+ ;;
87
+ --no-pid)
88
+ use_pid=false
89
+ shift
90
+ ;;
91
+ --no-net)
92
+ use_net=false
93
+ shift
94
+ ;;
95
+ --no-uts)
96
+ use_uts=false
97
+ shift
98
+ ;;
74
99
--)
75
100
shift
76
101
break
@@ -116,7 +141,24 @@ else # If the OS isn't windows, assume linux
116
141
image=" ${custom_image:- ${KUBECTL_NODE_SHELL_IMAGE:- $default_image } } "
117
142
name=" nsenter"
118
143
pod=" ${name} -$( env LC_ALL=C tr -dc a-z0-9 < /dev/urandom | head -c 6) "
119
- cmd_start=' "nsenter", "--target", "1", "--mount", "--uts", "--ipc", "--net", "--pid"'
144
+ cmd_start=' "nsenter", "--target", "1"'
145
+ # , "--mount", "--uts", "--ipc", "--net", "--pid"
146
+ if [ " $use_mount " = true ]; then
147
+ cmd_start=" ${cmd_start} , \" --mount\" "
148
+ fi
149
+ if [ " $use_uts " = true ]; then
150
+ cmd_start=" ${cmd_start} , \" --uts\" "
151
+ fi
152
+ if [ " $use_ipc " = true ]; then
153
+ cmd_start=" ${cmd_start} , \" --ipc\" "
154
+ fi
155
+ if [ " $use_net " = true ]; then
156
+ cmd_start=" ${cmd_start} , \" --net\" "
157
+ fi
158
+ if [ " $use_pid " = true ]; then
159
+ cmd_start=" ${cmd_start} , \" --pid\" "
160
+ fi
161
+
120
162
cmd_arg_prefix=' , "--"'
121
163
cmd_default=' , "bash", "-l"'
122
164
security_context=' {"privileged":true}'
0 commit comments