Skip to content

Commit

Permalink
Improving default probes. (#5686)
Browse files Browse the repository at this point in the history
  • Loading branch information
Corneil du Plessis authored Feb 20, 2024
1 parent 16f7cc4 commit eb747af
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ This overrides the JVM memory setting for the desired `<application>` (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.

Expand All @@ -113,11 +113,16 @@ The following example changes the `liveness` and `startup` probes (replace `<app
====
[source]
----
deployer.<application>.kubernetes.livenessProbePath=/health
deployer.<application>.kubernetes.livenessProbePath=/health/livesness
deployer.<application>.kubernetes.livenessProbeDelay=1
deployer.<application>.kubernetes.livenessProbePeriod=60
deployer.<application>.kubernetes.livenessProbeSuccess=1
deployer.<application>.kubernetes.livenessProbeFailure=3
deployer.<application>.kubernetes.readinessProbePath=/health/readiness
deployer.<application>.kubernetes.readinessProbeDelay=1
deployer.<application>.kubernetes.readinessProbePeriod=60
deployer.<application>.kubernetes.readinessProbeSuccess=1
deployer.<application>.kubernetes.readinessProbeFailure=3
deployer.<application>.kubernetes.startupHttpProbePath=/health
deployer.<application>.kubernetes.startupProbedelay=20
deployer.<application>.kubernetes.startupProbeSuccess=1
Expand All @@ -142,7 +147,7 @@ data:
kubernetes:
accounts:
default:
livenessHttpProbePath: /health
livenessHttpProbePath: /health/liveness
livenessProbeDelay: 1
livenessProbePeriod: 60
livenessProbeSuccess: 1
Expand Down
4 changes: 2 additions & 2 deletions src/carvel/config/dataflow.star
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
8 changes: 4 additions & 4 deletions src/carvel/test/servers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand Down
10 changes: 7 additions & 3 deletions src/deploy/carvel/register-apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit eb747af

Please sign in to comment.