Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tke-eos
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
tke-eos
Commits
6ba645c7
Commit
6ba645c7
authored
May 05, 2019
by
xuezj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 内存大户特别对待
parent
40431d10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
service.js
app/service.js
+23
-3
java.template.txt
serviceTemplate/java.template.txt
+4
-4
No files found.
app/service.js
View file @
6ba645c7
...
...
@@ -54,11 +54,31 @@ const createService = async (ctx) => {
data
.
system_name
=
serviceName
}
const
template
=
templates
[
type
].
replace
(
/{{
([
A-Za-z0-9_
]
+
)
}}/g
,
function
()
{
if
(
data
[
arguments
[
1
]]
===
undefined
)
{
// java 增加内存限制
if
(
type
===
'
java
'
)
{
data
.
resources
=
{
cpu
:
{
request
:
10
,
limit
:
1000
,
},
memory
:
{
request
:
100
,
limit
:
1024
,
}
}
const
special
=
[
'
xyqb
'
,
'
xyqb-user2
'
]
if
(
special
.
includes
(
serviceName
))
{
data
.
resources
.
memory
.
request
=
600
}
}
const
template
=
templates
[
type
].
replace
(
/{{
([
A-Za-z0-9_
\.]
+
)
}}/g
,
function
()
{
console
.
log
(
arguments
[
1
])
if
(
_
.
get
(
data
,
arguments
[
1
],
null
)
===
null
)
{
throw
new
Error
(
`缺少模板所需变量:
${
arguments
[
1
]}
`
)
}
return
data
[
arguments
[
1
]]
return
_
.
get
(
data
,
arguments
[
1
])
})
const
params
=
yaml
.
load
(
template
)
await
ctx
.
cluster
.
service_create
(
params
,
label
)
...
...
serviceTemplate/java.template.txt
View file @
6ba645c7
...
...
@@ -14,7 +14,7 @@ containers.0.envs.0.value: {{system_name}}
containers.0.envs.1.name: NAMESPACE
containers.0.envs.1.value: {{namespace}}
containers.0.cpu:
10
containers.0.cpuLimits:
1000
containers.0.memory:
100
containers.0.memoryLimits:
1024
containers.0.cpu:
{{resources.cpu.request}}
containers.0.cpuLimits:
{{resources.cpu.limit}}
containers.0.memory:
{{resources.memory.request}}
containers.0.memoryLimits:
{{resources.memory.limit}}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment