Skip to content

Commit f252a6f

Browse files
committed
fix(metrics): make port configurable
1 parent 8298eb9 commit f252a6f

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

charts/cloudnative-pg/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ CloudNativePG Operator Helm Chart
4141
| dnsPolicy | string | `""` | |
4242
| fullnameOverride | string | `""` | |
4343
| hostNetwork | bool | `false` | |
44+
| metrics.port | int | `8080` | Port used by the controller to expose Prometheus metrics. Useful when running with hostNetwork=true to avoid conflicts. |
4445
| image.pullPolicy | string | `"IfNotPresent"` | |
4546
| image.repository | string | `"ghcr.io/cloudnative-pg/cloudnative-pg"` | |
4647
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |

charts/cloudnative-pg/templates/deployment.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ spec:
7575
{{- end }}
7676
{{- end }}
7777
- --webhook-port={{ .Values.webhook.port }}
78+
- "--metrics-bind-address=:{{ .Values.metrics.port }}"
7879
{{- range .Values.additionalArgs }}
7980
- {{ . }}
8081
{{- end }}
@@ -108,7 +109,7 @@ spec:
108109
{{- end }}
109110
name: manager
110111
ports:
111-
- containerPort: 8080
112+
- containerPort: {{ .Values.metrics.port }}
112113
name: metrics
113114
protocol: TCP
114115
- containerPort: {{ .Values.webhook.port }}

charts/cloudnative-pg/templates/service.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,8 @@ spec:
4040
- port: {{ .Values.service.port }}
4141
targetPort: webhook-server
4242
name: webhook-server
43+
- port: {{ .Values.metrics.port }}
44+
targetPort: metrics
45+
name: metrics
4346
selector:
4447
{{- include "cloudnative-pg.selectorLabels" . | nindent 4 }}

charts/cloudnative-pg/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ webhook:
6666
failureThreshold: 6
6767
periodSeconds: 5
6868

69+
# Metrics configuration for the operator
70+
metrics:
71+
# -- Port used by the controller to expose Prometheus metrics.
72+
# Useful when running with hostNetwork=true to avoid conflicts.
73+
port: 8080
74+
6975
# Operator configuration.
7076
config:
7177
# -- Specifies whether the secret should be created.

0 commit comments

Comments
 (0)