From 10a4d8bbe09662b0fb2babafddb2303d7dba5141 Mon Sep 17 00:00:00 2001 From: Alex Szakaly Date: Mon, 17 Oct 2022 18:04:32 +0200 Subject: [PATCH] Expose Prometheus Metrics Server with k8s Service To let us able to scrape metrics from the Operator e.g. with a ServiceMonitor we need to have a Service which provides named port close #61 Signed-off-by: Alex Szakaly --- helm/install/Chart.yaml | 2 +- helm/install/templates/manager.yaml | 3 +++ helm/install/templates/service.yaml | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 helm/install/templates/service.yaml diff --git a/helm/install/Chart.yaml b/helm/install/Chart.yaml index b672c660..d9ca583e 100644 --- a/helm/install/Chart.yaml +++ b/helm/install/Chart.yaml @@ -4,5 +4,5 @@ description: Installer for PGO, the open source Postgres Operator from Crunchy D type: application # The version below should match the version on the PostgresCluster CRD -version: 0.6.0 +version: 0.6.1 appVersion: 5.2.0 diff --git a/helm/install/templates/manager.yaml b/helm/install/templates/manager.yaml index c12a769d..7202c49d 100644 --- a/helm/install/templates/manager.yaml +++ b/helm/install/templates/manager.yaml @@ -40,6 +40,9 @@ spec: - name: CHECK_FOR_UPGRADES value: "false" {{- end }} + ports: + - containerPort: 8080 + name: metrics securityContext: allowPrivilegeEscalation: false capabilities: { drop: [ALL] } diff --git a/helm/install/templates/service.yaml b/helm/install/templates/service.yaml new file mode 100644 index 00000000..c917a3ff --- /dev/null +++ b/helm/install/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + {{- include "install.labels" . | nindent 4 }} + {{- include "install.clusterLabels" . | nindent 4 }} + name: {{ .Chart.Name }} +spec: + ports: + - name: metrics + port: 9090 + protocol: TCP + targetPort: metrics + selector: + {{- include "install.clusterLabels" . | nindent 4 }}