[SDNC] Uses new tpls for repos / images

This commit makes SDNC chart to use the new generator for repositories and
images.

Issue-ID: OOM-2364
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: Iec8379934829947be1cb466b007c949a8448e742
diff --git a/kubernetes/sdnc/components/dmaap-listener/requirements.yaml b/kubernetes/sdnc/components/dmaap-listener/requirements.yaml
index f994771..fbe5155 100644
--- a/kubernetes/sdnc/components/dmaap-listener/requirements.yaml
+++ b/kubernetes/sdnc/components/dmaap-listener/requirements.yaml
@@ -16,3 +16,6 @@
   - name: common
     version: ~6.x-0
     repository: '@local'
+  - name: repositoryGenerator
+    version: ~6.x-0
+    repository: '@local'
diff --git a/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml b/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml
index e3dfa86..fd45eae 100644
--- a/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/dmaap-listener/templates/deployment.yaml
@@ -46,7 +46,7 @@
           name: config-input
         - mountPath: /config
           name: properties
-        image: "{{ .Values.global.envsubstImage }}"
+        image: {{ include "repositoryGenerator.image.envsubst" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-update-config
 
@@ -65,14 +65,14 @@
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
       containers:
       - command:
         - /opt/onap/sdnc/dmaap-listener/bin/start-dmaap-listener.sh
         name: {{ include "common.name" . }}
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
         - name: PROPERTY_DIR
diff --git a/kubernetes/sdnc/components/dmaap-listener/values.yaml b/kubernetes/sdnc/components/dmaap-listener/values.yaml
index 0f3f18b..27876cb 100644
--- a/kubernetes/sdnc/components/dmaap-listener/values.yaml
+++ b/kubernetes/sdnc/components/dmaap-listener/values.yaml
@@ -17,11 +17,6 @@
 #################################################################
 global:
   nodePortPrefix: 302
-  readinessImage: onap/oom/readiness:3.0.1
-  loggingRepository: docker.elastic.co
-  loggingImage: beats/filebeat:5.5.0
-  # envsusbt
-  envsubstImage: dibi/envsubst
   mariadbGalera:
     #This flag allows SO to instantiate its own mariadb-galera cluster
     #If shared instance is used, this chart assumes that DB already exists
@@ -54,7 +49,6 @@
 # Application configuration defaults.
 #################################################################
 # application image
-repository: nexus3.onap.org:10001
 image: onap/sdnc-dmaap-listener-image:2.0.4
 pullPolicy: Always
 
diff --git a/kubernetes/sdnc/components/sdnc-ansible-server/requirements.yaml b/kubernetes/sdnc/components/sdnc-ansible-server/requirements.yaml
index 6a61926..b8e59b0 100644
--- a/kubernetes/sdnc/components/sdnc-ansible-server/requirements.yaml
+++ b/kubernetes/sdnc/components/sdnc-ansible-server/requirements.yaml
@@ -15,4 +15,7 @@
 dependencies:
   - name: common
     version: ~6.x-0
+    repository: '@local'
+  - name: repositoryGenerator
+    version: ~6.x-0
     repository: '@local'
\ No newline at end of file
diff --git a/kubernetes/sdnc/components/sdnc-ansible-server/templates/deployment.yaml b/kubernetes/sdnc/components/sdnc-ansible-server/templates/deployment.yaml
index d6d05ef..41a5c09 100644
--- a/kubernetes/sdnc/components/sdnc-ansible-server/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/sdnc-ansible-server/templates/deployment.yaml
@@ -46,7 +46,7 @@
           name: config-input
         - mountPath: /config
           name: config
-        image: "{{ .Values.global.envsubstImage }}"
+        image: {{ include "repositoryGenerator.image.envsubst" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-update-config
 
@@ -61,7 +61,7 @@
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
       containers:
@@ -69,7 +69,7 @@
           command: ["/bin/bash"]
           args: ["-c", "cd /opt/onap/ccsdk && ./startAnsibleServer.sh"]
 
-          image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+          image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           ports:
           - containerPort: {{ .Values.service.internalPort }}
diff --git a/kubernetes/sdnc/components/sdnc-ansible-server/values.yaml b/kubernetes/sdnc/components/sdnc-ansible-server/values.yaml
index 080ae9c..858ff71 100644
--- a/kubernetes/sdnc/components/sdnc-ansible-server/values.yaml
+++ b/kubernetes/sdnc/components/sdnc-ansible-server/values.yaml
@@ -17,11 +17,6 @@
 #################################################################
 global:
   nodePortPrefix: 302
-  readinessImage: onap/oom/readiness:3.0.1
-  loggingRepository: docker.elastic.co
-  loggingImage: beats/filebeat:5.5.0
-  # envsusbt
-  envsubstImage: dibi/envsubst
   mariadbGalera:
     #This flag allows SO to instantiate its own mariadb-galera cluster
     #If shared instance is used, this chart assumes that DB already exists
@@ -54,7 +49,6 @@
 # Application configuration defaults.
 #################################################################
 # application image
-repository: nexus3.onap.org:10001
 image: onap/sdnc-ansible-server-image:2.0.4
 pullPolicy: Always
 
diff --git a/kubernetes/sdnc/components/sdnc-prom/requirements.yaml b/kubernetes/sdnc/components/sdnc-prom/requirements.yaml
index e4c7240..6317f58 100644
--- a/kubernetes/sdnc/components/sdnc-prom/requirements.yaml
+++ b/kubernetes/sdnc/components/sdnc-prom/requirements.yaml
@@ -16,3 +16,6 @@
   - name: common
     version: ~6.x-0
     repository: '@local'
+  - name: repositoryGenerator
+    version: ~6.x-0
+    repository: '@local'
diff --git a/kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml b/kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml
index 1853ab9..1c9adad 100644
--- a/kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml
@@ -40,12 +40,12 @@
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
       containers:
       - name: {{ include "common.name" . }}
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         envFrom:
           - configMapRef:
diff --git a/kubernetes/sdnc/components/sdnc-prom/values.yaml b/kubernetes/sdnc/components/sdnc-prom/values.yaml
index 9551bc4..d9afd1a 100644
--- a/kubernetes/sdnc/components/sdnc-prom/values.yaml
+++ b/kubernetes/sdnc/components/sdnc-prom/values.yaml
@@ -17,10 +17,6 @@
 #################################################################
 global:
   nodePortPrefix: 302
-  repository: nexus3.onap.org:10001
-  readinessImage: onap/oom/readiness:3.0.1
-  loggingRepository: docker.elastic.co
-  loggingImage: beats/filebeat:5.5.0
   persistence:
     mountPath: /dockerdata-nfs
 
@@ -28,7 +24,6 @@
 # Application configuration defaults.
 #################################################################
 # application image
-repository: nexus3.onap.org:10001
 pullPolicy: Always
 image: onap/music/prom:1.0.5
 
diff --git a/kubernetes/sdnc/components/sdnc-web/requirements.yaml b/kubernetes/sdnc/components/sdnc-web/requirements.yaml
index dcb280d..fbf6d0d 100644
--- a/kubernetes/sdnc/components/sdnc-web/requirements.yaml
+++ b/kubernetes/sdnc/components/sdnc-web/requirements.yaml
@@ -19,4 +19,7 @@
     repository: '@local'
   - name: certInitializer
     version: ~6.x-0
+    repository: '@local'
+  - name: repositoryGenerator
+    version: ~6.x-0
     repository: '@local'
\ No newline at end of file
diff --git a/kubernetes/sdnc/components/sdnc-web/templates/deployment.yaml b/kubernetes/sdnc/components/sdnc-web/templates/deployment.yaml
index 7c1f262..501125f 100644
--- a/kubernetes/sdnc/components/sdnc-web/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/sdnc-web/templates/deployment.yaml
@@ -26,7 +26,7 @@
     spec:
       initContainers: {{ include "common.certInitializer.initContainer" . | indent 6 }}
       - name: {{ include "common.name" . }}-readiness
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         command:
         - /app/ready.py
@@ -42,7 +42,7 @@
 
       containers:
         - name: {{ include "common.name" . }}
-          image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+          image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           ports: {{- include "common.containerPorts" . | indent 10 }}
           # disable liveness probe when breakpoints set in debugger
diff --git a/kubernetes/sdnc/components/sdnc-web/values.yaml b/kubernetes/sdnc/components/sdnc-web/values.yaml
index 136379a..f040736 100644
--- a/kubernetes/sdnc/components/sdnc-web/values.yaml
+++ b/kubernetes/sdnc/components/sdnc-web/values.yaml
@@ -18,15 +18,11 @@
 global:
   aafEnabled: true
   nodePortPrefix: 322
-  readinessImage: onap/oom/readiness:3.0.1
-  loggingRepository: docker.elastic.co
-  loggingImage: beats/filebeat:5.5.0
   k8scluster: svc.cluster.local
 #################################################################
 # Application configuration defaults.
 #################################################################
 # application image
-repository: nexus3.onap.org:10001
 image: "onap/sdnc-web-image:2.0.4"
 pullPolicy: Always
 
diff --git a/kubernetes/sdnc/components/ueb-listener/requirements.yaml b/kubernetes/sdnc/components/ueb-listener/requirements.yaml
index f994771..fbe5155 100644
--- a/kubernetes/sdnc/components/ueb-listener/requirements.yaml
+++ b/kubernetes/sdnc/components/ueb-listener/requirements.yaml
@@ -16,3 +16,6 @@
   - name: common
     version: ~6.x-0
     repository: '@local'
+  - name: repositoryGenerator
+    version: ~6.x-0
+    repository: '@local'
diff --git a/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml b/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml
index 63a1f8a..385fd9b 100644
--- a/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml
+++ b/kubernetes/sdnc/components/ueb-listener/templates/deployment.yaml
@@ -50,7 +50,7 @@
           name: config-input
         - mountPath: /config
           name: properties
-        image: "{{ .Values.global.envsubstImage }}"
+        image: {{ include "repositoryGenerator.image.envsubst" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-update-config
       - command:
@@ -70,14 +70,14 @@
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
       containers:
       - command:
         - /opt/onap/sdnc/ueb-listener/bin/start-ueb-listener.sh
         name: {{ include "common.name" . }}
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
         - name: PROPERTY_DIR
diff --git a/kubernetes/sdnc/components/ueb-listener/values.yaml b/kubernetes/sdnc/components/ueb-listener/values.yaml
index 2b0da14..6de8947 100644
--- a/kubernetes/sdnc/components/ueb-listener/values.yaml
+++ b/kubernetes/sdnc/components/ueb-listener/values.yaml
@@ -17,11 +17,6 @@
 #################################################################
 global:
   nodePortPrefix: 302
-  readinessImage: onap/oom/readiness:3.0.1
-  loggingRepository: docker.elastic.co
-  loggingImage: beats/filebeat:5.5.0
-    # envsusbt
-  envsubstImage: dibi/envsubst
   mariadbGalera:
     #This flag allows SO to instantiate its own mariadb-galera cluster
     #If shared instance is used, this chart assumes that DB already exists
@@ -60,7 +55,6 @@
 # Application configuration defaults.
 #################################################################
 # application image
-repository: nexus3.onap.org:10001
 image: onap/sdnc-ueb-listener-image:2.0.4
 pullPolicy: Always
 
diff --git a/kubernetes/sdnc/requirements.yaml b/kubernetes/sdnc/requirements.yaml
index fd57517..e201a02 100644
--- a/kubernetes/sdnc/requirements.yaml
+++ b/kubernetes/sdnc/requirements.yaml
@@ -60,6 +60,8 @@
     version: ~6.x-0
     repository: 'file://components/sdnc-web/'
     condition: sdnc.sdnc-web.enabled,sdnc-web.enabled
-
+  - name: repositoryGenerator
+    version: ~6.x-0
+    repository: '@local'
 
 
diff --git a/kubernetes/sdnc/templates/job.yaml b/kubernetes/sdnc/templates/job.yaml
index e0f0e55..897a0ba 100755
--- a/kubernetes/sdnc/templates/job.yaml
+++ b/kubernetes/sdnc/templates/job.yaml
@@ -76,7 +76,7 @@
           name: config-input
         - mountPath: /config
           name: properties
-        image: "{{ .Values.global.envsubstImage }}"
+        image: {{ include "repositoryGenerator.image.envsubst" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-update-config
 
@@ -92,11 +92,11 @@
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
       containers:
       - name: {{ include "common.name" . }}
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
           - name: MYSQL_ROOT_PASSWORD
diff --git a/kubernetes/sdnc/templates/sdnrdb-init-job.yaml b/kubernetes/sdnc/templates/sdnrdb-init-job.yaml
index 7975b70..cb8d757 100755
--- a/kubernetes/sdnc/templates/sdnrdb-init-job.yaml
+++ b/kubernetes/sdnc/templates/sdnrdb-init-job.yaml
@@ -26,7 +26,7 @@
       {{ include "common.certInitializer.initContainer" . | indent 6 }}
       {{ if .Values.global.aafEnabled }}
       - name: {{ include "common.name" . }}-chown
-        image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
+        image: {{ include "repositoryGenerator.image.busybox" . }}
         command: ["sh", "-c", "chown -R {{ .Values.config.odlUid }}:{{ .Values.config.odlGid}} {{ .Values.certInitializer.credsPath }}"]
         volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 10 }}
       {{ end }}
@@ -46,11 +46,11 @@
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
       containers:
       - name: {{ include "common.name" . }}-sdnrdb-init-job
-        image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         command: ["/bin/bash"]
         args: ["-c", "{{ .Values.config.binDir }}/startODL.sh"]
diff --git a/kubernetes/sdnc/templates/statefulset.yaml b/kubernetes/sdnc/templates/statefulset.yaml
index 98ad43e..4fa6b70 100644
--- a/kubernetes/sdnc/templates/statefulset.yaml
+++ b/kubernetes/sdnc/templates/statefulset.yaml
@@ -72,7 +72,7 @@
           name: config-input
         - mountPath: /config
           name: properties
-        image: "{{ .Values.global.envsubstImage }}"
+        image: {{ include "repositoryGenerator.image.envsubst" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-update-config
       {{ if .Values.dgbuilder.enabled -}}
@@ -93,7 +93,7 @@
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
+        image: {{ include "repositoryGenerator.image.readiness" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
         {{ end -}}
@@ -101,7 +101,7 @@
 
       {{ if .Values.global.cmpv2Enabled }}
       - name: certs-init
-        image: "{{ .Values.global.repository }}/{{ .Values.global.platform.certServiceClient.image }}"
+        image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.global.platform.certServiceClient.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
           - name: REQUEST_URL
@@ -142,7 +142,7 @@
       {{ end }}
 
       - name: {{ include "common.name" . }}-chown
-        image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
+        image: {{ include "repositoryGenerator.image.busybox" . }}
         command:
         - sh
         args:
@@ -157,7 +157,7 @@
             name: {{ include "common.fullname" . }}-data
       containers:
         - name: {{ include "common.name" . }}
-          image: "{{ include "common.repository" . }}/{{ .Values.image }}"
+          image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command: ["/bin/bash"]
           args: ["-c", "/opt/onap/sdnc/bin/startODL.sh"]
@@ -293,7 +293,7 @@
 
         # side car containers
         - name: filebeat-onap
-          image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
+          image: {{ include "repositoryGenerator.image.logging" . }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           volumeMounts:
           - mountPath: /usr/share/filebeat/filebeat.yml
diff --git a/kubernetes/sdnc/values.yaml b/kubernetes/sdnc/values.yaml
index af5a6f4..edac61b 100644
--- a/kubernetes/sdnc/values.yaml
+++ b/kubernetes/sdnc/values.yaml
@@ -19,15 +19,9 @@
 global:
   nodePortPrefix: 302
   nodePortPrefixExt: 304
-  repository: nexus3.onap.org:10001
-  readinessImage: onap/oom/readiness:3.0.1
-  loggingRepository: docker.elastic.co
-  loggingImage: beats/filebeat:5.5.0
   persistence:
     mountPath: /dockerdata-nfs
   aafEnabled: true
-  # envsusbt
-  envsubstImage: dibi/envsubst
   mariadbGalera:
     #This flag allows SO to instantiate its own mariadb-galera cluster
     #If shared instance is used, this chart assumes that DB already exists
@@ -134,11 +128,8 @@
 #################################################################
 # application images
 
-repository: nexus3.onap.org:10001
 pullPolicy: Always
 image: onap/sdnc-image:2.0.4
-busyboxRepository: docker.io
-busyboxImage: busybox:1.30
 
 # flag to enable debugging - application support required
 debugEnabled: false