Skip to content

Commit c1e03a8

Browse files
authored
feat(container): add health check spec to containers (scaleway#2289)
1 parent 389d36b commit c1e03a8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

api/container/v1beta1/container_sdk.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,34 @@ func (enum *TriggerStatus) UnmarshalJSON(data []byte) error {
762762
return nil
763763
}
764764

765+
// ContainerHealthCheckSpecHTTPProbe: container health check spec http probe.
766+
type ContainerHealthCheckSpecHTTPProbe struct {
767+
// Path: path to use for the HTTP health check.
768+
Path string `json:"path"`
769+
}
770+
771+
// ContainerHealthCheckSpecTCPProbe: container health check spec tcp probe.
772+
type ContainerHealthCheckSpecTCPProbe struct {
773+
}
774+
775+
// ContainerHealthCheckSpec: container health check spec.
776+
type ContainerHealthCheckSpec struct {
777+
// HTTP: HTTP health check configuration.
778+
// Precisely one of HTTP, TCP must be set.
779+
HTTP *ContainerHealthCheckSpecHTTPProbe `json:"http,omitempty"`
780+
781+
// TCP: TCP health check configuration.
782+
// Precisely one of HTTP, TCP must be set.
783+
TCP *ContainerHealthCheckSpecTCPProbe `json:"tcp,omitempty"`
784+
785+
// FailureThreshold: during a deployment, if a newly created container fails to pass the health check, the deployment is aborted.
786+
// As a result, lowering this value can help to reduce the time it takes to detect a failed deployment.
787+
FailureThreshold uint32 `json:"failure_threshold"`
788+
789+
// Interval: period between health checks.
790+
Interval *scw.Duration `json:"interval"`
791+
}
792+
765793
// ContainerScalingOption: container scaling option.
766794
type ContainerScalingOption struct {
767795
// Precisely one of ConcurrentRequestsThreshold, CPUUsageThreshold must be set.
@@ -947,6 +975,9 @@ type Container struct {
947975
// - cpu_usage_threshold: Scale depending on the CPU usage of a container instance.
948976
ScalingOption *ContainerScalingOption `json:"scaling_option"`
949977

978+
// HealthCheck: health check configuration of the container.
979+
HealthCheck *ContainerHealthCheckSpec `json:"health_check"`
980+
950981
// CreatedAt: creation date of the container.
951982
CreatedAt *time.Time `json:"created_at"`
952983

@@ -1191,6 +1222,9 @@ type CreateContainerRequest struct {
11911222
// - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance.
11921223
// - cpu_usage_threshold: Scale depending on the CPU usage of a container instance.
11931224
ScalingOption *ContainerScalingOption `json:"scaling_option,omitempty"`
1225+
1226+
// HealthCheck: health check configuration of the container.
1227+
HealthCheck *ContainerHealthCheckSpec `json:"health_check,omitempty"`
11941228
}
11951229

11961230
// CreateCronRequest: create cron request.
@@ -1784,6 +1818,9 @@ type UpdateContainerRequest struct {
17841818
// - concurrent_requests_threshold: Scale depending on the number of concurrent requests being processed per container instance.
17851819
// - cpu_usage_threshold: Scale depending on the CPU usage of a container instance.
17861820
ScalingOption *ContainerScalingOption `json:"scaling_option,omitempty"`
1821+
1822+
// HealthCheck: health check configuration of the container.
1823+
HealthCheck *ContainerHealthCheckSpec `json:"health_check,omitempty"`
17871824
}
17881825

17891826
// UpdateCronRequest: update cron request.

0 commit comments

Comments
 (0)