Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
holmes
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
holmes
Commits
d604ed96
Commit
d604ed96
authored
Apr 12, 2022
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java服务健康检查调整
parent
382faf5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
35 deletions
+33
-35
K8sService.java
src/main/java/cn/qg/holmes/service/k8s/K8sService.java
+33
-35
No files found.
src/main/java/cn/qg/holmes/service/k8s/K8sService.java
View file @
d604ed96
...
@@ -708,42 +708,40 @@ public class K8sService {
...
@@ -708,42 +708,40 @@ public class K8sService {
container
.
setResources
(
resourceRequirements
);
container
.
setResources
(
resourceRequirements
);
// keystone、sc-task 健康检查单独处理
// keystone、sc-task、sc-auth、price-tracker 健康检查单独处理
if
(
StringUtils
.
equals
(
namespace
,
"gyl2"
)
||
StringUtils
.
equals
(
namespace
,
"vcc2"
))
{
if
(
StringUtils
.
equals
(
serviceName
,
"keystone"
)
||
StringUtils
.
equals
(
serviceName
,
"sc-task"
)
||
StringUtils
.
equals
(
serviceName
,
"sc-auth"
)
||
StringUtils
.
equals
(
serviceName
,
"price-tracker"
))
{
if
(
StringUtils
.
equals
(
serviceName
,
"keystone"
)
||
StringUtils
.
equals
(
serviceName
,
"sc-task"
)
||
StringUtils
.
equals
(
serviceName
,
"sc-auth"
)
||
StringUtils
.
equals
(
serviceName
,
"price-tracker"
))
{
IntOrString
httpPort
=
new
IntOrStringBuilder
().
withIntVal
(
80
).
build
();
IntOrString
httpPort
=
new
IntOrStringBuilder
().
withIntVal
(
80
).
build
();
HTTPGetAction
httpGetAction
=
new
HTTPGetActionBuilder
()
HTTPGetAction
httpGetAction
=
new
HTTPGetActionBuilder
()
.
withPath
(
"/actuator/health/readiness"
)
.
withPath
(
"/actuator/health/readiness"
)
.
withPort
(
httpPort
)
.
withPort
(
httpPort
)
.
build
();
.
build
();
Probe
livenessProbe
=
new
ProbeBuilder
()
Probe
livenessProbe
=
new
ProbeBuilder
()
.
withHttpGet
(
httpGetAction
)
.
withHttpGet
(
httpGetAction
)
.
withInitialDelaySeconds
(
600
)
.
withInitialDelaySeconds
(
600
)
.
withPeriodSeconds
(
60
)
.
withPeriodSeconds
(
60
)
.
withTimeoutSeconds
(
60
)
.
withTimeoutSeconds
(
60
)
.
withTimeoutSeconds
(
5
)
.
withTimeoutSeconds
(
5
)
.
withSuccessThreshold
(
1
)
.
withSuccessThreshold
(
1
)
.
withFailureThreshold
(
5
)
.
withFailureThreshold
(
5
)
.
build
();
.
build
();
container
.
setLivenessProbe
(
livenessProbe
);
container
.
setLivenessProbe
(
livenessProbe
);
//readinessProbe 就绪检查,检查容器是否就绪,不就绪则停止转发流量到当前实例
//readinessProbe 就绪检查,检查容器是否就绪,不就绪则停止转发流量到当前实例
Probe
readinessProbe
=
new
ProbeBuilder
()
Probe
readinessProbe
=
new
ProbeBuilder
()
.
withHttpGet
(
httpGetAction
)
.
withHttpGet
(
httpGetAction
)
.
withInitialDelaySeconds
(
15
)
.
withInitialDelaySeconds
(
15
)
.
withPeriodSeconds
(
5
)
.
withPeriodSeconds
(
5
)
.
withTimeoutSeconds
(
5
)
.
withTimeoutSeconds
(
5
)
.
withSuccessThreshold
(
1
)
.
withSuccessThreshold
(
1
)
.
withFailureThreshold
(
3
)
.
withFailureThreshold
(
3
)
.
build
();
.
build
();
container
.
setReadinessProbe
(
readinessProbe
);
container
.
setReadinessProbe
(
readinessProbe
);
}
}
else
{
}
else
{
//
需要做健康检查的不创建存活检查和就绪检查
//
其他服务按照原有逻辑处理
List
<
String
>
noHealthCheckServiceList
=
Arrays
.
asList
(
noHealthCheckService
.
split
(
","
));
List
<
String
>
noHealthCheckServiceList
=
Arrays
.
asList
(
noHealthCheckService
.
split
(
","
));
if
(!
noHealthCheckServiceList
.
contains
(
serviceName
))
{
if
(!
noHealthCheckServiceList
.
contains
(
serviceName
))
{
ExecAction
execAction
=
new
ExecAction
();
ExecAction
execAction
=
new
ExecAction
();
...
...
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