diff --git a/charts/selenium-grid/templates/monitoring-exporter-deployment.yaml b/charts/selenium-grid/templates/monitoring-exporter-deployment.yaml index 94a7e61b3..af4472d3a 100644 --- a/charts/selenium-grid/templates/monitoring-exporter-deployment.yaml +++ b/charts/selenium-grid/templates/monitoring-exporter-deployment.yaml @@ -31,7 +31,8 @@ spec: {{- $imageRegistry := default .Values.global.seleniumGrid.imageRegistry .Values.monitoring.exporter.imageRegistry }} image: {{ printf "%s/%s:%s" $imageRegistry .Values.monitoring.exporter.imageName .Values.monitoring.exporter.imageTag | quote }} ports: - - containerPort: {{ .Values.monitoring.exporter.port }} + - name: metrics + containerPort: {{ .Values.monitoring.exporter.port }} {{- with .Values.monitoring.exporter.tolerations }} tolerations: {{ toYaml . | nindent 6 }} {{- end }} diff --git a/charts/selenium-grid/templates/monitoring-exporter-service.yaml b/charts/selenium-grid/templates/monitoring-exporter-service.yaml index c2f98b4c8..285958927 100644 --- a/charts/selenium-grid/templates/monitoring-exporter-service.yaml +++ b/charts/selenium-grid/templates/monitoring-exporter-service.yaml @@ -26,7 +26,7 @@ spec: - name: http-port protocol: TCP port: {{ .Values.monitoring.exporter.port }} - targetPort: {{ .Values.monitoring.exporter.port }} + targetPort: metrics {{- if and (eq .Values.monitoring.exporter.service.type "NodePort") .Values.monitoring.exporter.service.nodePort }} nodePort: {{ .Values.monitoring.exporter.service.nodePort }} {{- end }} diff --git a/charts/selenium-grid/templates/monitoring-pod-monitor.yaml b/charts/selenium-grid/templates/monitoring-pod-monitor.yaml new file mode 100644 index 000000000..2cb71e321 --- /dev/null +++ b/charts/selenium-grid/templates/monitoring-pod-monitor.yaml @@ -0,0 +1,33 @@ +{{- if and (eq (include "seleniumGrid.monitoring.enabled" $) "true") .Values.monitoring.podMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: {{ template "seleniumGrid.monitoring.exporter.fullname" $ }} + namespace: {{ .Values.monitoring.podMonitor.namespace | default .Release.Namespace }} + {{- with .Values.monitoring.podMonitor.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "seleniumGrid.commonLabels" $ | nindent 4 }} + {{- with .Values.monitoring.podMonitor.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ template "seleniumGrid.monitoring.exporter.fullname" $ }} + podMetricsEndpoints: + - port: metrics + path: {{ .Values.monitoring.podMonitor.path }} + interval: {{ .Values.monitoring.podMonitor.interval }} + scrapeTimeout: {{ .Values.monitoring.podMonitor.scrapeTimeout }} + {{- with .Values.monitoring.podMonitor.relabelings }} + relabelings: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.monitoring.podMonitor.metricRelabelings }} + metricRelabelings: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/selenium-grid/templates/monitoring-service-monitor.yaml b/charts/selenium-grid/templates/monitoring-service-monitor.yaml new file mode 100644 index 000000000..47b19c609 --- /dev/null +++ b/charts/selenium-grid/templates/monitoring-service-monitor.yaml @@ -0,0 +1,33 @@ +{{- if and (eq (include "seleniumGrid.monitoring.enabled" $) "true") .Values.monitoring.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "seleniumGrid.monitoring.exporter.fullname" $ }} + namespace: {{ .Values.monitoring.serviceMonitor.namespace | default .Release.Namespace }} + {{- with .Values.monitoring.serviceMonitor.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "seleniumGrid.commonLabels" $ | nindent 4 }} + {{- with .Values.monitoring.serviceMonitor.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + selector: + matchLabels: + app.kubernetes.io/name: {{ template "seleniumGrid.monitoring.exporter.fullname" $ }} + endpoints: + - port: http-port + path: {{ .Values.monitoring.serviceMonitor.path }} + interval: {{ .Values.monitoring.serviceMonitor.interval }} + scrapeTimeout: {{ .Values.monitoring.serviceMonitor.scrapeTimeout }} + {{- with .Values.monitoring.serviceMonitor.relabelings }} + relabelings: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.monitoring.serviceMonitor.metricRelabelings }} + metricRelabelings: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end }} diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index 2094ca3c4..2aa13b895 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -1041,6 +1041,46 @@ monitoring: key: "" value: "" annotations: {} + # -- ServiceMonitor configuration for Prometheus Operator + serviceMonitor: + # -- Enable ServiceMonitor resource + enabled: false + # -- Namespace to deploy the ServiceMonitor into (defaults to release namespace) + namespace: "" + # -- Additional labels for the ServiceMonitor + labels: {} + # -- Additional annotations for the ServiceMonitor + annotations: {} + # -- Metrics scrape path + path: /metrics + # -- Scrape interval + interval: 30s + # -- Scrape timeout + scrapeTimeout: 10s + # -- RelabelConfigs to apply to samples before scraping + relabelings: [] + # -- MetricRelabelConfigs to apply to samples before ingestion + metricRelabelings: [] + # -- PodMonitor configuration for Prometheus Operator (alternative to ServiceMonitor) + podMonitor: + # -- Enable PodMonitor resource + enabled: false + # -- Namespace to deploy the PodMonitor into (defaults to release namespace) + namespace: "" + # -- Additional labels for the PodMonitor + labels: {} + # -- Additional annotations for the PodMonitor + annotations: {} + # -- Metrics scrape path + path: /metrics + # -- Scrape interval + interval: 30s + # -- Scrape timeout + scrapeTimeout: 10s + # -- RelabelConfigs to apply to samples before scraping + relabelings: [] + # -- MetricRelabelConfigs to apply to samples before ingestion + metricRelabelings: [] # Keda scaled object configuration autoscaling: