diff --git a/charts/gitops-runtime/templates/_components/cap-app-proxy/_deployment.yaml b/charts/gitops-runtime/templates/_components/cap-app-proxy/_deployment.yaml index 617ac91a..6437c6c0 100644 --- a/charts/gitops-runtime/templates/_components/cap-app-proxy/_deployment.yaml +++ b/charts/gitops-runtime/templates/_components/cap-app-proxy/_deployment.yaml @@ -57,6 +57,8 @@ spec: ports: - name: http containerPort: 8080 + - name: http-metrics + containerPort: 9100 readinessProbe: initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.readinessProbe.periodSeconds }} diff --git a/charts/gitops-runtime/templates/_components/cap-app-proxy/_service.yaml b/charts/gitops-runtime/templates/_components/cap-app-proxy/_service.yaml index 63da1d24..151c90f9 100644 --- a/charts/gitops-runtime/templates/_components/cap-app-proxy/_service.yaml +++ b/charts/gitops-runtime/templates/_components/cap-app-proxy/_service.yaml @@ -12,6 +12,10 @@ spec: targetPort: http protocol: TCP name: http + - port: 9100 + targetPort: http-metrics + protocol: TCP + name: http-metrics selector: {{- include "cap-app-proxy.selectorLabels" . | nindent 4 }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/gitops-runtime/templates/_components/cap-app-proxy/_servicemonitor.yaml b/charts/gitops-runtime/templates/_components/cap-app-proxy/_servicemonitor.yaml new file mode 100644 index 00000000..e7b9f53b --- /dev/null +++ b/charts/gitops-runtime/templates/_components/cap-app-proxy/_servicemonitor.yaml @@ -0,0 +1,21 @@ +{{- define "cap-app-proxy.resources.serviceMonitor" }} + {{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ default (include "cap-app-proxy.fullname" .) .Values.serviceMonitor.name }} + labels: + {{- include "cap-app-proxy.labels" . | nindent 4 }} + {{- with .Values.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + matchLabels: + {{- include "cap-app-proxy.selectorLabels" . | nindent 6 }} + endpoints: + - port: http-metrics + interval: 30s + path: /metrics + {{- end }} +{{- end }} diff --git a/charts/gitops-runtime/templates/app-proxy/servicemonitor.yaml b/charts/gitops-runtime/templates/app-proxy/servicemonitor.yaml new file mode 100644 index 00000000..5af92333 --- /dev/null +++ b/charts/gitops-runtime/templates/app-proxy/servicemonitor.yaml @@ -0,0 +1,4 @@ +{{- $appProxyContext := deepCopy . }} +{{- $_ := set $appProxyContext "Values" (deepCopy (get .Values "app-proxy")) }} +{{- $_ := set $appProxyContext.Values "global" (deepCopy (get .Values "global")) }} +{{- include "cap-app-proxy.resources.serviceMonitor" $appProxyContext }} diff --git a/charts/gitops-runtime/values.yaml b/charts/gitops-runtime/values.yaml index 6af30479..42bf30de 100644 --- a/charts/gitops-runtime/values.yaml +++ b/charts/gitops-runtime/values.yaml @@ -592,6 +592,11 @@ app-proxy: annotations: {} name: "cap-app-proxy" + serviceMonitor: + enabled: false + name: '' + labels: {} + podAnnotations: {} podLabels: {}