Skip to content

Commit

Permalink
Set the imagePullPolicy from 'Always' to 'IfNotPresent'
Browse files Browse the repository at this point in the history
  • Loading branch information
alphanota committed Jan 30, 2025
1 parent b08608d commit 7a6372f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion integration/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func TestRunWithImagePullPolicy(t *testing.T) {
pods: []string{"getting-started"},
},
{
description: "'Always' doesn't actually pull and reads a local image that doesn't exist remotely",
description: "'Always' internally is changed to ifNotPresent and reads a local image that doesn't exist remotely",
dir: "testdata/image-pull-policy/always",
pods: []string{"getting-started"},
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/kubernetes/manifest/image_pull_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import apimachinery "k8s.io/apimachinery/pkg/runtime/schema"

const imagePullPolicyField = "imagePullPolicy"
const imagePullPolicyAlways = "Always"
const imagePullPolicyNever = "Never"
const imagePullPolicyIfNotPresent = "IfNotPresent"

// resourceSelectorImagePullPolicy selects PodSpecs for transforming the imagePullPolicy field
// based on allowlist and denylist rules for their GroupKind and navigation path.
Expand Down Expand Up @@ -87,7 +87,7 @@ func (i *imagePullPolicyReplacer) Visit(gk apimachinery.GroupKind, navpath strin
return true
}
if o[imagePullPolicyField] == imagePullPolicyAlways {
o[imagePullPolicyField] = imagePullPolicyNever
o[imagePullPolicyField] = imagePullPolicyIfNotPresent
}
return false
}
2 changes: 1 addition & 1 deletion pkg/skaffold/kubernetes/manifest/image_pull_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
imagePullPolicy: IfNotPresent
- image: gcr.io/k8s-skaffold/example@sha256:81daf011d63b68cfa514ddab7741a1adddd59d3264118dfb0fd9266328bb8883
name: always
imagePullPolicy: Never
imagePullPolicy: IfNotPresent
- image: gcr.io/k8s-skaffold/example@sha256:81daf011d63b68cfa514ddab7741a1adddd59d3264118dfb0fd9266328bb8883
name: never
imagePullPolicy: Never
Expand Down

0 comments on commit 7a6372f

Please sign in to comment.