Skip to content

Commit 684d583

Browse files
chore: improved handling of env variable for imagePullPolicy (#1921)
Signed-off-by: Alka Kumari <[email protected]>
1 parent 94d803f commit 684d583

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

controllers/argoutil/resource.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,17 @@ func GetImagePullPolicy(policy *corev1.PullPolicy) corev1.PullPolicy {
272272
return *policy
273273
}
274274

275-
if envValue := os.Getenv(common.ArgoCDImagePullPolicyEnvName); envValue != "" {
276-
return corev1.PullPolicy(envValue)
277-
}
275+
envValue := os.Getenv(common.ArgoCDImagePullPolicyEnvName)
276+
277+
switch envValue {
278+
case "Always":
279+
return corev1.PullAlways
280+
case "IfNotPresent":
281+
return corev1.PullIfNotPresent
282+
case "Never":
283+
return corev1.PullNever
284+
default:
285+
return corev1.PullPolicy("IfNotPresent")
278286

279-
return corev1.PullPolicy(common.DefaultImagePullPolicy)
287+
}
280288
}

0 commit comments

Comments
 (0)