diff --git a/0001-fix-missing-healthcheck-configuration-bug.patch b/0001-fix-missing-healthcheck-configuration-bug.patch new file mode 100644 index 0000000000000000000000000000000000000000..13c86f700dd04adc2f1537338a91dca382e1a433 --- /dev/null +++ b/0001-fix-missing-healthcheck-configuration-bug.patch @@ -0,0 +1,242 @@ +From 3fbe74a506744c61049fbb219dbee5dbd5905ee0 Mon Sep 17 00:00:00 2001 +From: wangkang101 <873229877@qq.com> +Date: Thu, 17 Dec 2020 20:17:04 +0800 +Subject: [PATCH] fix missing healthcheck configuration bug + +Signed-off-by: wangkang101 <873229877@qq.com> +--- + Makefile | 2 +- + transform/docker/docker_test.go | 4 +- + transform/docker/reconcile.go | 6 +-- + transform/docker/reconcile_test.go | 6 +-- + types/isulad_v2.go | 79 ++++++++++++++---------------- + 5 files changed, 45 insertions(+), 52 deletions(-) + +diff --git a/Makefile b/Makefile +index d394fed..12ae849 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + NAME=isula-transform + +-VERSION=0.9.0 ++VERSION=0.9.1 + COMMIT=$(shell git rev-parse HEAD 2> /dev/null || true) + + BEP_DIR=/tmp/isula-transform-build-bep +diff --git a/transform/docker/docker_test.go b/transform/docker/docker_test.go +index 908db00..b9bba8d 100644 +--- a/transform/docker/docker_test.go ++++ b/transform/docker/docker_test.go +@@ -201,7 +201,7 @@ func Test_dockerConfigEngine_transformV2Config(t *testing.T) { + Cmd: []string{ + "bash", + }, +- Labels: make(map[string]string), ++ Labels: nil, + Image: "isulatransformtestcontainer:image", + Annotations: map[string]string{ + "cgroup.dir": "/isulad", +@@ -212,6 +212,7 @@ func Test_dockerConfigEngine_transformV2Config(t *testing.T) { + "native.umask": "secure", + "rootfs.mount": "/var/lib/isulad/mnt/rootfs", + }, ++ LogDriver: "json-file", + }, + Created: time.Unix(1579744800, 000000000).Local(), + Image: "isulatransformtestcontainer:image", +@@ -224,7 +225,6 @@ func Test_dockerConfigEngine_transformV2Config(t *testing.T) { + OriginResolvConfPath: "/var/lib/docker/containers/511e7f915e3f5dc09b36a49657125eea4b36a05f862ab3dd01e0b9b2/resolv.conf", + ShmPath: tmpdir + "/lib/isulad/engines/lcr/511e7f915e3f5dc09b36a49657125eea4b36a05f862ab3dd01e0b9b2/mounts/shm", + LogPath: "none", +- LogDriver: "json-file", + BaseFs: "newRootFS", + MountPoints: make(map[string]types.Mount), + Name: "isulatransformtestcontainer", +diff --git a/transform/docker/reconcile.go b/transform/docker/reconcile.go +index fbb88d3..b9f2a6a 100644 +--- a/transform/docker/reconcile.go ++++ b/transform/docker/reconcile.go +@@ -85,7 +85,7 @@ func v2ConfigWithLogConfig(cfg *container.LogConfig, basePath string) v2ConfigRe + // max-file、max-size、compress、labels、env、env-regex、tag + // isulad only support: + // max-file, max-size +- v2.CommonConfig.LogDriver = logDriverJSONFile ++ v2.CommonConfig.Config.LogDriver = logDriverJSONFile + v2.CommonConfig.Config.Annotations["log.console.driver"] = logDriverJSONFile + v2.CommonConfig.LogPath = filepath.Join(basePath, "console.log") + v2.CommonConfig.Config.Annotations["log.console.file"] = v2.CommonConfig.LogPath +@@ -100,7 +100,7 @@ func v2ConfigWithLogConfig(cfg *container.LogConfig, basePath string) v2ConfigRe + v2.CommonConfig.Config.Annotations["log.console.filesize"] = defaultLogSize + } + case logDriverSyslog: +- v2.CommonConfig.LogDriver = logDriverSyslog ++ v2.CommonConfig.Config.LogDriver = logDriverSyslog + v2.CommonConfig.Config.Annotations["log.console.driver"] = logDriverSyslog + // docker allowed LogOpts: + // env, env-regex, labels, syslog-facility, tag, syslog-format +@@ -115,8 +115,8 @@ func v2ConfigWithLogConfig(cfg *container.LogConfig, basePath string) v2ConfigRe + } + default: + // use isulad default driver without file +- v2.CommonConfig.LogDriver = defaultLogDriver + v2.CommonConfig.LogPath = defaultLogPath ++ v2.CommonConfig.Config.LogDriver = defaultLogDriver + v2.CommonConfig.Config.Annotations["log.console.driver"] = defaultLogDriver + v2.CommonConfig.Config.Annotations["log.console.file"] = defaultLogPath + v2.CommonConfig.Config.Annotations["log.console.filerotate"] = defaultLogRotate +diff --git a/transform/docker/reconcile_test.go b/transform/docker/reconcile_test.go +index 7e887ec..c7f9289 100644 +--- a/transform/docker/reconcile_test.go ++++ b/transform/docker/reconcile_test.go +@@ -112,7 +112,7 @@ func Test_reconcileV2Config(t *testing.T) { + }) + + Convey("json-file log driver", func() { +- expectCfg.CommonConfig.LogDriver = logDriverJSONFile ++ expectCfg.CommonConfig.Config.LogDriver = logDriverJSONFile + expectCfg.CommonConfig.LogPath = baseLcrPath + "/console.log" + expectCfg.CommonConfig.Config.Annotations["log.console.driver"] = logDriverJSONFile + expectCfg.CommonConfig.Config.Annotations["log.console.file"] = baseLcrPath + "/console.log" +@@ -161,7 +161,7 @@ func Test_reconcileV2Config(t *testing.T) { + "env": "not retain", + }, + } +- expectCfg.CommonConfig.LogDriver = logDriverSyslog ++ expectCfg.CommonConfig.Config.LogDriver = logDriverSyslog + expectCfg.CommonConfig.Config.Annotations["log.console.driver"] = logDriverSyslog + expectCfg.CommonConfig.Config.Annotations["log.console.tag"] = "test" + expectCfg.CommonConfig.Config.Annotations["log.console.facility"] = "local1" +@@ -180,7 +180,7 @@ func Test_reconcileV2Config(t *testing.T) { + "tag": "test", + }, + } +- expectCfg.CommonConfig.LogDriver = defaultLogDriver ++ expectCfg.CommonConfig.Config.LogDriver = defaultLogDriver + expectCfg.CommonConfig.LogPath = defaultLogPath + expectCfg.CommonConfig.Config.Annotations["log.console.driver"] = defaultLogDriver + expectCfg.CommonConfig.Config.Annotations["log.console.file"] = defaultLogPath +diff --git a/types/isulad_v2.go b/types/isulad_v2.go +index 4e01448..3cc15c6 100644 +--- a/types/isulad_v2.go ++++ b/types/isulad_v2.go +@@ -16,6 +16,7 @@ import "time" + + // Mount is mapped according to isulad's definition. + type Mount struct { ++ Type string `json:",omitempty"` + Destination string `json:",omitempty"` + Driver string `json:",omitempty"` + Key string `json:",omitempty"` +@@ -37,44 +38,37 @@ type HealthCheckCfg struct { + ExitOnUnhealthy bool + } + +-// LogConfig is mapped according to isulad's definition. +-type LogConfig struct { +- LogFile string `json:"log_file,,omitempty"` +- LogFileSize string +- LogFileRotate uint64 +-} +- + // ContainerCfg is mapped according to isulad's definition. + type ContainerCfg struct { +- Hostname string +- DomainName string `json:"DomainName,omitempty"` +- User string `json:"User,omitempty"` +- AttachStdin bool +- AttachStdout bool +- AttachStderr bool +- ExposedPorts map[string]struct{} +- PublishService string `json:"PublishService,omitempty"` +- Tty bool +- OpenStdin bool +- StdinOnce bool +- Env []string +- Cmd []string +- ArgsEscaped bool +- NetworkDisabled bool +- Image string +- Volume map[string]struct{} +- WorkingDir string `json:"WorkingDir,omitempty"` +- Entrypoint []string +- MacAddress string `json:"MacAddress,omitempty"` +- Onbuild []string +- Labels map[string]string +- Annotations map[string]string +- StopSignal string `json:"StopSignal,omitempty"` +- HealthCheck *HealthCheckCfg +- SystemContainer bool +- NsChangeOpt string +- Mounts map[string]string +- LogConfig *LogConfig ++ Hostname string `json:"hostname,omitempty"` ++ DomainName string `json:"DomainName,omitempty"` ++ User string `json:"User,omitempty"` ++ AttachStdin bool `json:"AttachStdin,omitempty"` ++ AttachStdout bool `json:"AttachStdout,omitempty"` ++ AttachStderr bool `json:"AttachStderr,omitempty"` ++ ExposedPorts map[string]struct{} `json:"ExposedPorts,omitempty"` ++ PublishService string `json:"PublishService,omitempty"` ++ Tty bool `json:"Tty,omitempty"` ++ OpenStdin bool `json:"OpenStdin,omitempty"` ++ StdinOnce bool `json:"StdinOnce,omitempty"` ++ Env []string `json:"Env,omitempty"` ++ Cmd []string `json:"Cmd,omitempty"` ++ ArgsEscaped bool `json:"ArgsEscaped,omitempty"` ++ NetworkDisabled bool `json:"NetworkDisabled,omitempty"` ++ Image string `json:"Image,omitempty"` ++ Volumes map[string]struct{} `json:"Volumes,omitempty"` ++ WorkingDir string `json:"WorkingDir,omitempty"` ++ Entrypoint []string `json:"Entrypoint,omitempty"` ++ MacAddress string `json:"MacAddress,omitempty"` ++ Onbuild []string `json:"Onbuild,omitempty"` ++ Labels map[string]string `json:"Labels,omitempty"` ++ LogDriver string `json:"LogDriver,omitempty"` ++ Annotations map[string]string `json:"Annotations,omitempty"` ++ StopSignal string `json:"StopSignal,omitempty"` ++ HealthCheck *HealthCheckCfg `json:"Healthcheck,omitempty"` ++ SystemContainer bool `json:"SystemContainer,omitempty"` ++ NsChangeOpt string `json:"NsChangeOpt,omitempty"` ++ Mounts map[string]string `json:"Mounts,omitempty"` + } + + // HealthLog is mapped according to isulad's definition. +@@ -95,20 +89,20 @@ type HealthCfg struct { + // ContainerState is mapped according to isulad's definition. + type ContainerState struct { + Dead bool `json:"Dead,omitempty"` +- RemovalInprogress bool `json:"RemovalInprogress,omitempty"` +- Restarting bool `json:"Restarting,omitempty"` +- Running bool `json:"Running,omitempty"` +- OOMKilled bool `json:"OomKilled,omitempty"` +- Paused bool `json:"Paused,omitempty"` +- Starting bool `json:"Starting,omitempty"` + Error string `json:"Error,omitempty"` + ExitCode int `json:"ExitCode,omitempty"` + FinishedAt time.Time `json:"FinishedAt,omitempty"` ++ OOMKilled bool `json:"OomKilled,omitempty"` ++ Paused bool `json:"Paused,omitempty"` + Pid int `json:"Pid,omitempty"` + PPid int `json:"PPid,omitempty"` + StartTime uint64 `json:"StartTime,omitempty"` + PStartTime uint64 `json:"PStartTime,omitempty"` ++ RemovalInprogress bool `json:"RemovalInprogress,omitempty"` ++ Restarting bool `json:"Restarting,omitempty"` ++ Running bool `json:"Running,omitempty"` + StartedAt time.Time `json:"StartedAt,omitempty"` ++ Starting bool `json:"Starting,omitempty"` + Health *HealthCfg `json:"Health,omitempty"` + } + +@@ -127,7 +121,6 @@ type CommonConfig struct { + ResolvConfPath string `json:"ResolvConfPath,omitempty"` + ShmPath string `json:"ShmPath,omitempty"` + LogPath string `json:"LogPath,omitempty"` +- LogDriver string `json:"LogDriver,omitempty"` + BaseFs string `json:"BaseFs,omitempty"` + MountPoints map[string]Mount `json:"MountPoints,omitempty"` + Name string `json:"Name"` +-- +2.18.4 + diff --git a/isula-transform.spec b/isula-transform.spec index 4eb85b06f25f76f526aea19fe11659b82af2afc0..d3a2fa6c25787b0cc185ae9e7058efb53c5e953b 100644 --- a/isula-transform.spec +++ b/isula-transform.spec @@ -1,12 +1,14 @@ # Basic Infomation Name: isula-transform Version: 0.9.1 -Release: 1 +Release: 2 Summary: transform docker container to islua container License: Mulan PSL V2 URL: https://gitee.com/openeuler/isula-transform Source0: %{name}-%{version}.tar.gz +Patch0001: 0001-fix-missing-healthcheck-configuration-bug.patch + # Dependency BuildRequires: lcr-devel lxc-devel yajl-devel BuildRequires: iSulad >= 2.0.5 @@ -19,7 +21,7 @@ container to a type that isulad can recognize as being loaded. # Build Sections %prep -%autosetup -n %{name} +%autosetup -n %{name} -Sgit -p1 %build make @@ -36,6 +38,9 @@ rm -rf %{buildroot} %attr(550,root,root) %{_bindir}/isula-transform %changelog +* Fri Dec 18 2020 wangkang101<873229877@qq.com> - 0.9.1-2 +- fix missing healthcheck configuration bug + * Fri Nov 13 2020 wangkang101<873229877@qq.com> - 0.9.1-1 - adapt to iSulad 2.0.5