Add an ability to use existing configMap for Kustomize support

Change-Id: Id331042cf363d40ec3d8c0dfd0dfce90fe2dc0fb
diff --git a/omec/5g-control-plane/templates/configmap-nrf.yaml b/omec/5g-control-plane/templates/configmap-nrf.yaml
index da24f20..5841f22 100644
--- a/omec/5g-control-plane/templates/configmap-nrf.yaml
+++ b/omec/5g-control-plane/templates/configmap-nrf.yaml
@@ -6,6 +6,7 @@
 
 {{- if .Values.config.nrf.deploy }}
 
+{{- if not .Values.config.useExistingConfigMap -}}
 {{- $nrfcfg := index .Values.config.nrf.cfgFiles "nrfcfg.conf" }}
 {{- $config := index $nrfcfg "configuration" }}
 {{- $sbi := index $config "sbi" }}
@@ -29,6 +30,7 @@
 {{- if not (hasKey $sbi "port") -}}
 {{- $_ := .Values.config.nrf.sbi.port | set $sbi "port" -}}
 {{- end }}
+{{- end }}
 
 ---
 apiVersion: v1
@@ -40,8 +42,10 @@
 data:
   nrf-run.sh: |
 {{ tuple "bin/_nrf-run.sh.tpl" . | include "5g-control-plane.template" | indent 4 }}
+{{- if not .Values.config.useExistingConfigMap -}}
 {{- range $key, $value := .Values.config.nrf.cfgFiles }}
   {{ $key }}: |-
 {{ toYaml $value | indent 4 }}
 {{- end }}
 {{- end }}
+{{- end }}