diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-17 21:08:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 21:08:32 +0200 |
commit | 8caed305741c8c9e34ec767c9054e3c5e0d33576 (patch) | |
tree | a52d68931d6f620ff66ac31b7ca6629b420f7b06 /pkg/specgen | |
parent | 47108e2e093bae318773998a18f83d0504a402e0 (diff) | |
parent | c4b2078508a45843034a86916b37a52d3e34d20d (diff) | |
download | podman-8caed305741c8c9e34ec767c9054e3c5e0d33576.tar.gz podman-8caed305741c8c9e34ec767c9054e3c5e0d33576.tar.bz2 podman-8caed305741c8c9e34ec767c9054e3c5e0d33576.zip |
Merge pull request #7283 from mheon/pod_infra_has_exit_cmd
Ensure pod infra containers have an exit command
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/pod_create.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index 0cbfca2db..0bd39d5a4 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -13,14 +13,14 @@ func MakePod(p *specgen.PodSpecGenerator, rt *libpod.Runtime) (*libpod.Pod, erro if err := p.Validate(); err != nil { return nil, err } - options, err := createPodOptions(p) + options, err := createPodOptions(p, rt) if err != nil { return nil, err } return rt.NewPod(context.Background(), options...) } -func createPodOptions(p *specgen.PodSpecGenerator) ([]libpod.PodCreateOption, error) { +func createPodOptions(p *specgen.PodSpecGenerator, rt *libpod.Runtime) ([]libpod.PodCreateOption, error) { var ( options []libpod.PodCreateOption ) @@ -31,6 +31,18 @@ func createPodOptions(p *specgen.PodSpecGenerator) ([]libpod.PodCreateOption, er return nil, err } options = append(options, nsOptions...) + + // Make our exit command + storageConfig := rt.StorageConfig() + runtimeConfig, err := rt.GetConfig() + if err != nil { + return nil, err + } + exitCommand, err := CreateExitCommandArgs(storageConfig, runtimeConfig, logrus.IsLevelEnabled(logrus.DebugLevel), false, false) + if err != nil { + return nil, errors.Wrapf(err, "error creating infra container exit command") + } + options = append(options, libpod.WithPodInfraExitCommand(exitCommand)) } if len(p.CgroupParent) > 0 { options = append(options, libpod.WithPodCgroupParent(p.CgroupParent)) |