提交 d9614815 编写于 作者: W WangFengTu

Support image health check configure

Signed-off-by: NWangFengTu <wangfengtu@huawei.com>
上级 5bf2540f
......@@ -184,6 +184,16 @@ func transPBImageToImage(pbImage *pb.Image) (*Image, error) {
Created: &created,
Loaded: &loaded,
}
if pbImage.Healthcheck != nil {
respImg.Healthcheck = &HealthConfig{
Test: pbImage.Healthcheck.Test,
Interval: time.Duration(pbImage.Healthcheck.Interval),
Timeout: time.Duration(pbImage.Healthcheck.Timeout),
StartPeriod: time.Duration(pbImage.Healthcheck.StartPeriod),
Retries: int(pbImage.Healthcheck.Retries),
ExitOnUnhealthy: pbImage.Healthcheck.ExitOnUnhealthy,
}
}
if pbImage.Spec != nil && pbImage.Spec.Image != "" {
err = json.Unmarshal([]byte(pbImage.Spec.Image), &respImg.ImageSpec)
......@@ -228,6 +238,16 @@ func transImageToPBImage(img *Image) (*pb.Image, error) {
Created: created,
Loaded: loaded,
}
if img.Healthcheck != nil {
respImg.Healthcheck = &pb.HealthCheck{
Test: img.Healthcheck.Test,
Interval: int64(img.Healthcheck.Interval),
Timeout: int64(img.Healthcheck.Timeout),
StartPeriod: int64(img.Healthcheck.StartPeriod),
Retries: int32(img.Healthcheck.Retries),
ExitOnUnhealthy: img.Healthcheck.ExitOnUnhealthy,
}
}
spec, err := json.Marshal(img.ImageSpec)
if err != nil {
......
%global _version 2.0.0
%global _release 20200327.102036.git7eadc513
%global _release 20200330.224937.git01999b6e
Name: iSulad-img
Version: %{_version}
Release: %{_release}
......
此差异已折叠。
......@@ -424,6 +424,15 @@ message ListImagesRequest {
bool check = 2;
}
message HealthCheck {
repeated string test = 1;
int64 interval = 2;
int64 timeout = 3;
int64 start_period = 4;
int32 retries = 5;
bool exit_on_unhealthy = 6;
}
// Basic information about a container image.
message Image {
// ID of the image.
......@@ -450,6 +459,9 @@ message Image {
// oci image spec
ImageSpec spec = 9;
// Health check
HealthCheck healthcheck = 10;
}
message ListImagesResponse {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册