Skip to content

Commit

Permalink
redefine container healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
senyosimpson committed Jan 10, 2025
1 parent 1bf53e2 commit 2a4eb7d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ type ContainerConfig struct {
DependsOn []ContainerDependency `json:"depends_on,omitempty"`

// Healthchecks determine the health of your containers. Healthchecks can use HTTP, TCP or an Exec command.
Healthchecks []ContainerHealthchecks `json:"healthchecks,omitempty"`
Healthchecks []ContainerHealthcheck `json:"healthchecks,omitempty"`

// Set of mounts added to the container. These can be volume mounts or shared mounts.
Mounts []ContainerMount `json:"mounts,omitempty"`
Expand Down Expand Up @@ -881,10 +881,10 @@ const (
UnhealthyPolicyStop UnhealthyPolicy = "stop"
)

type ContainerHealthchecks struct {
HTTP []HTTPHealthcheck `json:"http_healthchecks,omitempty"`
TCP []TCPHealthcheck `json:"tcp_healthchecks,omitempty"`
Exec []ExecHealthcheck `json:"exec_healthchecks,omitempty"`
type ContainerHealthcheckType struct {
HTTP *HTTPHealthcheck `json:"http,omitempty"`
TCP *TCPHealthcheck `json:"tcp,omitempty"`
Exec *ExecHealthcheck `json:"exec,omitempty"`
}

type ContainerHealthcheck struct {
Expand All @@ -904,10 +904,11 @@ type ContainerHealthcheck struct {
Kind ContainerHealthcheckKind `json:"kind,omitempty"`
// Unhealthy policy that determines what action to take if a container is deemed unhealthy
Unhealthy UnhealthyPolicy `json:"unhealthy,omitempty"`
// The type of healthcheck
ContainerHealthcheckType
}

type HTTPHealthcheck struct {
ContainerHealthcheck
// The port to connect to, often the same as internal_port
Port int32 `json:"port"`
// The HTTP method to use to when making the request
Expand All @@ -925,13 +926,11 @@ type HTTPHealthcheck struct {
}

type TCPHealthcheck struct {
ContainerHealthcheck
// The port to connect to, often the same as internal_port
Port int32 `json:"port"`
}

type ExecHealthcheck struct {
ContainerHealthcheck
// The command to run to check the health of the container (e.g. ["cat", "/tmp/healthy"])
Command []string `json:"command"`
}
Expand Down

0 comments on commit 2a4eb7d

Please sign in to comment.