AETHER-2075 [5g-control-plane] Fix monitoring target down alerts

Removed Prometheus service monitor annotation and ports for unimplemented NFs.
Also, refactored Service template.

Change-Id: I105e4ae05baf4f819c881c7e1c6b74064b0a7d6b
diff --git a/omec/5g-control-plane/templates/service-amf.yaml b/omec/5g-control-plane/templates/service-amf.yaml
index 6900dba..d02f57f 100644
--- a/omec/5g-control-plane/templates/service-amf.yaml
+++ b/omec/5g-control-plane/templates/service-amf.yaml
@@ -13,29 +13,7 @@
   labels:
 {{ tuple "amf" . | include "5g-control-plane.metadata_labels" | indent 4 }}
 spec:
-  type: ClusterIP
-  selector:
-{{ tuple "amf" . | include "5g-control-plane.metadata_labels" | indent 4 }}
-  ports:
-  - name: prometheus-exporter
-    port: {{ .Values.config.amf.prometheus.port }}
-    protocol: TCP
-  - name: sbi
-    port: {{ .Values.config.amf.sbi.port }}
-    protocol: TCP
-  - name: ngapp
-    port: {{ .Values.config.amf.ngapp.port }}
-    protocol: SCTP
-{{- if or .Values.config.amf.prometheus.nodePort.enabled .Values.config.amf.sbi.nodePort.enabled .Values.config.amf.ngapp.nodePort.enabled }}
----
-apiVersion: v1
-kind: Service
-metadata:
-  name: amf-external
-  labels:
-{{ tuple "amf" . | include "5g-control-plane.metadata_labels" | indent 4 }}
-spec:
-  type: NodePort
+  type: {{ .Values.config.amf.serviceType }}
 {{- if .Values.config.amf.ngapp.externalIp }}
   externalIPs:
     - {{ .Values.config.amf.ngapp.externalIp }}
@@ -43,23 +21,28 @@
   selector:
 {{ tuple "amf" . | include "5g-control-plane.metadata_labels" | indent 4 }}
   ports:
-{{- if .Values.config.amf.prometheus.nodePort.enabled }}
   - name: prometheus-exporter
     port: {{ .Values.config.amf.prometheus.port }}
     protocol: TCP
-    nodePort: {{ .Values.config.amf.prometheus.nodePort.port }}
+{{- if eq .Values.config.amf.serviceType "NodePort" }}
+{{- if .Values.config.amf.prometheus.nodePort }}
+    nodePort: {{ .Values.config.amf.prometheus.nodePort }}
 {{- end }}
-{{- if .Values.config.amf.sbi.nodePort.enabled }}
+{{- end }}
   - name: sbi
     port: {{ .Values.config.amf.sbi.port }}
     protocol: TCP
-    nodePort: {{ .Values.config.amf.sbi.nodePort.port }}
+{{- if eq .Values.config.amf.serviceType "NodePort" }}
+{{- if .Values.config.amf.sbi.nodePort }}
+    nodePort: {{ .Values.config.amf.sbi.nodePort }}
 {{- end }}
-{{- if .Values.config.amf.ngapp.nodePort.enabled }}
+{{- end }}
   - name: ngapp
     port: {{ .Values.config.amf.ngapp.port }}
     protocol: SCTP
-    nodePort: {{ .Values.config.amf.ngapp.nodePort.port }}
+{{- if eq .Values.config.amf.serviceType "NodePort" }}
+{{- if .Values.config.amf.ngapp.nodePort }}
+    nodePort: {{ .Values.config.amf.ngapp.nodePort }}
 {{- end }}
 {{- end }}
 {{- end }}