From a7ab9ae1d004d966035ca9813dd012c42f575555 Mon Sep 17 00:00:00 2001 From: Alex Szakaly Date: Thu, 25 Nov 2021 18:18:17 +0100 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 | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 helm/install/templates/service.yaml diff --git a/helm/install/Chart.yaml b/helm/install/Chart.yaml index 988ce8d2..0c6fda02 100644 --- a/helm/install/Chart.yaml +++ b/helm/install/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: pgo description: Installer for PGO, the open source Postgres Operator from Crunchy Data type: application -version: 0.2.3 +version: 0.2.4 appVersion: 5.0.4 diff --git a/helm/install/templates/manager.yaml b/helm/install/templates/manager.yaml index 3ca42974..73d27b23 100644 --- a/helm/install/templates/manager.yaml +++ b/helm/install/templates/manager.yaml @@ -29,6 +29,9 @@ spec: - name: PGO_TARGET_NAMESPACE valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } } {{- end }} + ports: + - containerPort: 8080 + name: metrics securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true diff --git a/helm/install/templates/service.yaml b/helm/install/templates/service.yaml new file mode 100644 index 00000000..57aefd7b --- /dev/null +++ b/helm/install/templates/service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + {{- include "install.labels" . | nindent 4 }} + name: {{ .Chart.Name }} +spec: + ports: + - name: metrics + port: 9090 + protocol: TCP + targetPort: metrics + selector: + {{- include "install.crunchyLabels" . | nindent 5 }}