New version of the common template. It unifies the naming convention between platform...
[it/dep.git] / ric-common / Common-Template / helm / ric-common / templates / _dockerregistry.tpl
   - .Values.repositoryCredOverride : override global and default docker registry credential
 */}}
 {{- define "common.repositoryCred" -}}
-  {{- if .Values.repositoryCredOverride -}}
-    {{- printf "%s" .Values.repositoryCredOverride -}}
+  {{- $componentname := .Chart.Name -}}
+  {{- $firsttier := (index .Values (printf "%s" $componentname)) -}}
+  {{- if $firsttier -}}
+    {{- $secondtier := (index .Values (printf "%s" $componentname) (printf "%s" "repositoryCredOverride")) -}}
+    {{- if $secondtier -}}
+      {{- printf "%s" $secondtier -}}
+    {{- else -}}
+      {{- if .Values.global -}}
+        {{- if .Values.global.repositoryCred -}}
+          {{- printf "%s" .Values.global.repositoryCred -}}
+        {{- else -}}
+          {{- printf "%s" .Values.repositoryCred -}}
+        {{- end -}}
+      {{- else -}}
+        {{- printf "%s" .Values.repositoryCred -}}
+      {{- end -}}
+    {{- end -}}
   {{- else -}}
-    {{- if  .Values.global -}}
+    {{- if .Values.global -}}
       {{- if .Values.global.repositoryCred -}}
         {{- printf "%s" .Values.global.repositoryCred -}}
       {{- else -}}
-       {{- printf "%s" .Values.repositoryCred -}}
+        {{- printf "%s" .Values.repositoryCred -}}
       {{- end -}}
     {{- else -}}
       {{- printf "%s" .Values.repositoryCred -}}
 {{- end -}}
 
 
+
+
+
+
+
+
+
+
+
+
+
+
 {{/*
   Define the golbal image pull policy.
   The value for .Values.imagePullPolicy is used by default,