Add Healthchecks to ACI

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
Ulysses Souza 2020-10-29 02:11:08 +01:00 committed by Guillaume Tardif
parent 5162982edc
commit f6509ac814
15 changed files with 680 additions and 313 deletions

View file

@ -21,6 +21,7 @@ import (
"fmt"
"io"
"os"
"time"
"github.com/containerd/console"
"github.com/spf13/cobra"
@ -59,6 +60,12 @@ func Command(contextType string) *cobra.Command {
cmd.Flags().StringArrayVar(&opts.EnvironmentFiles, "env-file", []string{}, "Path to environment files to be translated as environment variables")
cmd.Flags().StringVarP(&opts.RestartPolicyCondition, "restart", "", containers.RestartPolicyRunNo, "Restart policy to apply when a container exits (no|always|on-failure)")
cmd.Flags().BoolVar(&opts.Rm, "rm", false, "Automatically remove the container when it exits")
cmd.Flags().StringVar(&opts.HealthCmd, "health-cmd", "", "Command to run to check health")
cmd.Flags().DurationVar(&opts.HealthInterval, "health-interval", time.Duration(0), "Time between running the check (ms|s|m|h) (default 0s)")
cmd.Flags().IntVar(&opts.HealthRetries, "health-retries", 10, "Consecutive failures needed to report unhealthy")
cmd.Flags().DurationVar(&opts.HealthStartPeriod, "health-start-period", time.Duration(0), "Start period for the container to initialize before starting "+
"health-retries countdown (ms|s|m|h) (default 0s)")
cmd.Flags().DurationVar(&opts.HealthTimeout, "health-timeout", time.Duration(0), "Maximum time to allow one check to run (ms|s|m|h) (default 0s)")
if contextType == store.AciContextType {
cmd.Flags().StringVar(&opts.DomainName, "domainname", "", "Container NIS domain name")

View file

@ -4,14 +4,19 @@ Usage:
run [flags]
Flags:
--cpus float Number of CPUs (default 1)
-d, --detach Run container in background and print container ID
--domainname string Container NIS domain name
-e, --env stringArray Set environment variables
--env-file stringArray Path to environment files to be translated as environment variables
-l, --label stringArray Set meta data on a container
-m, --memory bytes Memory limit
--name string Assign a name to the container
-p, --publish stringArray Publish a container's port(s). [HOST_PORT:]CONTAINER_PORT
--restart string Restart policy to apply when a container exits (no|always|on-failure) (default "no")
-v, --volume stringArray Volume. Ex: storageaccount/my_share[:/absolute/path/to/target][:ro]
--cpus float Number of CPUs (default 1)
-d, --detach Run container in background and print container ID
--domainname string Container NIS domain name
-e, --env stringArray Set environment variables
--env-file stringArray Path to environment files to be translated as environment variables
--health-cmd string Command to run to check health
--health-interval duration Time between running the check (ms|s|m|h) (default 0s)
--health-retries int Consecutive failures needed to report unhealthy (default 10)
--health-start-period duration Start period for the container to initialize before starting health-retries countdown (ms|s|m|h) (default 0s)
--health-timeout duration Maximum time to allow one check to run (ms|s|m|h) (default 0s)
-l, --label stringArray Set meta data on a container
-m, --memory bytes Memory limit
--name string Assign a name to the container
-p, --publish stringArray Publish a container's port(s). [HOST_PORT:]CONTAINER_PORT
--restart string Restart policy to apply when a container exits (no|always|on-failure) (default "no")
-v, --volume stringArray Volume. Ex: storageaccount/my_share[:/absolute/path/to/target][:ro]

View file

@ -15,5 +15,13 @@
"MemoryLimit": 0,
"AutoRemove": false
},
"Platform": "Linux"
"Platform": "Linux",
"Healthcheck": {
"Disable": false,
"Test": null,
"Interval": "0s",
"Retries": 0,
"StartPeriod": "0s",
"Timeout": "0s"
}
}