From eb747af2b545e242425cf71e4ef97c93def4c970 Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Tue, 20 Feb 2024 13:22:01 +0200 Subject: [PATCH] Improving default probes. (#5686) --- .../configuration-kubernetes-app-properties.adoc | 11 ++++++++--- src/carvel/config/dataflow.star | 4 ++-- src/carvel/test/servers.test.ts | 8 ++++---- src/deploy/carvel/register-apps.sh | 10 +++++++--- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/spring-cloud-dataflow-docs/src/main/asciidoc/configuration-kubernetes-app-properties.adoc b/spring-cloud-dataflow-docs/src/main/asciidoc/configuration-kubernetes-app-properties.adoc index 7c4a560dcb..94dc74a36b 100644 --- a/spring-cloud-dataflow-docs/src/main/asciidoc/configuration-kubernetes-app-properties.adoc +++ b/spring-cloud-dataflow-docs/src/main/asciidoc/configuration-kubernetes-app-properties.adoc @@ -104,7 +104,7 @@ This overrides the JVM memory setting for the desired `` (replace ` [[getting-started-kubernetes-probes]] ==== Liveness, Readiness and Startup Probes -The `liveness` and `readiness` probes use paths called `/health` and `/info`, respectively. They use a `delay` of `1` for both and a `period` of `60` and `10` respectively. You can change these defaults when you deploy the stream by using deployer properties. The liveness and readiness probes are applied only to streams. +The `liveness` and `readiness` probes use paths called `/health/liveness` and `/health/readiness`, respectively. They use a `delay` of `1` for both and a `period` of `60` and `10` respectively. You can change these defaults when you deploy the stream by using deployer properties. The liveness and readiness probes are applied only to streams. The `startup` probe will use the `/health` path and a delay of 30 and period for 3 with a failure threshold of 20 times before the container restarts the application. @@ -113,11 +113,16 @@ The following example changes the `liveness` and `startup` probes (replace `.kubernetes.livenessProbePath=/health +deployer..kubernetes.livenessProbePath=/health/livesness deployer..kubernetes.livenessProbeDelay=1 deployer..kubernetes.livenessProbePeriod=60 deployer..kubernetes.livenessProbeSuccess=1 deployer..kubernetes.livenessProbeFailure=3 +deployer..kubernetes.readinessProbePath=/health/readiness +deployer..kubernetes.readinessProbeDelay=1 +deployer..kubernetes.readinessProbePeriod=60 +deployer..kubernetes.readinessProbeSuccess=1 +deployer..kubernetes.readinessProbeFailure=3 deployer..kubernetes.startupHttpProbePath=/health deployer..kubernetes.startupProbedelay=20 deployer..kubernetes.startupProbeSuccess=1 @@ -142,7 +147,7 @@ data: kubernetes: accounts: default: - livenessHttpProbePath: /health + livenessHttpProbePath: /health/liveness livenessProbeDelay: 1 livenessProbePeriod: 60 livenessProbeSuccess: 1 diff --git a/src/carvel/config/dataflow.star b/src/carvel/config/dataflow.star index b59b410b01..c724d794c1 100644 --- a/src/carvel/config/dataflow.star +++ b/src/carvel/config/dataflow.star @@ -96,11 +96,11 @@ def has_context_path(): end def dataflow_liveness_path(): - return data.values.scdf.server.contextPath + "/management/health" + return data.values.scdf.server.contextPath + "/management/health/liveness" end def dataflow_readiness_path(): - return data.values.scdf.server.contextPath + "/management/info" + return data.values.scdf.server.contextPath + "/management/health/readiness" end def dataflow_has_password(): diff --git a/src/carvel/test/servers.test.ts b/src/carvel/test/servers.test.ts index 4907df896f..552820a26f 100644 --- a/src/carvel/test/servers.test.ts +++ b/src/carvel/test/servers.test.ts @@ -535,8 +535,8 @@ describe('servers', () => { const dataflowDeployment = findDeployment(yaml, SCDF_SERVER_NAME); const dataflowContainer = deploymentContainer(dataflowDeployment, SCDF_SERVER_NAME); - expect(dataflowContainer?.livenessProbe?.httpGet?.path).toBe('/management/health'); - expect(dataflowContainer?.readinessProbe?.httpGet?.path).toBe('/management/info'); + expect(dataflowContainer?.livenessProbe?.httpGet?.path).toBe('/management/health/liveness'); + expect(dataflowContainer?.readinessProbe?.httpGet?.path).toBe('/management/health/readiness'); }); it('should change server servlet context path', async () => { @@ -556,8 +556,8 @@ describe('servers', () => { const dataflowDeployment = findDeployment(yaml, SCDF_SERVER_NAME); const dataflowContainer = deploymentContainer(dataflowDeployment, SCDF_SERVER_NAME); - expect(dataflowContainer?.livenessProbe?.httpGet?.path).toBe('/scdf/management/health'); - expect(dataflowContainer?.readinessProbe?.httpGet?.path).toBe('/scdf/management/info'); + expect(dataflowContainer?.livenessProbe?.httpGet?.path).toBe('/scdf/management/health/liveness'); + expect(dataflowContainer?.readinessProbe?.httpGet?.path).toBe('/scdf/management/health/readiness'); }); it('should have default resources', async () => { diff --git a/src/deploy/carvel/register-apps.sh b/src/deploy/carvel/register-apps.sh index 21026d1849..c9c2c90417 100755 --- a/src/deploy/carvel/register-apps.sh +++ b/src/deploy/carvel/register-apps.sh @@ -11,7 +11,11 @@ start_time=$(date +%s) function register_app() { set +e echo "Registering $1 as $2" - wget -q -O- "$DATAFLOW_URL/apps/$1" --post-data="uri=$2" + DATA="uri=$2" + if [ "$3" != "" ]; then + DATA="$DATA&$3" + fi + wget -q -O- "$DATAFLOW_URL/apps/$1" --post-data="$DATA" RC=$? if ((RC > 0)); then echo "Error registering $1: $RC" @@ -85,8 +89,8 @@ wget -qO- "$DATAFLOW_URL/apps" --post-data="uri=$TASK_URI" # replace with individual calls to register only what is required. #register_app "task/timestamp" "docker:springcloudtask/timestamp-task:2.0.2" #register_app "task/timestamp-batch" "docker:springcloudtask/timestamp-batch-task:2.0.2" -register_app "task/timestamp3" "docker:springcloudtask/timestamp-task:3.0.0" -register_app "task/timestamp-batch3" "docker:springcloudtask/timestamp-batch-task:3.0.0" +register_app "task/timestamp3" "docker:springcloudtask/timestamp-task:3.0.0" "bootVersion=3" +register_app "task/timestamp-batch3" "docker:springcloudtask/timestamp-batch-task:3.0.0" "bootVersion=3" register_app "task/task-demo-metrics-prometheus" "docker:springcloudtask/task-demo-metrics-prometheus:2.0.1-SNAPSHOT" end_time=$(date +%s)