Skip to content

Commit 0a35053

Browse files
authored
chore(app-proxy): add ServiceMonitor configuration for metrics monitoring (#503)
* feat: add http-metrics port to cap-app-proxy service for monitoring * added missing port to deployment * feat(app-proxy): add ServiceMonitor configuration for metrics monitoring Add ServiceMonitor resource definition to enable monitoring of the app-proxy's http-metrics endpoint. This change allows for better observability and performance tracking of the service. * feat(app-proxy): update ServiceMonitor configuration to enable flag Change the ServiceMonitor configuration to use an 'enabled' flag instead of 'create'. This allows for better control over the monitoring setup in the app-proxy.
1 parent f0bd5f0 commit 0a35053

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

charts/gitops-runtime/templates/_components/cap-app-proxy/_deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ spec:
5757
ports:
5858
- name: http
5959
containerPort: 8080
60+
- name: http-metrics
61+
containerPort: 9100
6062
readinessProbe:
6163
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
6264
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}

charts/gitops-runtime/templates/_components/cap-app-proxy/_service.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ spec:
1212
targetPort: http
1313
protocol: TCP
1414
name: http
15+
- port: 9100
16+
targetPort: http-metrics
17+
protocol: TCP
18+
name: http-metrics
1519
selector:
1620
{{- include "cap-app-proxy.selectorLabels" . | nindent 4 }}
17-
{{- end }}
21+
{{- end }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- define "cap-app-proxy.resources.serviceMonitor" }}
2+
{{- if .Values.serviceMonitor.enabled }}
3+
apiVersion: monitoring.coreos.com/v1
4+
kind: ServiceMonitor
5+
metadata:
6+
name: {{ default (include "cap-app-proxy.fullname" .) .Values.serviceMonitor.name }}
7+
labels:
8+
{{- include "cap-app-proxy.labels" . | nindent 4 }}
9+
{{- with .Values.serviceMonitor.labels }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
spec:
13+
selector:
14+
matchLabels:
15+
{{- include "cap-app-proxy.selectorLabels" . | nindent 6 }}
16+
endpoints:
17+
- port: http-metrics
18+
interval: 30s
19+
path: /metrics
20+
{{- end }}
21+
{{- end }}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{- $appProxyContext := deepCopy . }}
2+
{{- $_ := set $appProxyContext "Values" (deepCopy (get .Values "app-proxy")) }}
3+
{{- $_ := set $appProxyContext.Values "global" (deepCopy (get .Values "global")) }}
4+
{{- include "cap-app-proxy.resources.serviceMonitor" $appProxyContext }}

charts/gitops-runtime/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,11 @@ app-proxy:
592592
annotations: {}
593593
name: "cap-app-proxy"
594594

595+
serviceMonitor:
596+
enabled: false
597+
name: ''
598+
labels: {}
599+
595600
podAnnotations: {}
596601

597602
podLabels: {}

0 commit comments

Comments
 (0)