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
19ac4619
Commit
19ac4619
authored
Sep 12, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
存活检查
parent
327fce99
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
94 additions
and
38 deletions
+94
-38
service.js
kubeService/service.js
+20
-13
index.js
middleware/client/index.js
+8
-1
java.yaml
yamls/java.yaml
+1
-1
mongo.pvc.yaml
yamls/mongo.pvc.yaml
+6
-2
mysql.pvc.yaml
yamls/mysql.pvc.yaml
+6
-2
rabbitmq.pvc.yaml
yamls/rabbitmq.pvc.yaml
+6
-2
redis.yaml
yamls/redis.yaml
+30
-10
ui.node.yaml
yamls/ui.node.yaml
+8
-3
zookeeper.pvc.yaml
yamls/zookeeper.pvc.yaml
+9
-4
No files found.
kubeService/service.js
View file @
19ac4619
...
@@ -183,28 +183,35 @@ const getPodStatus = (podInfo) => {
...
@@ -183,28 +183,35 @@ const getPodStatus = (podInfo) => {
return
'
Pending
'
return
'
Pending
'
}
}
if
(
podInfo
.
status
.
conditions
)
{
if
(
podInfo
.
status
.
conditions
)
{
if
(
podInfo
.
status
.
conditions
[
2
].
status
===
'
False
'
)
{
for
(
const
item
of
podInfo
.
status
.
conditions
)
{
return
'
PodScheduling
'
if
(
item
.
type
===
'
Initialized
'
&&
item
.
status
===
'
False
'
)
{
}
return
'
Initializing
'
if
(
podInfo
.
status
.
conditions
[
0
].
status
===
'
False
'
)
{
}
return
'
Initializing
'
if
(
item
.
type
===
'
PodScheduled
'
&&
item
.
status
===
'
False
'
)
{
}
return
'
PodScheduling
'
if
(
podInfo
.
status
.
conditions
[
1
].
status
===
'
False
'
)
{
}
return
'
Waiting
'
if
(
item
.
type
===
'
ContainersReady
'
&&
item
.
status
===
'
False
'
)
{
return
'
ContainerCreating
'
}
if
(
item
.
type
===
'
Ready
'
&&
item
.
status
===
'
False
'
)
{
return
'
Waiting
'
}
if
(
item
.
type
===
'
Ready
'
&&
item
.
status
===
'
True
'
)
{
return
'
Normal
'
}
}
}
}
}
if
(
podInfo
.
metadata
.
deletionTimestamp
)
{
if
(
podInfo
.
metadata
.
deletionTimestamp
)
{
return
'
Terminating
'
return
'
Terminating
'
}
}
return
'
Normal
'
}
}
const
formatPodInfo
=
(
podInfo
)
=>
{
const
formatPodInfo
=
(
podInfo
)
=>
{
// if (podInfo.metadata.name.indexOf('xyqb') !== -1) {
// console.log(1, JSON.stringify(podInfo), podInfo.metadata.labels['qcloud-app'])
// }
const
podStatus
=
getPodStatus
(
podInfo
)
const
podStatus
=
getPodStatus
(
podInfo
)
// for debug
// if (podInfo.metadata.name.indexOf('xyqb-user2') !== -1) {
// console.log(1, podStatus, JSON.stringify(podInfo.status.conditions))
// }
const
imageID
=
_
.
get
(
podInfo
.
status
.
containerStatuses
,
'
[0].imageID
'
,
''
)
const
imageID
=
_
.
get
(
podInfo
.
status
.
containerStatuses
,
'
[0].imageID
'
,
''
)
const
image
=
_
.
get
(
podInfo
.
spec
.
containers
,
'
[0].image
'
,
''
)
const
image
=
_
.
get
(
podInfo
.
spec
.
containers
,
'
[0].image
'
,
''
)
...
...
middleware/client/index.js
View file @
19ac4619
...
@@ -5,7 +5,14 @@ const config = require('kubernetes-client').config
...
@@ -5,7 +5,14 @@ const config = require('kubernetes-client').config
module
.
exports
=
function
client
()
{
module
.
exports
=
function
client
()
{
const
client
=
{}
const
client
=
{}
return
async
function
(
ctx
,
next
)
{
return
async
function
(
ctx
,
next
)
{
const
exclude
=
[
'
/service/listEnvVarsNew
'
,
'
/service/listEnvVars
'
,
'
/cluster
'
]
const
exclude
=
[
'
/service/listEnvVarsNew
'
,
'
/service/listEnvVars
'
,
'
/cluster
'
,
'
/repository
'
,
'
/repository/getTags
'
,
'
/repository/getNamespaceInfo
'
,
]
if
(
exclude
.
includes
(
ctx
.
path
))
{
if
(
exclude
.
includes
(
ctx
.
path
))
{
await
next
()
await
next
()
}
else
{
}
else
{
...
...
yamls/java.yaml
View file @
19ac4619
...
@@ -84,7 +84,7 @@ spec:
...
@@ -84,7 +84,7 @@ spec:
initialDelaySeconds
:
30
initialDelaySeconds
:
30
timeoutSeconds
:
2
timeoutSeconds
:
2
# 默认值10
# 默认值10
periodSeconds
:
10
periodSeconds
:
5
volumes
:
volumes
:
-
name
:
filelog
-
name
:
filelog
hostPath
:
hostPath
:
...
...
yamls/mongo.pvc.yaml
View file @
19ac4619
...
@@ -51,13 +51,17 @@ spec:
...
@@ -51,13 +51,17 @@ spec:
value
:
qa
value
:
qa
-
name
:
MONGO_INITDB_ROOT_PASSWORD
-
name
:
MONGO_INITDB_ROOT_PASSWORD
value
:
qatest
value
:
qatest
livenessProbe
:
exec
:
command
:
[
"
mongo"
,
"
-uqa"
,
"
-pqatest"
,
"
admin"
]
initialDelaySeconds
:
100
successThreshold
:
1
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
[
"
mongo"
,
"
-uqa"
,
"
-pqatest"
,
"
admin"
]
command
:
[
"
mongo"
,
"
-uqa"
,
"
-pqatest"
,
"
admin"
]
initialDelaySeconds
:
5
initialDelaySeconds
:
5
periodSeconds
:
2
periodSeconds
:
5
timeoutSeconds
:
1
timeoutSeconds
:
1
failureThreshold
:
40
volumeMounts
:
volumeMounts
:
-
mountPath
:
"
/var/lib/mongo"
-
mountPath
:
"
/var/lib/mongo"
name
:
{{
serviceName
}}
name
:
{{
serviceName
}}
...
...
yamls/mysql.pvc.yaml
View file @
19ac4619
...
@@ -72,13 +72,17 @@ spec:
...
@@ -72,13 +72,17 @@ spec:
value
:
Quantgroup2017
value
:
Quantgroup2017
-
name
:
MYSQL_USER
-
name
:
MYSQL_USER
value
:
qa
value
:
qa
livenessProbe
:
exec
:
command
:
[
"
mysql"
,
"
-uqa"
,
"
-pqatest"
,
"
-e"
,
"
SELECT
1"
]
initialDelaySeconds
:
100
successThreshold
:
1
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
[
"
mysql"
,
"
-uqa"
,
"
-pqatest"
,
"
-e"
,
"
SELECT
1"
]
command
:
[
"
mysql"
,
"
-uqa"
,
"
-pqatest"
,
"
-e"
,
"
SELECT
1"
]
initialDelaySeconds
:
5
initialDelaySeconds
:
5
periodSeconds
:
2
periodSeconds
:
5
timeoutSeconds
:
1
timeoutSeconds
:
1
failureThreshold
:
40
volumeMounts
:
volumeMounts
:
-
mountPath
:
"
/var/lib/mysql"
-
mountPath
:
"
/var/lib/mysql"
name
:
{{
serviceName
}}
name
:
{{
serviceName
}}
...
...
yamls/rabbitmq.pvc.yaml
View file @
19ac4619
...
@@ -53,6 +53,12 @@ spec:
...
@@ -53,6 +53,12 @@ spec:
value
:
qa
value
:
qa
-
name
:
RABBITMQ_DEFAULT_PASS
-
name
:
RABBITMQ_DEFAULT_PASS
value
:
qatest
value
:
qatest
livenessProbe
:
exec
:
command
:
-
/opt/readyCheck.sh
initialDelaySeconds
:
100
successThreshold
:
1
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
command
:
...
@@ -61,12 +67,10 @@ spec:
...
@@ -61,12 +67,10 @@ spec:
timeoutSeconds
:
2
timeoutSeconds
:
2
periodSeconds
:
5
periodSeconds
:
5
successThreshold
:
1
successThreshold
:
1
failureThreshold
:
40
# 数据持久化
# 数据持久化
volumeMounts
:
volumeMounts
:
-
name
:
{{
serviceName
}}
-
name
:
{{
serviceName
}}
mountPath
:
"
/var/lib/rabbitmq"
mountPath
:
"
/var/lib/rabbitmq"
volumes
:
volumes
:
-
name
:
{{
serviceName
}}
-
name
:
{{
serviceName
}}
persistentVolumeClaim
:
persistentVolumeClaim
:
...
...
yamls/redis.yaml
View file @
19ac4619
...
@@ -32,13 +32,17 @@ spec:
...
@@ -32,13 +32,17 @@ spec:
limits
:
limits
:
cpu
:
{{
resources.cpu.limit
}}
m
cpu
:
{{
resources.cpu.limit
}}
m
memory
:
{{
resources.memory.limit
}}
Mi
memory
:
{{
resources.memory.limit
}}
Mi
livenessProbe
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6379"
,
"
info"
]
initialDelaySeconds
:
100
successThreshold
:
1
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6379"
,
"
info"
]
command
:
[
"
redis-cli"
,
"
-p"
,
"
6379"
,
"
info"
]
initialDelaySeconds
:
5
initialDelaySeconds
:
5
periodSeconds
:
2
timeoutSeconds
:
1
timeoutSeconds
:
1
failureThreshold
:
40
periodSeconds
:
5
-
image
:
ccr.ccs.tencentyun.com/{{image}}
-
image
:
ccr.ccs.tencentyun.com/{{image}}
imagePullPolicy
:
Always
imagePullPolicy
:
Always
name
:
{{
serviceName
}}
-6380
name
:
{{
serviceName
}}
-6380
...
@@ -50,13 +54,17 @@ spec:
...
@@ -50,13 +54,17 @@ spec:
limits
:
limits
:
cpu
:
{{
resources.cpu.limit
}}
m
cpu
:
{{
resources.cpu.limit
}}
m
memory
:
200Mi
memory
:
200Mi
livenessProbe
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6380"
,
"
info"
]
initialDelaySeconds
:
100
successThreshold
:
1
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6380"
,
"
info"
]
command
:
[
"
redis-cli"
,
"
-p"
,
"
6380"
,
"
info"
]
initialDelaySeconds
:
5
initialDelaySeconds
:
5
periodSeconds
:
2
timeoutSeconds
:
1
timeoutSeconds
:
1
failureThreshold
:
40
periodSeconds
:
5
-
image
:
ccr.ccs.tencentyun.com/{{image}}
-
image
:
ccr.ccs.tencentyun.com/{{image}}
imagePullPolicy
:
Always
imagePullPolicy
:
Always
name
:
{{
serviceName
}}
-6381
name
:
{{
serviceName
}}
-6381
...
@@ -68,13 +76,17 @@ spec:
...
@@ -68,13 +76,17 @@ spec:
limits
:
limits
:
cpu
:
{{
resources.cpu.limit
}}
m
cpu
:
{{
resources.cpu.limit
}}
m
memory
:
{{
resources.memory.limit
}}
Mi
memory
:
{{
resources.memory.limit
}}
Mi
livenessProbe
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6381"
,
"
info"
]
initialDelaySeconds
:
100
successThreshold
:
1
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6381"
,
"
info"
]
command
:
[
"
redis-cli"
,
"
-p"
,
"
6381"
,
"
info"
]
initialDelaySeconds
:
5
initialDelaySeconds
:
5
periodSeconds
:
2
timeoutSeconds
:
1
timeoutSeconds
:
1
failureThreshold
:
40
periodSeconds
:
5
-
image
:
ccr.ccs.tencentyun.com/{{image}}
-
image
:
ccr.ccs.tencentyun.com/{{image}}
imagePullPolicy
:
Always
imagePullPolicy
:
Always
name
:
{{
serviceName
}}
-6382
name
:
{{
serviceName
}}
-6382
...
@@ -86,13 +98,17 @@ spec:
...
@@ -86,13 +98,17 @@ spec:
limits
:
limits
:
cpu
:
{{
resources.cpu.limit
}}
m
cpu
:
{{
resources.cpu.limit
}}
m
memory
:
{{
resources.memory.limit
}}
Mi
memory
:
{{
resources.memory.limit
}}
Mi
livenessProbe
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6382"
,
"
info"
]
initialDelaySeconds
:
100
successThreshold
:
1
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6382"
,
"
info"
]
command
:
[
"
redis-cli"
,
"
-p"
,
"
6382"
,
"
info"
]
initialDelaySeconds
:
5
initialDelaySeconds
:
5
periodSeconds
:
2
timeoutSeconds
:
1
timeoutSeconds
:
1
failureThreshold
:
40
periodSeconds
:
5
-
image
:
ccr.ccs.tencentyun.com/{{image}}
-
image
:
ccr.ccs.tencentyun.com/{{image}}
imagePullPolicy
:
Always
imagePullPolicy
:
Always
name
:
{{
serviceName
}}
-6383
name
:
{{
serviceName
}}
-6383
...
@@ -104,13 +120,17 @@ spec:
...
@@ -104,13 +120,17 @@ spec:
limits
:
limits
:
cpu
:
{{
resources.cpu.limit
}}
m
cpu
:
{{
resources.cpu.limit
}}
m
memory
:
{{
resources.memory.limit
}}
Mi
memory
:
{{
resources.memory.limit
}}
Mi
livenessProbe
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6383"
,
"
info"
]
initialDelaySeconds
:
100
successThreshold
:
1
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
[
"
redis-cli"
,
"
-p"
,
"
6383"
,
"
info"
]
command
:
[
"
redis-cli"
,
"
-p"
,
"
6383"
,
"
info"
]
initialDelaySeconds
:
5
initialDelaySeconds
:
5
periodSeconds
:
2
timeoutSeconds
:
1
timeoutSeconds
:
1
failureThreshold
:
40
periodSeconds
:
5
dnsPolicy
:
ClusterFirst
dnsPolicy
:
ClusterFirst
imagePullSecrets
:
imagePullSecrets
:
-
name
:
qcloudregistrykey
-
name
:
qcloudregistrykey
...
...
yamls/ui.node.yaml
View file @
19ac4619
...
@@ -63,15 +63,20 @@ spec:
...
@@ -63,15 +63,20 @@ spec:
limits
:
limits
:
cpu
:
{{
resources.cpu.limit
}}
m
cpu
:
{{
resources.cpu.limit
}}
m
memory
:
{{
resources.memory.limit
}}
Mi
memory
:
{{
resources.memory.limit
}}
Mi
livenessProbe
:
exec
:
command
:
-
/home/quant_group/readyCheck.sh
initialDelaySeconds
:
100
successThreshold
:
1
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
command
:
-
/home/quant_group/readyCheck.sh
-
/home/quant_group/readyCheck.sh
initialDelaySeconds
:
2
initialDelaySeconds
:
2
timeoutSeconds
:
2
timeoutSeconds
:
1
periodSeconds
:
3
periodSeconds
:
5
successThreshold
:
1
successThreshold
:
1
failureThreshold
:
40
volumes
:
volumes
:
-
name
:
filelog
-
name
:
filelog
hostPath
:
hostPath
:
...
...
yamls/zookeeper.pvc.yaml
View file @
19ac4619
...
@@ -35,8 +35,6 @@ spec:
...
@@ -35,8 +35,6 @@ spec:
qcloud-app
:
{{
serviceName
}}
qcloud-app
:
{{
serviceName
}}
type
:
base
type
:
base
spec
:
spec
:
nodeSelector
:
zone
:
"
3"
containers
:
containers
:
-
image
:
ccr.ccs.tencentyun.com/{{image}}
-
image
:
ccr.ccs.tencentyun.com/{{image}}
imagePullPolicy
:
Always
imagePullPolicy
:
Always
...
@@ -48,14 +46,21 @@ spec:
...
@@ -48,14 +46,21 @@ spec:
limits
:
limits
:
cpu
:
{{
resources.cpu.limit
}}
m
cpu
:
{{
resources.cpu.limit
}}
m
memory
:
{{
resources.memory.limit
}}
Mi
memory
:
{{
resources.memory.limit
}}
Mi
livenessProbe
:
exec
:
command
:
-
/zookeeper-3.4.13/readyCheck.sh
initialDelaySeconds
:
100
successThreshold
:
1
# 默认值3
failureThreshold
:
3
readinessProbe
:
readinessProbe
:
exec
:
exec
:
command
:
command
:
-
/zookeeper-3.4.13/readyCheck.sh
-
/zookeeper-3.4.13/readyCheck.sh
initialDelaySeconds
:
5
initialDelaySeconds
:
5
periodSeconds
:
2
timeoutSeconds
:
1
timeoutSeconds
:
1
failureThreshold
:
40
periodSeconds
:
5
volumeMounts
:
volumeMounts
:
-
mountPath
:
"
/var/lib/zookeeper"
-
mountPath
:
"
/var/lib/zookeeper"
name
:
{{
serviceName
}}
name
:
{{
serviceName
}}
...
...
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