fix: 解决安装应用时 deploy 字段被覆盖的问题 (#4476)

This commit is contained in:
zhengkunwang 2024-04-11 18:28:11 +08:00 committed by GitHub
parent 37a0329d4a
commit e37b87d63e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1227,12 +1227,16 @@ func addDockerComposeCommonParam(composeMap map[string]interface{}, serviceName
return buserr.New(constant.ErrFileParse)
}
serviceValue := service.(map[string]interface{})
deploy := map[string]interface{}{
"resources": map[string]interface{}{
"limits": map[string]interface{}{
"cpus": "${CPUS}",
"memory": "${MEMORY_LIMIT}",
},
deploy := map[string]interface{}{}
if de, ok := serviceValue["deploy"]; ok {
deploy = de.(map[string]interface{})
}
deploy["resources"] = map[string]interface{}{
"limits": map[string]interface{}{
"cpus": "${CPUS}",
"memory": "${MEMORY_LIMIT}",
},
}
serviceValue["deploy"] = deploy