Skip to content

Commit a5cbe35

Browse files
authored
runtimeproxy: fix env lost (#957)
Signed-off-by: lucming <2876757716@qq.com>
1 parent 402e383 commit a5cbe35

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pkg/runtimeproxy/server/docker/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func generateExpectedCgroupParent(cgroupDriver, cgroupParent string) string {
235235
func splitDockerEnv(dockerEnvs []string) map[string]string {
236236
res := make(map[string]string)
237237
for _, str := range dockerEnvs {
238-
tokens := strings.Split(str, "=")
238+
tokens := strings.SplitN(str, "=", 2)
239239
if len(tokens) != 2 {
240240
continue
241241
}

pkg/runtimeproxy/server/docker/utils_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,12 @@ func Test_splitDockerEnv(t *testing.T) {
415415
"b": "c",
416416
},
417417
},
418+
{
419+
dockerEnvs: []string{"a=b=c"},
420+
expectedHookEnvs: map[string]string{
421+
"a": "b=c",
422+
},
423+
},
418424
{
419425
dockerEnvs: []string{"a=", "b"},
420426
expectedHookEnvs: map[string]string{

0 commit comments

Comments
 (0)