From 3e96d01494a3df0b5a4ce37091363ce5248c06f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de>
Date: Tue, 15 Nov 2022 19:25:08 +0100
Subject: [PATCH] Add optional NodePort for Prometheus

---
 helm/templates/prometheus/node-port.yaml | 16 ++++++++++++++++
 helm/values.yaml                         |  3 +++
 2 files changed, 19 insertions(+)
 create mode 100644 helm/templates/prometheus/node-port.yaml

diff --git a/helm/templates/prometheus/node-port.yaml b/helm/templates/prometheus/node-port.yaml
new file mode 100644
index 000000000..dc241d988
--- /dev/null
+++ b/helm/templates/prometheus/node-port.yaml
@@ -0,0 +1,16 @@
+{{- if and .Values.prometheus.enabled .Values.prometheus.nodePort.enabled -}}
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ template "theodolite.fullname" . }}-prometheus-nodeport
+spec:
+  type: NodePort
+  ports:
+  - name: web
+    nodePort: {{ .Values.prometheus.nodePort.nodePort }}
+    port: 9090
+    protocol: TCP
+    targetPort: 9090
+  selector:
+    app.kubernetes.io/name: prometheus
+{{- end}}
diff --git a/helm/values.yaml b/helm/values.yaml
index 6acebe187..78b425ff8 100644
--- a/helm/values.yaml
+++ b/helm/values.yaml
@@ -287,6 +287,9 @@ prometheus:
   enabled: true
   podMetadata: {}
   nodeSelector: {}
+  nodePort:
+    enabled: false
+    nodePort: 30900
   
   serviceAccount:
     enabled: true
-- 
GitLab