diff --git a/pkg/loader/compose/v3.go b/pkg/loader/compose/v3.go index e2b4a5ab..89fc88c6 100755 --- a/pkg/loader/compose/v3.go +++ b/pkg/loader/compose/v3.go @@ -17,11 +17,12 @@ limitations under the License. package compose import ( - "github.com/spf13/cast" "strconv" "strings" "time" + "github.com/spf13/cast" + libcomposeyaml "github.com/docker/libcompose/yaml" "k8s.io/kubernetes/pkg/api" @@ -311,6 +312,10 @@ func dockerComposeToKomposeMapping(composeObject *types.Config) (kobject.Kompose serviceConfig.DomainName = composeServiceConfig.DomainName serviceConfig.Secrets = composeServiceConfig.Secrets + if composeServiceConfig.StopGracePeriod != nil { + serviceConfig.StopGracePeriod = composeServiceConfig.StopGracePeriod.String() + } + parseV3Network(&composeServiceConfig, &serviceConfig, composeObject) if err := parseV3Resources(&composeServiceConfig, &serviceConfig); err != nil { @@ -726,9 +731,6 @@ func mergeComposeObject(oldCompose *types.Config, newCompose *types.Config) (*ty if service.StdinOpen != tmpOldService.StdinOpen { tmpOldService.StdinOpen = service.StdinOpen } - if service.StopGracePeriod != nil { - tmpOldService.StopGracePeriod = service.StopGracePeriod - } if service.StopSignal != "" { tmpOldService.StopSignal = service.StopSignal } diff --git a/script/test/fixtures/v3/output-k8s-full-example.json b/script/test/fixtures/v3/output-k8s-full-example.json index 912f62c5..a5066e87 100644 --- a/script/test/fixtures/v3/output-k8s-full-example.json +++ b/script/test/fixtures/v3/output-k8s-full-example.json @@ -367,6 +367,7 @@ } ], "restartPolicy": "OnFailure", + "terminationGracePeriodSeconds": 20, "hostname": "foo", "subdomain": "foo.com" }, diff --git a/script/test/fixtures/v3/output-os-full-example.json b/script/test/fixtures/v3/output-os-full-example.json index 8d72db1b..97799228 100644 --- a/script/test/fixtures/v3/output-os-full-example.json +++ b/script/test/fixtures/v3/output-os-full-example.json @@ -367,6 +367,7 @@ } ], "restartPolicy": "OnFailure", + "terminationGracePeriodSeconds": 20, "hostname": "foo", "subdomain": "foo.com" },