From 7921da5ee63ee4f10084c9a2f55fccc2f3dc9e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=81=E6=99=93=E6=B3=A2?= Date: Wed, 15 Jul 2020 21:26:54 +0800 Subject: [PATCH 1/3] to avoid k8s readinessProbe remove the pod For sentinel , we just no need remove the pod just because of the dashboard unreachable. --- .../cloud/sentinel/endpoint/SentinelHealthIndicator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicator.java b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicator.java index 39b43408..996a483b 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicator.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicator.java @@ -105,7 +105,7 @@ public class SentinelHealthIndicator extends AbstractHealthIndicator { // If failed to send heartbeat message, means that the Dashboard is DOWN dashboardUp = false; detailMap.put("dashboard", - new Status(Status.DOWN.getCode(), String.format( + new Status(Status.UNKNOWN.getCode(), String.format( "the dashboard servers [%s] one of them can't be connected", consoleServerList))); } @@ -138,7 +138,7 @@ public class SentinelHealthIndicator extends AbstractHealthIndicator { // DOWN dataSourceUp = false; dataSourceDetailMap.put(dataSourceBeanName, - new Status(Status.DOWN.getCode(), e.getMessage())); + new Status(Status.UNKNOWN.getCode(), e.getMessage())); } } @@ -147,7 +147,7 @@ public class SentinelHealthIndicator extends AbstractHealthIndicator { builder.up().withDetails(detailMap); } else { - builder.down().withDetails(detailMap); + builder.unknown().withDetails(detailMap); } } From 2d6aead7eb247afe385a0a0003aae7189b473d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=81=E6=99=93=E6=B3=A2?= Date: Wed, 15 Jul 2020 23:49:50 +0800 Subject: [PATCH 2/3] update SentinelHealthIndicatorTests --- .../cloud/sentinel/endpoint/SentinelHealthIndicatorTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/test/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicatorTests.java b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/test/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicatorTests.java index b8d68d52..979fed45 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/test/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicatorTests.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/test/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicatorTests.java @@ -163,7 +163,7 @@ public class SentinelHealthIndicatorTests { Health health = sentinelHealthIndicator.health(); - assertThat(health.getStatus()).isEqualTo(Status.DOWN); + assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN); Map dataSourceDetailMap = (Map) health .getDetails().get("dataSource"); assertThat(dataSourceDetailMap.get("ds1-sentinel-file-datasource")) From eb09c52db57318b764dd3acbc3c09d7f038c9d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=81=E6=99=93=E6=B3=A2?= Date: Thu, 16 Jul 2020 12:56:58 +0800 Subject: [PATCH 3/3] Update SentinelHealthIndicatorTests.java update down status to unknown --- .../sentinel/endpoint/SentinelHealthIndicatorTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/test/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicatorTests.java b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/test/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicatorTests.java index 979fed45..96b7adaa 100644 --- a/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/test/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicatorTests.java +++ b/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/test/java/com/alibaba/cloud/sentinel/endpoint/SentinelHealthIndicatorTests.java @@ -109,9 +109,9 @@ public class SentinelHealthIndicatorTests { Health health = sentinelHealthIndicator.health(); - assertThat(health.getStatus()).isEqualTo(Status.DOWN); + assertThat(health.getStatus()).isEqualTo(Status.UNKNOWN); assertThat(health.getDetails().get("dashboard")).isEqualTo( - new Status(Status.DOWN.getCode(), "localhost:8080 can't be connected")); + new Status(Status.UNKNOWN.getCode(), "localhost:8080 can't be connected")); } @Test @@ -169,7 +169,7 @@ public class SentinelHealthIndicatorTests { assertThat(dataSourceDetailMap.get("ds1-sentinel-file-datasource")) .isEqualTo(Status.UP); assertThat(dataSourceDetailMap.get("ds2-sentinel-file-datasource")) - .isEqualTo(new Status(Status.DOWN.getCode(), "fileDataSource2 error")); + .isEqualTo(new Status(Status.UNKNOWN.getCode(), "fileDataSource2 error")); } }