AETHER-761 Add support of private image registry with auth enabled

Change-Id: I25e804570357c513bfd1822ab9d971c7ed1c5405
diff --git a/omec/omec-control-plane/Chart.yaml b/omec/omec-control-plane/Chart.yaml
index f678e2f..37548ae 100644
--- a/omec/omec-control-plane/Chart.yaml
+++ b/omec/omec-control-plane/Chart.yaml
@@ -10,4 +10,4 @@
 name: omec-control-plane
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 0.5.0
+version: 0.5.1
diff --git a/omec/omec-control-plane/templates/secret-registry.yaml b/omec/omec-control-plane/templates/secret-registry.yaml
new file mode 100644
index 0000000..1502049
--- /dev/null
+++ b/omec/omec-control-plane/templates/secret-registry.yaml
@@ -0,0 +1,18 @@
+{{/*
+# Copyright 2020-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+{{- if .Values.images.credentials }}
+---
+kind: Secret
+apiVersion: v1
+metadata:
+  name: {{ .Release.Name }}.registry
+  labels:
+    release: {{ .Release.Name }}
+type: kubernetes.io/dockerconfigjson
+data:
+  .dockerconfigjson: {{ printf `{"auths":{%s:{"auth":"%s"}}}` (.Values.images.credentials.registry | quote) (printf "%s:%s" .Values.images.credentials.username .Values.images.credentials.password | b64enc) | b64enc | quote }}
+{{- end }}
diff --git a/omec/omec-control-plane/templates/statefulset-hss.yaml b/omec/omec-control-plane/templates/statefulset-hss.yaml
index cedd809..7c4c4a6 100644
--- a/omec/omec-control-plane/templates/statefulset-hss.yaml
+++ b/omec/omec-control-plane/templates/statefulset-hss.yaml
@@ -37,6 +37,10 @@
         {{ .Values.nodeSelectors.hss.label }}: {{ .Values.nodeSelectors.hss.value }}
     {{- end }}
       serviceAccountName: hss
+    {{- if .Values.images.credentials }}
+      imagePullSecrets:
+        - name: {{ .Release.Name }}.registry
+    {{- end }}
       initContainers:
       - name: hss-bootstrap
         image: {{ .Values.images.tags.hssdb }}
diff --git a/omec/omec-control-plane/templates/statefulset-mme.yaml b/omec/omec-control-plane/templates/statefulset-mme.yaml
index 8dd2ea3..c0c180c 100644
--- a/omec/omec-control-plane/templates/statefulset-mme.yaml
+++ b/omec/omec-control-plane/templates/statefulset-mme.yaml
@@ -33,6 +33,10 @@
         {{ .Values.nodeSelectors.mme.label }}: {{ .Values.nodeSelectors.mme.value }}
     {{- end }}
       serviceAccountName: mme
+    {{- if .Values.images.credentials }}
+      imagePullSecrets:
+        - name: {{ .Release.Name }}.registry
+    {{- end }}
       initContainers:
       - name: mme-load-sctp-module
         image: {{ .Values.images.tags.init | quote }}
diff --git a/omec/omec-control-plane/templates/statefulset-spgwc.yaml b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
index 6269c3f..91fe84f 100644
--- a/omec/omec-control-plane/templates/statefulset-spgwc.yaml
+++ b/omec/omec-control-plane/templates/statefulset-spgwc.yaml
@@ -33,6 +33,10 @@
         {{ .Values.nodeSelectors.spgwc.label }}: {{ .Values.nodeSelectors.spgwc.value }}
     {{- end }}
       serviceAccountName: spgwc
+    {{- if .Values.images.credentials }}
+      imagePullSecrets:
+        - name: {{ .Release.Name }}.registry
+    {{- end }}
     {{- if .Values.config.coreDump.enabled }}
       initContainers:
 {{ tuple "spgwc" . | include "omec-control-plane.coredump_init" | indent 6 }}
diff --git a/omec/omec-control-plane/values.yaml b/omec/omec-control-plane/values.yaml
index c8ef894..13b0a33 100644
--- a/omec/omec-control-plane/values.yaml
+++ b/omec/omec-control-plane/values.yaml
@@ -13,6 +13,11 @@
     spgwc: docker.io/omecproject/spgw:master-latest
     depCheck: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
   pullPolicy: IfNotPresent
+  credentials: {}
+  # If specified, use this credential to access the image
+  #   registry:
+  #   username:
+  #   password:
 
 nodeSelectors:
   enabled: false