summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/kube/kube.go21
-rw-r--r--pkg/specgen/generate/kube/volume.go2
-rw-r--r--pkg/specgen/volumes.go2
3 files changed, 10 insertions, 15 deletions
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index e5b09dcd8..e39a700eb 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -5,7 +5,7 @@ import (
"fmt"
"strings"
- "github.com/containers/buildah/pkg/parse"
+ "github.com/containers/common/pkg/parse"
"github.com/containers/podman/v2/libpod/image"
ann "github.com/containers/podman/v2/pkg/annotations"
"github.com/containers/podman/v2/pkg/specgen"
@@ -129,24 +129,20 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
// TODO: We don't understand why specgen does not take of this, but
// integration tests clearly pointed out that it was required.
- s.Command = []string{}
imageData, err := opts.Image.Inspect(ctx)
if err != nil {
return nil, err
}
s.WorkDir = "/"
- // We will use "Docker field name" internally here to avoid confusion
- // and reference the "Kubernetes field name" when referencing the YAML
- // ref: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#notes
- entrypoint := []string{}
- cmd := []string{}
+ // Entrypoint/Command handling is based off of
+ // https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#notes
if imageData != nil && imageData.Config != nil {
if imageData.Config.WorkingDir != "" {
s.WorkDir = imageData.Config.WorkingDir
}
// Pull entrypoint and cmd from image
- entrypoint = imageData.Config.Entrypoint
- cmd = imageData.Config.Cmd
+ s.Entrypoint = imageData.Config.Entrypoint
+ s.Command = imageData.Config.Cmd
s.Labels = imageData.Config.Labels
if len(imageData.Config.StopSignal) > 0 {
stopSignal, err := util.ParseSignal(imageData.Config.StopSignal)
@@ -158,16 +154,15 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
}
// If only the yaml.Command is specified, set it as the entrypoint and drop the image Cmd
if len(opts.Container.Command) != 0 {
- entrypoint = opts.Container.Command
- cmd = []string{}
+ s.Entrypoint = opts.Container.Command
+ s.Command = []string{}
}
// Only override the cmd field if yaml.Args is specified
// Keep the image entrypoint, or the yaml.command if specified
if len(opts.Container.Args) != 0 {
- cmd = opts.Container.Args
+ s.Command = opts.Container.Args
}
- s.Command = append(entrypoint, cmd...)
// FIXME,
// we are currently ignoring imageData.Config.ExposedPorts
if opts.Container.WorkingDir != "" {
diff --git a/pkg/specgen/generate/kube/volume.go b/pkg/specgen/generate/kube/volume.go
index bb8edabb7..f5687f60d 100644
--- a/pkg/specgen/generate/kube/volume.go
+++ b/pkg/specgen/generate/kube/volume.go
@@ -3,7 +3,7 @@ package kube
import (
"os"
- "github.com/containers/buildah/pkg/parse"
+ "github.com/containers/common/pkg/parse"
"github.com/containers/podman/v2/libpod"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
diff --git a/pkg/specgen/volumes.go b/pkg/specgen/volumes.go
index a4f42d715..83634b4ef 100644
--- a/pkg/specgen/volumes.go
+++ b/pkg/specgen/volumes.go
@@ -4,7 +4,7 @@ import (
"path/filepath"
"strings"
- "github.com/containers/buildah/pkg/parse"
+ "github.com/containers/common/pkg/parse"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"