summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-16 16:40:44 -0400
committerGitHub <noreply@github.com>2020-09-16 16:40:44 -0400
commit8d7e7954546efb344d677e0c3c86d9d045a3de4f (patch)
tree387d9f86b2507ab4ec9b5c0f4e77fca39940aa8b /pkg
parentacf86ef5ab9c5307fe0bdc93bf534decaafe38ae (diff)
parentb3d6383f25e71748793535733a767c60ccfcbd82 (diff)
downloadpodman-8d7e7954546efb344d677e0c3c86d9d045a3de4f.tar.gz
podman-8d7e7954546efb344d677e0c3c86d9d045a3de4f.tar.bz2
podman-8d7e7954546efb344d677e0c3c86d9d045a3de4f.zip
Merge pull request #7621 from rhatdan/pods
Fix podman pod create --infra-command and --infra-image
Diffstat (limited to 'pkg')
-rw-r--r--pkg/domain/infra/runtime_libpod.go17
-rw-r--r--pkg/specgen/generate/pod_create.go9
-rw-r--r--pkg/specgen/pod_validate.go7
3 files changed, 9 insertions, 24 deletions
diff --git a/pkg/domain/infra/runtime_libpod.go b/pkg/domain/infra/runtime_libpod.go
index f9b8106ef..26c9c7e2e 100644
--- a/pkg/domain/infra/runtime_libpod.go
+++ b/pkg/domain/infra/runtime_libpod.go
@@ -227,23 +227,6 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo
// TODO flag to set CNI plugins dir?
- // TODO I don't think these belong here?
- // Will follow up with a different PR to address
- //
- // Pod create options
-
- infraImageFlag := fs.Lookup("infra-image")
- if infraImageFlag != nil && infraImageFlag.Changed {
- infraImage, _ := fs.GetString("infra-image")
- options = append(options, libpod.WithDefaultInfraImage(infraImage))
- }
-
- infraCommandFlag := fs.Lookup("infra-command")
- if infraCommandFlag != nil && infraImageFlag.Changed {
- infraCommand, _ := fs.GetString("infra-command")
- options = append(options, libpod.WithDefaultInfraCommand(infraCommand))
- }
-
if !opts.withFDS {
options = append(options, libpod.WithEnableSDNotify())
}
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go
index 0bd39d5a4..101201252 100644
--- a/pkg/specgen/generate/pod_create.go
+++ b/pkg/specgen/generate/pod_create.go
@@ -84,6 +84,15 @@ func createPodOptions(p *specgen.PodSpecGenerator, rt *libpod.Runtime) ([]libpod
if len(p.CNINetworks) > 0 {
options = append(options, libpod.WithPodNetworks(p.CNINetworks))
}
+
+ if len(p.InfraImage) > 0 {
+ options = append(options, libpod.WithInfraImage(p.InfraImage))
+ }
+
+ if len(p.InfraCommand) > 0 {
+ options = append(options, libpod.WithInfraCommand(p.InfraCommand))
+ }
+
switch p.NetNS.NSMode {
case specgen.Bridge, specgen.Default, "":
logrus.Debugf("Pod using default network mode")
diff --git a/pkg/specgen/pod_validate.go b/pkg/specgen/pod_validate.go
index d5e0aecf2..907c0bb69 100644
--- a/pkg/specgen/pod_validate.go
+++ b/pkg/specgen/pod_validate.go
@@ -95,12 +95,5 @@ func (p *PodSpecGenerator) Validate() error {
return exclusivePodOptions("NoManageHosts", "HostAdd")
}
- // Set Defaults
- if len(p.InfraImage) < 1 {
- p.InfraImage = containerConfig.Engine.InfraImage
- }
- if len(p.InfraCommand) < 1 {
- p.InfraCommand = []string{containerConfig.Engine.InfraCommand}
- }
return nil
}