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
e4e37d8f
Commit
e4e37d8f
authored
Jun 30, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化重启
parent
a796dad9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
9 deletions
+8
-9
restartLatest.js
app/restartLatest.js
+5
-6
service.js
app/service.js
+1
-1
ui.node.yaml
yamls/ui.node.yaml
+2
-2
No files found.
app/restartLatest.js
View file @
e4e37d8f
...
...
@@ -4,7 +4,7 @@ const sleep = require('sleep')
const
logger
=
require
(
'
koa-log4
'
).
getLogger
(
'
deployLatest
'
)
const
cluster
=
require
(
'
../services/tke.clusterService
'
).
create
()
const
container
=
require
(
'
../services/tke.containerService
'
).
create
()
const
{
getServiceDetail
,
serviceRestart
,
getServicesFormat
}
=
require
(
'
../kubeService/service
'
)
const
{
serviceRestart
,
getServicesFormat
}
=
require
(
'
../kubeService/service
'
)
const
keepNamespace
=
[
'
default
'
,
'
kube-system
'
]
const
repoNS
=
[
'
qa-java
'
,
'
qa-ui
'
,
'
qa-node
'
,
'
qa-python
'
]
...
...
@@ -17,7 +17,6 @@ const deploy = async () => {
for
(
const
repo
of
repoNSData
.
repoInfo
)
{
logger
.
info
(
'
开始检查仓库项目:
'
,
repo
.
reponame
)
const
repoName
=
repo
.
reponame
.
split
(
'
/
'
)[
1
]
const
repoType
=
repo
.
reponame
.
split
(
'
/
'
)[
0
].
split
(
'
-
'
)[
1
]
const
latest
=
await
container
.
getTagByName
(
repo
.
reponame
,
'
latest
'
)
const
latestImageID
=
_
.
get
(
latest
.
tagInfo
,
'
[0].tagId
'
,
''
)
let
ns
=
await
cluster
.
namespace_get
()
...
...
@@ -26,10 +25,9 @@ const deploy = async () => {
const
svcs
=
await
getServicesFormat
(
namespace
.
name
)
for
(
const
svc
of
svcs
)
{
if
(
svc
.
serviceName
===
repoName
&&
svc
.
image
.
indexOf
(
'
latest
'
)
!==
-
1
)
{
const
data
=
await
getServiceDetail
(
namespace
.
name
,
repoName
,
repoType
)
if
(
latestImageID
!==
data
.
imageID
.
split
(
'
@
'
)[
1
])
{
logger
.
info
(
'
部署项目
'
,
namespace
.
name
,
data
.
podName
)
await
serviceRestart
(
namespace
.
name
,
data
.
podName
)
if
(
latestImageID
!==
svc
.
imageID
.
split
(
'
@
'
)[
1
])
{
logger
.
info
(
'
部署项目
'
,
namespace
.
name
,
svc
.
podName
)
await
serviceRestart
(
namespace
.
name
,
svc
.
podName
)
sleep
.
msleep
(
500
)
}
}
...
...
@@ -42,6 +40,7 @@ const deploy = async () => {
}
module
.
exports
=
()
=>
{
// schedule.scheduleJob('*/2 * * * *', async () => {
schedule
.
scheduleJob
(
'
0 2 * * *
'
,
async
()
=>
{
try
{
await
deploy
()
...
...
app/service.js
View file @
e4e37d8f
...
...
@@ -83,7 +83,7 @@ router.post('/delete', async (ctx) => {
if
(
serviceName
===
'
xyqb-user2
'
)
{
await
ingressDelete
(
namespace
,
'
xyqb-user2-2
'
)
}
ctx
.
body
=
ctx
.
ok
(
'
删除成功
'
)
ctx
.
body
=
ctx
.
ok
(
`删除
${
serviceName
}
成功`
)
})
router
.
post
(
'
/modifyImage
'
,
async
(
ctx
)
=>
{
...
...
yamls/ui.node.yaml
View file @
e4e37d8f
...
...
@@ -63,9 +63,9 @@ spec:
exec
:
command
:
-
/home/quant_group/readyCheck.sh
initialDelaySeconds
:
5
initialDelaySeconds
:
2
timeoutSeconds
:
2
periodSeconds
:
5
periodSeconds
:
1
successThreshold
:
1
failureThreshold
:
40
restartPolicy
:
Always
...
...
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