Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add container probes #17535

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@
"$ref": "#/definitions/ContainerResources",
"description": "Container resource requirements."
},
"probes": {
"description": "List of probes for the container.",
"type": "array",
"items": {
"$ref": "#/definitions/ContainerAppProbe"
},
"x-ms-identifiers": [
"type"
]
},
"volumeMounts": {
"description": "Container volume mounts.",
"type": "array",
Expand Down Expand Up @@ -101,6 +111,136 @@
}
}
},
"ContainerAppProbe": {
"description": "Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic.",
"type": "object",
"properties": {
"exec": {
"description": "One and only one of the following should be specified. Exec specifies the action to take.",
vusause marked this conversation as resolved.
Show resolved Hide resolved
"type": "object",
"properties": {
"command": {
"description": "Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply executed, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy.",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"failureThreshold": {
"description": "Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1. Maximum value is 10.",
"type": "integer",
"format": "int32"
},
"httpGet": {
"description": "HTTPGet specifies the http request to perform.",
"type": "object",
"required": [
"port"
],
"properties": {
"host": {
"description": "Host name to connect to, defaults to the pod IP. You probably want to set \"Host\" in httpHeaders instead.",
"type": "string"
},
"httpHeaders": {
"description": "Custom headers to set in the request. HTTP allows repeated headers.",
"type": "array",
"items": {
"description": "HTTPHeader describes a custom header to be used in HTTP probes",
"type": "object",
"required": [
"name",
"value"
],
"properties": {
"name": {
"description": "The header field name",
"type": "string"
},
"value": {
"description": "The header field value",
"type": "string"
}
}
},
"x-ms-identifiers": [
"name"
]
},
"path": {
"description": "Path to access on the HTTP server.",
"type": "string"
},
"port": {
"description": "Name or number of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.",
"x-kubernetes-int-or-string": true
},
"scheme": {
"description": "Scheme to use for connecting to the host. Defaults to HTTP.",
"type": "string"
}
}
},
"initialDelaySeconds": {
"description": "Number of seconds after the container has started before liveness probes are initiated. Minimum value is 1. Maximum value is 60.",
"type": "integer",
"format": "int32"
},
"periodSeconds": {
"description": "How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum value is 240.",
"type": "integer",
"format": "int32"
},
"successThreshold": {
"description": "Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum value is 1. Maximum value is 10.",
"type": "integer",
"format": "int32"
},
"tcpSocket": {
"description": "TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported.",
"type": "object",
"required": [
"port"
],
"properties": {
"host": {
"description": "Optional: Host name to connect to, defaults to the pod IP.",
"type": "string"
},
"port": {
"description": "Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.",
"type": "integer",
"format": "int32"
}
}
},
"terminationGracePeriodSeconds": {
"description": "Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is an alpha field and requires enabling ProbeTerminationGracePeriod feature gate. Maximum value is 3600 seconds (1 hour)",
"type": "integer",
"format": "int64"
},
"timeoutSeconds": {
"description": "Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 240.",
"type": "integer",
"format": "int32"
},
"type": {
"description": "The type of probe.",
"enum": [
"liveness",
"readiness",
"startup"
],
"type": "string",
"x-ms-enum": {
"name": "Type",
"modelAsString": true
}
}
}
},
"CustomScaleRule": {
"description": "Container App container Custom scaling rule.",
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,24 @@
"containers": [
{
"image": "repo/testcontainerApp0:v1",
"name": "testcontainerApp0"
"name": "testcontainerApp0",
"probes": [
{
"type": "liveness",
"httpGet": {
"path": "/health",
"port": 8080,
"httpHeaders": [
{
"name": "Custom-Header",
"value": "Awesome"
}
]
},
"initialDelaySeconds": 3,
"periodSeconds": 3
}
]
}
],
"scale": {
Expand Down Expand Up @@ -73,7 +90,24 @@
"resources": {
"cpu": 0.2,
"memory": "100Mi"
}
},
"probes": [
{
"type": "liveness",
"httpGet": {
"path": "/health",
"port": 8080,
"httpHeaders": [
{
"name": "Custom-Header",
"value": "Awesome"
}
]
},
"initialDelaySeconds": 3,
"periodSeconds": 3
}
]
}
],
"scale": {
Expand Down Expand Up @@ -126,7 +160,24 @@
"resources": {
"cpu": 0.2,
"memory": "100Mi"
}
},
"probes": [
{
"type": "liveness",
"httpGet": {
"path": "/health",
"port": 8080,
"httpHeaders": [
{
"name": "Custom-Header",
"value": "Awesome"
}
]
},
"initialDelaySeconds": 3,
"periodSeconds": 3
}
]
}
],
"scale": {
Expand Down