feat: Dedicated metrics service with basic customization options

Signed-off-by: Marco Maurer <mkilchhofer@users.noreply.github.com>
pull/3155/head
Marco Maurer 2025-02-04 09:55:10 +01:00
parent 08fe826afd
commit 2ff4f3e51b
No known key found for this signature in database
4 changed files with 59 additions and 4 deletions

View File

@ -1650,6 +1650,13 @@ To read more about this component, please read [Argo CD Manifest Hydrator] and [
| commitServer.livenessProbe.initialDelaySeconds | int | `30` | Number of seconds after the container has started before [probe] is initiated |
| commitServer.livenessProbe.periodSeconds | int | `30` | How often (in seconds) to perform the [probe] |
| commitServer.livenessProbe.timeoutSeconds | int | `5` | Number of seconds after which the [probe] times out |
| commitServer.metrics.enabled | bool | `false` | Enables prometheus metrics server |
| commitServer.metrics.service.annotations | object | `{}` | Metrics service annotations |
| commitServer.metrics.service.clusterIP | string | `""` | Metrics service clusterIP. `None` makes a "headless service" (no virtual IP) |
| commitServer.metrics.service.labels | object | `{}` | Metrics service labels |
| commitServer.metrics.service.portName | string | `"metrics"` | Metrics service port name |
| commitServer.metrics.service.servicePort | int | `8087` | Metrics service port |
| commitServer.metrics.service.type | string | `"ClusterIP"` | Metrics service type |
| commitServer.name | string | `"commit-server"` | Commit server name |
| commitServer.nodeSelector | object | `{}` (defaults to global.nodeSelector) | [Node selector] |
| commitServer.podAnnotations | object | `{}` | Annotations for the commit server pods |

View File

@ -0,0 +1,35 @@
{{- if and .Values.commitServer.enabled .Values.commitServer.metrics.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "argo-cd.commitServer.fullname" . }}-metrics
namespace: {{ include "argo-cd.namespace" . }}
labels:
{{- include "argo-cd.labels" (dict "context" . "component" .Values.commitServer.name "name" "metrics") | nindent 4 }}
{{- with .Values.commitServer.metrics.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if or .Values.commitServer.metrics.service.annotations .Values.global.addPrometheusAnnotations }}
annotations:
{{- if .Values.global.addPrometheusAnnotations }}
prometheus.io/port: {{ .Values.commitServer.metrics.service.servicePort | quote }}
prometheus.io/scrape: "true"
{{- end }}
{{- range $key, $value := .Values.commitServer.metrics.service.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.commitServer.metrics.service.type }}
{{- if and .Values.commitServer.metrics.service.clusterIP (eq .Values.commitServer.metrics.service.type "ClusterIP") }}
clusterIP: {{ .Values.commitServer.metrics.service.clusterIP }}
{{- end }}
{{- include "argo-cd.dualStack" . | indent 2 }}
ports:
- name: {{ .Values.commitServer.metrics.service.portName }}
protocol: TCP
port: {{ .Values.commitServer.metrics.service.servicePort }}
targetPort: 8087
selector:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.commitServer.name) | nindent 4 }}
{{- end }}

View File

@ -21,10 +21,6 @@ spec:
protocol: TCP
port: 8086
targetPort: 8086
- name: metrics
protocol: TCP
port: 8087
targetPort: 8087
selector:
{{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.commitServer.name) | nindent 4 }}
{{- end }}

View File

@ -3796,6 +3796,23 @@ commitServer:
# -- List of extra volumes to add
extraVolumes: []
metrics:
# -- Enables prometheus metrics server
enabled: false
service:
# -- Metrics service type
type: ClusterIP
# -- Metrics service clusterIP. `None` makes a "headless service" (no virtual IP)
clusterIP: ""
# -- Metrics service annotations
annotations: {}
# -- Metrics service labels
labels: {}
# -- Metrics service port
servicePort: 8087
# -- Metrics service port name
portName: metrics
## commit server service configuration
service:
# -- commit server service annotations