[COMMON][ELASTIC] Uses new tpls for repos / images

This commit makes Elasticsearcg template to use the new generator for
repositories and images.

Issue-ID: OOM-2364
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
Change-Id: I20c18632234c864ef2a29e3cfb259c9838a8c4d6
diff --git a/kubernetes/common/elasticsearch/components/master/requirements.yaml b/kubernetes/common/elasticsearch/components/master/requirements.yaml
index a1f72ff..ba64f96 100644
--- a/kubernetes/common/elasticsearch/components/master/requirements.yaml
+++ b/kubernetes/common/elasticsearch/components/master/requirements.yaml
@@ -16,3 +16,6 @@
   - name: common
     version: ~6.x-0
     repository: 'file://../../../common'
+  - name: repositoryGenerator
+    version: ~6.x-0
+    repository: 'file://../../../repositoryGenerator'
diff --git a/kubernetes/common/elasticsearch/components/master/templates/statefulset.yaml b/kubernetes/common/elasticsearch/components/master/templates/statefulset.yaml
index 6744f75..a35b4bf 100644
--- a/kubernetes/common/elasticsearch/components/master/templates/statefulset.yaml
+++ b/kubernetes/common/elasticsearch/components/master/templates/statefulset.yaml
@@ -18,7 +18,7 @@
 kind: StatefulSet
 {{ $role := "master" -}}
 {{ $suffix := $role -}}
-{{ $labels := (dict "role" $role "discovery" (include "elasticsearch.clustername" .)) -}}
+{{ $labels := (dict "role" $role "discovery" .Values.cluster_name) -}}
 metadata: {{- include "common.resourceMetadata" (dict "suffix" $suffix "labels" $labels "dot" . )| nindent 2 }}
 spec:
   updateStrategy:
@@ -32,7 +32,8 @@
   template:
     metadata: {{- include "common.templateMetadata" (dict "labels" $labels "dot" .) | nindent 6 }}
     spec:
-{{- include "elasticsearch.imagePullSecrets" . | nindent 6 }}
+      imagePullSecrets:
+      - name: "{{ include "common.namespace" . }}-docker-registry-key"
       {{- if .Values.affinity }}
       affinity: {{- include "common.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }}
       {{- end }}
@@ -42,7 +43,6 @@
       {{- if .Values.tolerations }}
       tolerations: {{- include "common.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
       {{- end }}
-      serviceAccountName: {{ template "elasticsearch.serviceAccountName" . }}
       {{- if .Values.securityContext.enabled }}
       securityContext:
         fsGroup: {{ .Values.securityContext.fsGroup }}
@@ -52,7 +52,7 @@
         {{- if .Values.sysctlImage.enabled }}
         ## Image that performs the sysctl operation to modify Kernel settings (needed sometimes to avoid boot errors)
         - name: sysctl
-          image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
+          image: {{ include "repositoryGenerator.image.busybox" . }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command:
             - /bin/sh
@@ -67,7 +67,7 @@
         {{- end }}
         {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
         - name: volume-permissions
-          image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.global.busyboxImage | default .Values.busyboxImage }}
+          image: {{ include "repositoryGenerator.image.busybox" . }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command:
             - /bin/sh
@@ -86,7 +86,7 @@
       {{- end }}
       containers:
         - name: {{ include "common.name" . }}-master
-          image: {{ printf "%s/%s" (include "common.repository" .)  .Values.image }}
+          image: {{ printf "%s/%s" (include "repositoryGenerator.dockerHubRepository" .)  .Values.image }}
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           {{- if .Values.securityContext.enabled }}
           securityContext:
@@ -96,7 +96,7 @@
             - name: BITNAMI_DEBUG
               value: {{ ternary "true" "false" .Values.debug | quote }}
             - name: ELASTICSEARCH_CLUSTER_NAME
-              value: {{ include "elasticsearch.clustername" . }}
+              value: {{ .Values.cluster_name }}
             - name: ELASTICSEARCH_CLUSTER_HOSTS
               value: {{ include "common.name" . }}-discovery
             - name: ELASTICSEARCH_CLUSTER_MASTER_HOSTS
diff --git a/kubernetes/common/elasticsearch/components/master/values.yaml b/kubernetes/common/elasticsearch/components/master/values.yaml
index 4095bd3..3380449 100644
--- a/kubernetes/common/elasticsearch/components/master/values.yaml
+++ b/kubernetes/common/elasticsearch/components/master/values.yaml
@@ -22,10 +22,13 @@
     backup:
       mountPath: /dockerdata-nfs/backup
     storageClass:
-repositoryOverride: docker.io
+
 #################################################################
 # Application configuration defaults.
 #################################################################
+
+cluster_name: onap
+
 ## Init containers parameters:
 sysctlImage:
   enabled: true