Commit b9256bb5 authored by 黎博's avatar 黎博

供应链新健康检查仅限gyl2

parent 10467bc1
......@@ -680,37 +680,39 @@ public class K8sService {
container.setResources(resourceRequirements);
// keystone、sc-task 健康检查单独处理
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();
HTTPGetAction httpGetAction = new HTTPGetActionBuilder()
.withPath("/actuator/health/readiness")
.withPort(httpPort)
.build();
Probe livenessProbe = new ProbeBuilder()
.withHttpGet(httpGetAction)
.withInitialDelaySeconds(600)
.withPeriodSeconds(60)
.withTimeoutSeconds(60)
.withTimeoutSeconds(5)
.withSuccessThreshold(1)
.withFailureThreshold(5)
.build();
container.setLivenessProbe(livenessProbe);
//readinessProbe 就绪检查,检查容器是否就绪,不就绪则停止转发流量到当前实例
Probe readinessProbe = new ProbeBuilder()
.withHttpGet(httpGetAction)
.withInitialDelaySeconds(15)
.withPeriodSeconds(5)
.withTimeoutSeconds(5)
.withSuccessThreshold(1)
.withFailureThreshold(3)
.build();
container.setReadinessProbe(readinessProbe);
if (StringUtils.equals(namespace, "gyl2")) {
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();
HTTPGetAction httpGetAction = new HTTPGetActionBuilder()
.withPath("/actuator/health/readiness")
.withPort(httpPort)
.build();
Probe livenessProbe = new ProbeBuilder()
.withHttpGet(httpGetAction)
.withInitialDelaySeconds(600)
.withPeriodSeconds(60)
.withTimeoutSeconds(60)
.withTimeoutSeconds(5)
.withSuccessThreshold(1)
.withFailureThreshold(5)
.build();
container.setLivenessProbe(livenessProbe);
//readinessProbe 就绪检查,检查容器是否就绪,不就绪则停止转发流量到当前实例
Probe readinessProbe = new ProbeBuilder()
.withHttpGet(httpGetAction)
.withInitialDelaySeconds(15)
.withPeriodSeconds(5)
.withTimeoutSeconds(5)
.withSuccessThreshold(1)
.withFailureThreshold(3)
.build();
container.setReadinessProbe(readinessProbe);
}
} else {
// 需要做健康检查的不创建存活检查和就绪检查
List<String> noHealthCheckServiceList = Arrays.asList(noHealthCheckService.split(","));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment