From 961b11a6ab2555b46e4d9e62859f72ba3f23c613 Mon Sep 17 00:00:00 2001
From: Tawsif Siddiqui <trafid@oteemo.com>
Date: Mon, 6 Dec 2021 18:55:40 +0000
Subject: [PATCH] Updated bb values.yaml to have a global value for image pull
 policy for all core packages

---
 chart/templates/clusterauditor/values.yaml       |  3 +++
 chart/templates/gatekeeper/values.yaml           |  3 +++
 chart/templates/istio/controlplane/values.yaml   |  2 ++
 chart/templates/istio/operator/values.yaml       |  2 ++
 chart/templates/jaeger/values.yaml               |  3 +++
 chart/templates/kiali/values.yaml                |  5 +++++
 chart/templates/logging/eck-operator/values.yaml |  3 +++
 .../logging/elasticsearch-kibana/values.yaml     |  2 ++
 chart/templates/logging/fluentbit/values.yaml    |  3 +++
 chart/templates/monitoring/values.yaml           | 16 ++++++++++++++++
 chart/templates/twistlock/values.yaml            |  4 ++++
 chart/values.yaml                                |  5 +++++
 docs/guides/using_bigbang/image_pull_policy.md   |  8 ++++++--
 13 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/chart/templates/clusterauditor/values.yaml b/chart/templates/clusterauditor/values.yaml
index a1bd35fa66..fb9729b54e 100644
--- a/chart/templates/clusterauditor/values.yaml
+++ b/chart/templates/clusterauditor/values.yaml
@@ -7,6 +7,9 @@ elasticsearch:
   imagePullSecrets:
     - name: private-registry
 
+image:
+  imagePullPolicy: {{ .Values.imagePullPolicy }}
+
 monitoring:
   enabled: {{ .Values.monitoring.enabled }}
 
diff --git a/chart/templates/gatekeeper/values.yaml b/chart/templates/gatekeeper/values.yaml
index 197f5d9f9b..2687e6dfa5 100644
--- a/chart/templates/gatekeeper/values.yaml
+++ b/chart/templates/gatekeeper/values.yaml
@@ -4,17 +4,20 @@
 
 {{- define "bigbang.defaults.gatekeeper" -}}
 image:
+  pullPolicy: {{ .Values.imagePullPolicy }}
   pullSecrets:
   - name: private-registry
 postInstall:
   labelNamespace:
     enabled: false
     image:
+      pullPolicy: {{ .Values.imagePullPolicy }}
       pullSecrets:
       - name: private-registry
 postUpgrade:
   cleanupCRD:
     image:
+      pullPolicy: {{ .Values.imagePullPolicy }}
       pullSecrets:
       - name: private-registry
 
diff --git a/chart/templates/istio/controlplane/values.yaml b/chart/templates/istio/controlplane/values.yaml
index 320d1ccdf2..7a8789ed96 100644
--- a/chart/templates/istio/controlplane/values.yaml
+++ b/chart/templates/istio/controlplane/values.yaml
@@ -25,6 +25,8 @@ networkPolicies:
   enabled: {{ .Values.networkPolicies.enabled }}
   controlPlaneCidr: {{ .Values.networkPolicies.controlPlaneCidr }}
 
+imagePullPolicy: {{ .Values.imagePullPolicy }}
+
 {{- if .Values.istio.ingressGateways }}
 ingressGateways:
   istio-ingressgateway:
diff --git a/chart/templates/istio/operator/values.yaml b/chart/templates/istio/operator/values.yaml
index 2cf16e669b..0ca5e34aeb 100644
--- a/chart/templates/istio/operator/values.yaml
+++ b/chart/templates/istio/operator/values.yaml
@@ -5,6 +5,8 @@
 {{- define "bigbang.defaults.istiooperator" -}}
 createNamespace: false
 
+imagePullPolicy: {{ .Values.imagePullPolicy }}
+
 imagePullSecrets:
   - private-registry
 
diff --git a/chart/templates/jaeger/values.yaml b/chart/templates/jaeger/values.yaml
index 22e283fadf..e5c4578c18 100644
--- a/chart/templates/jaeger/values.yaml
+++ b/chart/templates/jaeger/values.yaml
@@ -6,6 +6,9 @@
 imagePullSecrets:
   - name: private-registry
 
+image:
+  pullPolicy: {{ .Values.imagePullPolicy }}
+  
 # hostname is deprecated and replaced with domain. But if hostname exists then use it.
 {{- $domainName := default .Values.domain .Values.hostname }}
 hostname: {{ $domainName }}
diff --git a/chart/templates/kiali/values.yaml b/chart/templates/kiali/values.yaml
index 255b680593..95baee6925 100644
--- a/chart/templates/kiali/values.yaml
+++ b/chart/templates/kiali/values.yaml
@@ -10,6 +10,9 @@ domain: {{ $domainName }}
 
 openshift: {{ .Values.openshift}}
 
+image:
+  pullPolicy: {{ .Values.imagePullPolicy }}
+
 istio:
   enabled: {{ .Values.istio.enabled }}
   kiali:
@@ -22,6 +25,8 @@ elasticsearch:
   enabled: {{ .Values.logging.enabled }}
 cr:
   spec:
+    deployment:
+      image_pull_policy: {{ .Values.imagePullPolicy }}
     server:
       web_port: "443"
     auth:
diff --git a/chart/templates/logging/eck-operator/values.yaml b/chart/templates/logging/eck-operator/values.yaml
index b99d839ff4..b96d4500f8 100644
--- a/chart/templates/logging/eck-operator/values.yaml
+++ b/chart/templates/logging/eck-operator/values.yaml
@@ -8,6 +8,9 @@ license:
   keyJSON: |
     {{ .Values.logging.license.keyJSON | nindent 4 }}
 
+image:
+  pullPolicy: {{ .Values.imagePullPolicy }}
+
 podAnnotations:
   sidecar.istio.io/inject: "true"
   traffic.sidecar.istio.io/includeInboundPorts: "*"
diff --git a/chart/templates/logging/elasticsearch-kibana/values.yaml b/chart/templates/logging/elasticsearch-kibana/values.yaml
index 3d88b62161..1fc0f42f6f 100644
--- a/chart/templates/logging/elasticsearch-kibana/values.yaml
+++ b/chart/templates/logging/elasticsearch-kibana/values.yaml
@@ -10,6 +10,8 @@ domain: {{ $domainName }}
 
 openshift: {{ .Values.openshift }}
 
+imagePullPolicy: {{ .Values.imagePullPolicy }}
+
 istio:
   enabled: {{ .Values.istio.enabled }}
   kibana:
diff --git a/chart/templates/logging/fluentbit/values.yaml b/chart/templates/logging/fluentbit/values.yaml
index db8da890b3..073d212398 100644
--- a/chart/templates/logging/fluentbit/values.yaml
+++ b/chart/templates/logging/fluentbit/values.yaml
@@ -11,6 +11,9 @@ elasticsearch:
 imagePullSecrets:
   - name: private-registry
 
+image:
+  pullPolicy: {{ .Values.imagePullPolicy }}
+
 networkPolicies:
   enabled: {{ .Values.networkPolicies.enabled }}
   controlPlaneCidr: {{ .Values.networkPolicies.controlPlaneCidr }}
diff --git a/chart/templates/monitoring/values.yaml b/chart/templates/monitoring/values.yaml
index f9dc7504a7..e541de5ea4 100644
--- a/chart/templates/monitoring/values.yaml
+++ b/chart/templates/monitoring/values.yaml
@@ -83,6 +83,7 @@ sso:
 
 grafana:
   image:
+    pullPolicy: {{ .Values.imagePullPolicy }}
     pullSecrets:
     - private-registry
 
@@ -127,6 +128,8 @@ grafana:
   {{- end }}
 
 prometheus-node-exporter:
+  image:
+    pullPolicy: {{ .Values.imagePullPolicy }}
   serviceAccount:
     imagePullSecrets:
     - name: private-registry
@@ -138,6 +141,19 @@ prometheus-node-exporter:
   {{- end }}
 
 kube-state-metrics:
+  image:
+    pullPolicy: {{ .Values.imagePullPolicy }}
   imagePullSecrets:
   - name: private-registry
+
+prometheusOperator:      
+  image:
+    pullPolicy: {{ .Values.imagePullPolicy }}      
+  admissionWebhooks:        
+    cleanupProxy:          
+      image:            
+        pullPolicy: {{ .Values.imagePullPolicy }}        
+    patch:           
+      image:            
+        pullPolicy: {{ .Values.imagePullPolicy }}
 {{- end -}}
diff --git a/chart/templates/twistlock/values.yaml b/chart/templates/twistlock/values.yaml
index efa83276dd..74d7e543f9 100644
--- a/chart/templates/twistlock/values.yaml
+++ b/chart/templates/twistlock/values.yaml
@@ -31,4 +31,8 @@ istio:
     gateways:
     - istio-system/{{ default "public" .Values.twistlock.ingress.gateway }}
 
+console:
+  image:
+    imagePullPolicy: {{ .Values.imagePullPolicy }}
+
 {{- end -}}
diff --git a/chart/values.yaml b/chart/values.yaml
index 5eea85f0e1..e85b93118a 100644
--- a/chart/values.yaml
+++ b/chart/values.yaml
@@ -109,6 +109,11 @@ networkPolicies:
   # Must be an IP CIDR range (x.x.x.x/x - ideally a /16 or /24 to include multiple IPs)
   nodeCidr: ""
 
+# -- Global ImagePullPolicy value for all packages
+# Permitted values are: None, Always, IfNotPresent 
+imagePullPolicy: IfNotPresent
+
+
 # ----------------------------------------------------------------------------------------------------------------------
 # Istio
 #
diff --git a/docs/guides/using_bigbang/image_pull_policy.md b/docs/guides/using_bigbang/image_pull_policy.md
index 2aa4596566..55de23dbb0 100644
--- a/docs/guides/using_bigbang/image_pull_policy.md
+++ b/docs/guides/using_bigbang/image_pull_policy.md
@@ -1,8 +1,12 @@
 # ImagePullPolicy at Big Bang Level
 
-Big Bang is currently working to standardize the adoption of a global image pull policy so that customers can set a single value and have it passed to all packages. This work is not yet complete, but should allow customers easier control over their global pull policy.
+Big Bang is currently working to standardize the adoption of a global image pull policy so that customers can set a single value and have it passed to all packages.
 
-In the meantime we have begun to document the package overrides required in preparation for this change.
+The global image pull policy has been adopted in Big Bang for the core packages currently. In the Big Bang values.yaml file, a global parameter has been created to set the global image pull policy (`imagePullPolicy` in values) and it gets passed down to all core packages spec. The default value for this global policy is `IfNotPresent`.
+
+This work is not yet complete for addons, but should allow customers easier control over their global pull policy.
+
+We have also documented the package overrides required if you want to set a single package/pod with a different pull policy than the global.
 
 # ImagePullPolicy per Package
 
-- 
GitLab