From 0fc74ffd0200ae116c12178fb109ca78d0cdb180 Mon Sep 17 00:00:00 2001 From: weikeyou Date: Wed, 1 Aug 2018 14:02:00 +0800 Subject: [PATCH] Add healthcheck to api-ref Change-Id: I652e239578fd883898920bdaf9e98fc90041ebc9 Partial-Implements: blueprint support-healthycheck --- api-ref/source/containers.inc | 5 ++++ api-ref/source/parameters.yaml | 26 +++++++++++++++++++ .../source/samples/container-create-req.json | 8 +++++- .../source/samples/container-create-resp.json | 8 +++++- .../samples/container-get-all-resp.json | 8 +++++- .../source/samples/container-show-resp.json | 8 +++++- .../source/samples/container-update-resp.json | 6 +++++ 7 files changed, 65 insertions(+), 4 deletions(-) diff --git a/api-ref/source/containers.inc b/api-ref/source/containers.inc index e63aac43a..522f88b64 100644 --- a/api-ref/source/containers.inc +++ b/api-ref/source/containers.inc @@ -59,6 +59,7 @@ Request - hints: hints - mounts: mounts - privileged: privileged-request + - healthcheck: healthcheck-request Request Example ---------------- @@ -97,6 +98,7 @@ Response - auto_remove: auto_remove - auto_heal: auto_heal - privileged: privileged + - healthcheck: healthcheck Response Example @@ -169,6 +171,7 @@ Response - status_reason: status_reason - ports: ports - privileged: privileged + - healthcheck: healthcheck Response Example ---------------- @@ -232,6 +235,7 @@ Response - status_reason: status_reason - ports: ports - privileged: privileged + - healthcheck: healthcheck Response Example ---------------- @@ -433,6 +437,7 @@ Return new container with updated attributes. - status_reason: status_reason - ports: ports - privileged: privileged + - healthcheck: healthcheck Response Example ---------------- diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 2d201691b..9fbd427b5 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -497,6 +497,32 @@ forced_down: in: body required: true type: boolean +healthcheck: + description: | + A dict of health check for the container. Specify a test command to + perform to check that the container is healthy. Four parameters are + supported: + + * cmd: Command to run to check health. + * interval: Time between running the check in seconds. + * retries: Consecutive failures needed to report unhealthy. + * timeout: Maximum time to allow one check to run in seconds. + in: body + required: true + type: object +healthcheck-request: + description: | + A dict of health check for the container. Specify a test command to + perform to check that the container is healthy. Four parameters are + supported: + + * cmd: Command to run to check health. + * interval: Time between running the check in seconds. + * retries: Consecutive failures needed to report unhealthy. + * timeout: Maximum time to allow one check to run in seconds. + in: body + required: false + type: object hints: description: | The dictionary of data to send to the scheduler. diff --git a/api-ref/source/samples/container-create-req.json b/api-ref/source/samples/container-create-req.json index 76b3a4c0e..9403e5859 100644 --- a/api-ref/source/samples/container-create-req.json +++ b/api-ref/source/samples/container-create-req.json @@ -43,5 +43,11 @@ "destination": "/data" } ], - "privileged": false + "privileged": false, + "healthcheck": { + "cmd": "stat /etc/passwd || exit 1", + "interval": 3, + "retries": 2, + "timeout": 5 + } } diff --git a/api-ref/source/samples/container-create-resp.json b/api-ref/source/samples/container-create-resp.json index b3770c0d8..5bdecfe00 100644 --- a/api-ref/source/samples/container-create-resp.json +++ b/api-ref/source/samples/container-create-resp.json @@ -42,5 +42,11 @@ "privileged": false, "disk": 0, "user_id": "0a9cdb65757b4216935e27f333d1c48b", - "project_id": "77a89a275765486d86144caad70825e4" + "project_id": "77a89a275765486d86144caad70825e4", + "healthcheck": { + "test": "stat /etc/passwd || exit 1", + "interval": 3, + "retries": 2, + "timeout": 5 + } } diff --git a/api-ref/source/samples/container-get-all-resp.json b/api-ref/source/samples/container-get-all-resp.json index 7cfa51143..8d704950e 100644 --- a/api-ref/source/samples/container-get-all-resp.json +++ b/api-ref/source/samples/container-get-all-resp.json @@ -56,7 +56,13 @@ "ports": [], "command": "/bin/sh -c 'echo hello'", "cpu": 2.0, - "interactive": false + "interactive": false, + "healthcheck": { + "test": "stat /etc/passwd || exit 1", + "interval": 3, + "retries": 2, + "timeout": 5 + } } ], "next": null diff --git a/api-ref/source/samples/container-show-resp.json b/api-ref/source/samples/container-show-resp.json index f1b551512..3f8278369 100644 --- a/api-ref/source/samples/container-show-resp.json +++ b/api-ref/source/samples/container-show-resp.json @@ -53,5 +53,11 @@ "ports": [], "command": "/bin/sh -c 'echo hello'", "cpu": 2.0, - "interactive": false + "interactive": false, + "healthcheck": { + "test": "stat /etc/passwd || exit 1", + "interval": 3, + "retries": 2, + "timeout": 5 + } } diff --git a/api-ref/source/samples/container-update-resp.json b/api-ref/source/samples/container-update-resp.json index 371a657f3..7e3884271 100644 --- a/api-ref/source/samples/container-update-resp.json +++ b/api-ref/source/samples/container-update-resp.json @@ -51,4 +51,10 @@ "cpu": 3.0, "interactive": false, "privileged": false, + "healthcheck": { + "test": "stat /etc/passwd || exit 1", + "interval": 3, + "retries": 2, + "timeout": 5 + } }