forked from LaconicNetwork/kompose
Adds healthcheck
This PR adds support for HealthCheck, being able to supply, for example:
```yaml
version: "3"
services:
redis:
image: redis
healthcheck:
test: echo "hello world"
interval: 10s
timeout: 1s
retries: 5
```
Which is then converted to:
```yaml
spec:
containers:
- image: redis
livenessProbe:
exec:
command:
- echo "hello world"
failureThreshold: 5
periodSeconds: 10
timeoutSeconds: 1
name: redis
resources: {}
restartPolicy: Always
```
At the moment, this only supports livenessProbe, with support for readinessProbe in the future.
This commit is contained in:
+14
-2
@@ -99,8 +99,20 @@ type ServiceConfig struct {
|
||||
Dockerfile string `compose:"dockerfile"`
|
||||
Replicas int `compose:"replicas"`
|
||||
GroupAdd []int64 `compose:"group_add"`
|
||||
// Volumes is a struct which contains all information about each volume
|
||||
Volumes []Volumes `compose:""`
|
||||
Volumes []Volumes `compose:""`
|
||||
HealthChecks HealthCheck `compose:""`
|
||||
}
|
||||
|
||||
// HealthCheck the healthcheck configuration for a service
|
||||
// "StartPeriod" is not yet added to compose, see:
|
||||
// https://github.com/docker/cli/issues/116
|
||||
type HealthCheck struct {
|
||||
Test []string
|
||||
Timeout int32
|
||||
Interval int32
|
||||
Retries int32
|
||||
StartPeriod int32
|
||||
Disable bool
|
||||
}
|
||||
|
||||
// EnvVar holds the environment variable struct of a container
|
||||
|
||||
Reference in New Issue
Block a user