kafka and metricfunc deploy config

Change-Id: I61d14229ad67522d953c0ce5d1dd19b15d5ef9d6
diff --git a/Makefile b/Makefile
index 85e7d93..fe90d34 100644
--- a/Makefile
+++ b/Makefile
@@ -533,6 +533,11 @@
 	kubectl create namespace cattle-dashboards || true
 	kubectl apply -k resources/4g-monitoring
 
+monitoring-5g: $(M)/monitoring
+	kubectl create namespace omec || true
+	kubectl create namespace cattle-dashboards || true
+	kubectl apply -k resources/5g-monitoring
+
 enodebd:
 	helm upgrade --install --wait $(HELM_GLOBAL_ARGS) \
 		--namespace=aether-apps \
diff --git a/resources/5g-monitoring/aiab5g-dashboard.json b/resources/5g-monitoring/aiab5g-dashboard.json
new file mode 100644
index 0000000..dbec4ba
--- /dev/null
+++ b/resources/5g-monitoring/aiab5g-dashboard.json
@@ -0,0 +1,542 @@
+{
+  "annotations": {
+    "list": [
+      {
+        "builtIn": 1,
+        "datasource": {
+          "type": "grafana",
+          "uid": "-- Grafana --"
+        },
+        "enable": true,
+        "hide": true,
+        "iconColor": "rgba(0, 211, 255, 1)",
+        "name": "Annotations & Alerts",
+        "target": {
+          "limit": 100,
+          "matchAny": false,
+          "tags": [],
+          "type": "dashboard"
+        },
+        "type": "dashboard"
+      }
+    ]
+  },
+  "editable": true,
+  "gnetId": null,
+  "graphTooltip": 0,
+  "id": 36,
+  "links": [],
+  "panels": [
+    {
+      "datasource": null,
+      "description": "",
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "mappings": [],
+          "max": 100,
+          "min": 0,
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "super-light-blue",
+                "value": null
+              }
+            ]
+          }
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 3,
+        "x": 0,
+        "y": 0
+      },
+      "id": 4,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "area",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "text": {},
+        "textMode": "auto"
+      },
+      "pluginVersion": "7.5.11",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "w5yLd7d4z"
+          },
+          "editorMode": "builder",
+          "exemplar": true,
+          "expr": "smf_pdu_sessions",
+          "hide": false,
+          "interval": "",
+          "legendFormat": "",
+          "range": true,
+          "refId": "A"
+        }
+      ],
+      "title": "5G Active PDU Sessions",
+      "type": "stat"
+    },
+    {
+      "datasource": null,
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "mappings": [
+            {
+              "from": "",
+              "id": 1,
+              "text": "Down",
+              "to": "",
+              "type": 1,
+              "value": "0"
+            },
+            {
+              "from": "",
+              "id": 2,
+              "text": "Up",
+              "to": "",
+              "type": 1,
+              "value": "1"
+            }
+          ],
+          "max": 1,
+          "min": 0,
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "red",
+                "value": null
+              },
+              {
+                "color": "green",
+                "value": 1
+              }
+            ]
+          }
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 3,
+        "x": 3,
+        "y": 0
+      },
+      "id": 2,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "none",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "text": {},
+        "textMode": "value_and_name"
+      },
+      "pluginVersion": "7.5.11",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "w5yLd7d4z"
+          },
+          "editorMode": "builder",
+          "exemplar": true,
+          "expr": "nf_status{nfType=\"UPF\"}",
+          "hide": false,
+          "interval": "",
+          "legendFormat": "{{ Nfname }}",
+          "range": true,
+          "refId": "A"
+        }
+      ],
+      "title": "UPF Status",
+      "type": "stat"
+    },
+    {
+      "datasource": null,
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "mappings": [
+            {
+              "from": "",
+              "id": 1,
+              "text": "Down",
+              "to": "",
+              "type": 1,
+              "value": "0"
+            },
+            {
+              "from": "",
+              "id": 2,
+              "text": "Up",
+              "to": "",
+              "type": 1,
+              "value": "1"
+            }
+          ],
+          "max": 1,
+          "min": 0,
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "red",
+                "value": null
+              },
+              {
+                "color": "green",
+                "value": 1
+              }
+            ]
+          },
+          "unit": "short"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 3,
+        "x": 6,
+        "y": 0
+      },
+      "id": 8,
+      "options": {
+        "colorMode": "value",
+        "graphMode": "none",
+        "justifyMode": "auto",
+        "orientation": "auto",
+        "reduceOptions": {
+          "calcs": [
+            "lastNotNull"
+          ],
+          "fields": "",
+          "values": false
+        },
+        "text": {},
+        "textMode": "value_and_name"
+      },
+      "pluginVersion": "7.5.11",
+      "targets": [
+        {
+          "exemplar": true,
+          "expr": "nf_status{nfType=\"GNB\"}",
+          "hide": false,
+          "interval": "",
+          "legendFormat": "{{ Nfname }}",
+          "refId": "A"
+        }
+      ],
+      "title": "gNodeB Status",
+      "type": "stat"
+    },
+    {
+      "datasource": null,
+      "description": "",
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "thresholds"
+          },
+          "custom": {
+            "align": "center",
+            "filterable": false
+          },
+          "decimals": 0,
+          "mappings": [
+            {
+              "from": "",
+              "id": 1,
+              "text": "Down",
+              "to": "",
+              "type": 1,
+              "value": "0"
+            },
+            {
+              "from": "",
+              "id": 2,
+              "text": "Connected",
+              "to": "",
+              "type": 1,
+              "value": "1"
+            }
+          ],
+          "max": 1,
+          "min": 0,
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": null
+              },
+              {
+                "color": "red",
+                "value": 80
+              }
+            ]
+          },
+          "unit": "short"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 15,
+        "x": 9,
+        "y": 0
+      },
+      "id": 6,
+      "options": {
+        "showHeader": true
+      },
+      "pluginVersion": "7.5.11",
+      "targets": [
+        {
+          "datasource": {
+            "type": "prometheus",
+            "uid": "w5yLd7d4z"
+          },
+          "editorMode": "builder",
+          "exemplar": true,
+          "expr": "sum(core_subscriber{state=\"Connected\"}) by (imsi, slice)",
+          "format": "table",
+          "hide": false,
+          "instant": true,
+          "interval": "",
+          "legendFormat": "",
+          "range": true,
+          "refId": "A"
+        }
+      ],
+      "timeFrom": null,
+      "timeShift": null,
+      "title": "5G Core Subscribers",
+      "transformations": [
+        {
+          "id": "organize",
+          "options": {
+            "excludeByName": {
+              "Time": true
+            },
+            "indexByName": {},
+            "renameByName": {
+              "Value": "Status",
+              "imsi": "IMSI",
+              "slice": "Slice"
+            }
+          }
+        }
+      ],
+      "type": "table"
+    },
+    {
+      "datasource": null,
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "axisLabel": "",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "drawStyle": "line",
+            "fillOpacity": 10,
+            "gradientMode": "none",
+            "hideFrom": {
+              "graph": false,
+              "legend": false,
+              "tooltip": false
+            },
+            "lineInterpolation": "linear",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "never",
+            "spanNulls": true
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": null
+              },
+              {
+                "color": "red",
+                "value": 80
+              }
+            ]
+          },
+          "unit": "short"
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 12,
+        "x": 0,
+        "y": 8
+      },
+      "id": 12,
+      "options": {
+        "graph": {},
+        "legend": {
+          "calcs": [],
+          "displayMode": "list",
+          "placement": "bottom"
+        },
+        "tooltipOptions": {
+          "mode": "single"
+        }
+      },
+      "pluginVersion": "7.5.11",
+      "targets": [
+        {
+          "exemplar": true,
+          "expr": "sum(8 * irate(upf_bytes_count{dir=\"tx\",iface=\"Core\"}[2m]))",
+          "interval": "",
+          "legendFormat": "Upstream Bitrate",
+          "refId": "A"
+        },
+        {
+          "exemplar": true,
+          "expr": "sum(8 * irate(upf_bytes_count{dir=\"tx\",iface=\"Access\"}[2m]))",
+          "hide": false,
+          "interval": "",
+          "legendFormat": "Downstream Bitrate",
+          "refId": "B"
+        }
+      ],
+      "timeFrom": null,
+      "timeShift": null,
+      "title": "UPF Throughput",
+      "type": "timeseries"
+    },
+    {
+      "datasource": null,
+      "fieldConfig": {
+        "defaults": {
+          "color": {
+            "mode": "palette-classic"
+          },
+          "custom": {
+            "axisLabel": "",
+            "axisPlacement": "auto",
+            "barAlignment": 0,
+            "drawStyle": "line",
+            "fillOpacity": 10,
+            "gradientMode": "none",
+            "hideFrom": {
+              "graph": false,
+              "legend": false,
+              "tooltip": false
+            },
+            "lineInterpolation": "linear",
+            "lineWidth": 1,
+            "pointSize": 5,
+            "scaleDistribution": {
+              "type": "linear"
+            },
+            "showPoints": "never",
+            "spanNulls": true
+          },
+          "mappings": [],
+          "thresholds": {
+            "mode": "absolute",
+            "steps": [
+              {
+                "color": "green",
+                "value": null
+              },
+              {
+                "color": "red",
+                "value": 80
+              }
+            ]
+          }
+        },
+        "overrides": []
+      },
+      "gridPos": {
+        "h": 8,
+        "w": 12,
+        "x": 12,
+        "y": 8
+      },
+      "id": 10,
+      "options": {
+        "graph": {},
+        "legend": {
+          "calcs": [],
+          "displayMode": "list",
+          "placement": "bottom"
+        },
+        "tooltipOptions": {
+          "mode": "single"
+        }
+      },
+      "pluginVersion": "7.5.11",
+      "targets": [
+        {
+          "exemplar": true,
+          "expr": "sum(smf_svc_stats) by (msgtype)",
+          "interval": "",
+          "legendFormat": "{{ msgtype }}",
+          "refId": "A"
+        }
+      ],
+      "timeFrom": null,
+      "timeShift": null,
+      "title": "SMF Messages",
+      "type": "timeseries"
+    }
+  ],
+  "refresh": "5s",
+  "schemaVersion": 27,
+  "style": "dark",
+  "tags": [],
+  "templating": {
+    "list": []
+  },
+  "time": {
+    "from": "now-3h",
+    "to": "now"
+  },
+  "timepicker": {},
+  "timezone": "",
+  "title": "AIAB_5g Copy",
+  "uid": "XpijtYd4z",
+  "version": 8
+}
diff --git a/resources/5g-monitoring/aiab5g-dashboard.json.license b/resources/5g-monitoring/aiab5g-dashboard.json.license
new file mode 100644
index 0000000..ec9f746
--- /dev/null
+++ b/resources/5g-monitoring/aiab5g-dashboard.json.license
@@ -0,0 +1,3 @@
+SPDX-FileCopyrightText: 2022-present Intel Corporation
+
+SPDX-License-Identifier: Apache-2.0
diff --git a/resources/5g-monitoring/kustomization.yaml b/resources/5g-monitoring/kustomization.yaml
new file mode 100644
index 0000000..99138fe
--- /dev/null
+++ b/resources/5g-monitoring/kustomization.yaml
@@ -0,0 +1,16 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# 
+# SPDX-License-Identifier: Apache-2.0
+
+resources:
+  - ./metricfunc-monitor.yaml
+  - ./upf-monitor.yaml
+
+configMapGenerator:
+  - name: grafana-ops-dashboards
+    namespace: cattle-dashboards
+    files:
+      - ./aiab5g-dashboard.json
+    options:
+      labels:
+        grafana_dashboard: "1"
diff --git a/resources/5g-monitoring/metricfunc-monitor.yaml b/resources/5g-monitoring/metricfunc-monitor.yaml
new file mode 100644
index 0000000..36fcdb9
--- /dev/null
+++ b/resources/5g-monitoring/metricfunc-monitor.yaml
@@ -0,0 +1,19 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# 
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+  name: metricfunc
+  namespace: omec
+spec:
+  endpoints:
+    - path: /metrics
+      port: prometheus-exporter
+  namespaceSelector:
+    matchNames:
+      - omec
+  selector:
+    matchLabels:
+      app: metricfunc
diff --git a/resources/5g-monitoring/upf-monitor.yaml b/resources/5g-monitoring/upf-monitor.yaml
new file mode 100644
index 0000000..9669ad9
--- /dev/null
+++ b/resources/5g-monitoring/upf-monitor.yaml
@@ -0,0 +1,19 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# 
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+  name: upf
+  namespace: omec
+spec:
+  endpoints:
+    - path: /metrics
+      port: prometheus-exporter
+  namespaceSelector:
+    matchNames:
+      - omec
+  selector:
+    matchLabels:
+      app: upf
diff --git a/sd-core-5g-values.yaml b/sd-core-5g-values.yaml
index 58232ad..d00abff 100644
--- a/sd-core-5g-values.yaml
+++ b/sd-core-5g-values.yaml
@@ -17,6 +17,9 @@
     #  amf: # add new image name
     # refer above helm chart to add other NF images
 
+  kafka:
+    deploy: false
+
   mongodb:
     usePassword: false
     persistence:
@@ -44,6 +47,9 @@
       deploy: false # if enabled then deploy upf adapter pod. Once backend code is stable,
                     # this option will be enabled by default
 
+    metricfunc:
+      deploy: false
+
     # Change AMF config here if rquired Most of the AMF config comes from Slice APIs
     # but some of the config is directly provided  thorugh helm chart
     amf: