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
02e81750
Commit
02e81750
authored
Oct 09, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动更新全部ns
parent
0f5ab501
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
restartLatest.js
app/restartLatest.js
+4
-4
schedule.js
app/schedule.js
+3
-2
No files found.
app/restartLatest.js
View file @
02e81750
...
@@ -10,7 +10,7 @@ const { serviceRestart, getServicesFormat, getAllNamespace } = require('../kubeS
...
@@ -10,7 +10,7 @@ const { serviceRestart, getServicesFormat, getAllNamespace } = require('../kubeS
const
container
=
require
(
'
../services/tke.containerService
'
).
create
()
const
container
=
require
(
'
../services/tke.containerService
'
).
create
()
const
repoNS
=
[
'
qa-java
'
,
'
qa-ui
'
,
'
qa-node
'
,
'
qa-python
'
]
const
repoNS
=
[
'
qa-java
'
,
'
qa-ui
'
,
'
qa-node
'
,
'
qa-python
'
]
const
testNamespace
=
[
'
qa
'
,
'
fe
'
,
'
data
'
,
'
fis
'
,
'
xyqb2
'
]
//
const testNamespace = ['qa', 'fe', 'data', 'fis', 'xyqb2']
const
client
=
new
Client
({
const
client
=
new
Client
({
config
:
config
.
fromKubeconfig
(
config
:
config
.
fromKubeconfig
(
...
@@ -27,9 +27,9 @@ const deploy = async () => {
...
@@ -27,9 +27,9 @@ const deploy = async () => {
const
repoName
=
repo
.
reponame
.
split
(
'
/
'
)[
1
]
const
repoName
=
repo
.
reponame
.
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
'
,
''
)
le
t
ns
=
await
getAllNamespace
(
client
)
cons
t
ns
=
await
getAllNamespace
(
client
)
ns
=
ns
.
namespaces
&&
ns
.
namespaces
.
filter
(
item
=>
testNamespace
.
includes
(
item
.
name
))
//
ns = ns.namespaces && ns.namespaces.filter(item => testNamespace.includes(item.name))
for
(
const
namespace
of
ns
)
{
for
(
const
namespace
of
ns
.
namespaces
)
{
const
svcs
=
await
getServicesFormat
(
client
,
namespace
.
name
)
const
svcs
=
await
getServicesFormat
(
client
,
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
)
{
...
...
app/schedule.js
View file @
02e81750
...
@@ -67,7 +67,8 @@ const dingTalkPush = async function (item, is_recover) {
...
@@ -67,7 +67,8 @@ const dingTalkPush = async function (item, is_recover) {
+
`> 命名空间 :
${
item
.
metadata
.
namespace
}
\n\n`
+
`> 命名空间 :
${
item
.
metadata
.
namespace
}
\n\n`
+
`> 异常原因 :
${
message
}
\n\n`
+
`> 异常原因 :
${
message
}
\n\n`
+
`> 异常时间 :
${
moment
()
+
`> 异常时间 :
${
moment
()
.
format
(
'
YYYY-MM-DD HH:mm:ss
'
)}
\n\n`
,
.
format
(
'
YYYY-MM-DD HH:mm:ss
'
)}
\n\n`
+
`[查看详情](http://qa2.liangkebang.com/dockers/runingEnv/
${
item
.
metadata
.
namespace
}
)`
,
},
},
};
};
await
awaitRequest
({
await
awaitRequest
({
...
@@ -89,7 +90,7 @@ const checkRecoverPod = async () => {
...
@@ -89,7 +90,7 @@ const checkRecoverPod = async () => {
const
podname
=
resKeys
[
i
].
split
(
'
#
'
)[
1
]
const
podname
=
resKeys
[
i
].
split
(
'
#
'
)[
1
]
// 获取新的状态
// 获取新的状态
if
(
podname
.
indexOf
(
resKeys
[
i
].
split
(
'
#
'
)[
1
])
>
-
1
)
{
if
(
podname
.
indexOf
(
resKeys
[
i
].
split
(
'
#
'
)[
1
])
>
-
1
)
{
const
Pod
=
await
getPods
(
client
,
namespace
)
const
Pod
=
await
getPods
(
client
,
namespace
)
Pod
.
body
.
items
.
forEach
(
async
(
item
)
=>
{
Pod
.
body
.
items
.
forEach
(
async
(
item
)
=>
{
if
(
item
.
metadata
.
name
.
indexOf
(
podname
)
>
-
1
)
{
if
(
item
.
metadata
.
name
.
indexOf
(
podname
)
>
-
1
)
{
if
(
item
.
status
.
conditions
.
length
===
3
)
{
if
(
item
.
status
.
conditions
.
length
===
3
)
{
...
...
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