Skip to content

Commit

Permalink
Expose Prometheus Metrics Server with k8s Service
Browse files Browse the repository at this point in the history
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 CrunchyData#61

Signed-off-by: Alex Szakaly <alex.szakaly@gmail.com>
  • Loading branch information
alex1989hu committed Dec 7, 2021
1 parent 24f5849 commit b1afa50
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helm/install/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions helm/install/templates/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions helm/install/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit b1afa50

Please sign in to comment.