aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-01-28 12:35:12 -0800
committerGitHub <noreply@github.com>2020-01-28 12:35:12 -0800
commit63b1656f4c91675dce79fbf6e02018659a0badc1 (patch)
tree65142d928d2eb9b799808f90b94032f6e19af1b2 /pkg
parentd8f2333b29765d3407f90b062bfb40e43133d5e8 (diff)
parent31a1f44fe6934c6247f7bf2f5774805b263da660 (diff)
downloadpodman-63b1656f4c91675dce79fbf6e02018659a0badc1.tar.gz
podman-63b1656f4c91675dce79fbf6e02018659a0badc1.tar.bz2
podman-63b1656f4c91675dce79fbf6e02018659a0badc1.zip
Merge pull request #4993 from baude/playkubepull
honor pull policy in play kube
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/pods.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go
index f89fc7011..b0e63f770 100644
--- a/pkg/adapter/pods.go
+++ b/pkg/adapter/pods.go
@@ -12,6 +12,7 @@ import (
"strings"
"github.com/containers/buildah/pkg/parse"
+ "github.com/containers/image/v5/docker/reference"
"github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared"
@@ -604,7 +605,24 @@ func (r *LocalRuntime) PlayKubeYAML(ctx context.Context, c *cliconfig.KubePlayVa
}
for _, container := range podYAML.Spec.Containers {
- newImage, err := r.ImageRuntime().New(ctx, container.Image, c.SignaturePolicy, c.Authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, nil, util.PullImageMissing)
+ pullPolicy := util.PullImageMissing
+ if len(container.ImagePullPolicy) > 0 {
+ pullPolicy, err = util.ValidatePullType(string(container.ImagePullPolicy))
+ if err != nil {
+ return nil, err
+ }
+ }
+ named, err := reference.ParseNormalizedNamed(container.Image)
+ if err != nil {
+ return nil, err
+ }
+ // In kube, if the image is tagged with latest, it should always pull
+ if tagged, isTagged := named.(reference.NamedTagged); isTagged {
+ if tagged.Tag() == image.LatestTag {
+ pullPolicy = util.PullImageAlways
+ }
+ }
+ newImage, err := r.ImageRuntime().New(ctx, container.Image, c.SignaturePolicy, c.Authfile, writer, &dockerRegistryOptions, image.SigningOptions{}, nil, pullPolicy)
if err != nil {
return nil, err
}