1.8. Configuring ImagePullPolicy
The GitOps Operator lets administrators configure imagePullPolicy at multiple levels to control how Argo CD components pull container images.
The imagePullPolicy configuration follows a hierarchical precedence system, where the most specific configuration takes priority:
-
Instance-level policy- Defined in the Argo CD CR by using thespec.imagePullPolicyfield. -
Global-level policy- Defined through theIMAGE_PULL_POLICYenvironment variable in the GitOps OperatorsSubscription. -
Default policy-IfNotPresentis used when neither of the earlier configurations are specified.
| Value | Description |
|---|---|
|
| Always pull the image. |
|
| Pull the image only if it is not present locally. |
|
| Never pull the image. |
You can define a global image pull policy for all Argo CD instances managed by the Operator by setting the IMAGE_PULL_POLICY environment variable in the Operator’s Subscription. For example:
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: openshift-gitops-operator
spec:
config:
env:
- name: IMAGE_PULL_POLICY
value: "Always"
An instance-level configuration overrides the Operator-level policy and applies the configuration only to the specific instance defined in the CR.
The following example shows how to configure imagePullPolicy for all the components in an Argo CD instance.
apiVersion: argoproj.io/v1beta1
kind: ArgoCD
metadata:
name: argocd
namespace: argocd
spec:
imagePullPolicy: IfNotPresent
The following example shows how to define imagePullPolicy for all the components in a GitOpsService instance.
apiVersion: pipelines.openshift.io/v1alpha1
kind: GitOpsService
metadata:
name: gitops-service
namespace: openshift-gitops
spec:
imagePullPolicy: Always
The following example shows how to set imagePullPolicy for all the components in a RolloutsManager instance.
apiVersion: argoproj.io/v1alpha1
kind: RolloutManager
metadata:
name: argo-rollout
labels:
example: basic
spec:
imagePullPolicy: Always
By configuring the imagePullPolicy at an appropriate level, you can control how often container images are updated for your GitOps components.