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