From 4374bce0335dc1108b3452415c3be07217677ff7 Mon Sep 17 00:00:00 2001 From: Alex Szakaly Date: Fri, 19 Nov 2021 13:54:21 +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 c5679457..75832221 100644 --- a/helm/install/Chart.yaml +++ b/helm/install/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: pgo description: A Helm chart for Kubernetes type: application -version: 0.2.2 +version: 0.2.3 appVersion: 5.0.3 diff --git a/helm/install/templates/manager.yaml b/helm/install/templates/manager.yaml index 7ca8e4cc..8cddda8d 100644 --- a/helm/install/templates/manager.yaml +++ b/helm/install/templates/manager.yaml @@ -31,6 +31,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 }}