feat(argo-workflows): check prometheus CRD for ServiceMonitor (#2430)

* chore: Apply changes from code review

Signed-off-by: Marco Maurer <mkilchhofer@users.noreply.github.com>

---------

Signed-off-by: cmontemuino <1761056+cmontemuino@users.noreply.github.com>
Signed-off-by: Marco Maurer <mkilchhofer@users.noreply.github.com>
Co-authored-by: Jason Meridth <jmeridth@gmail.com>
Co-authored-by: Marco Maurer <mkilchhofer@users.noreply.github.com>
This commit is contained in:
Carlos M 2024-03-24 21:26:55 +01:00 committed by GitHub
parent 19b3d72718
commit a28780fb19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 19 additions and 4 deletions

View file

@ -3,7 +3,7 @@ appVersion: v3.5.5
name: argo-workflows name: argo-workflows
description: A Helm chart for Argo Workflows description: A Helm chart for Argo Workflows
type: application type: application
version: 0.40.14 version: 0.41.0
icon: https://argo-workflows.readthedocs.io/en/stable/assets/logo.png icon: https://argo-workflows.readthedocs.io/en/stable/assets/logo.png
home: https://github.com/argoproj/argo-helm home: https://github.com/argoproj/argo-helm
sources: sources:
@ -17,4 +17,4 @@ annotations:
url: https://argoproj.github.io/argo-helm/pgp_keys.asc url: https://argoproj.github.io/argo-helm/pgp_keys.asc
artifacthub.io/changes: | artifacthub.io/changes: |
- kind: added - kind: added
description: Support namespaceOverride description: Check Prometheus CRDs are available before creating Service Monitor resource(s)

View file

@ -111,6 +111,7 @@ Fields to note:
|-----|------|---------|-------------| |-----|------|---------|-------------|
| apiVersionOverrides.autoscaling | string | `""` | String to override apiVersion of autoscaling rendered by this helm chart | | apiVersionOverrides.autoscaling | string | `""` | String to override apiVersion of autoscaling rendered by this helm chart |
| apiVersionOverrides.cloudgoogle | string | `""` | String to override apiVersion of GKE resources rendered by this helm chart | | apiVersionOverrides.cloudgoogle | string | `""` | String to override apiVersion of GKE resources rendered by this helm chart |
| apiVersionOverrides.monitoring | string | `""` | String to override apiVersion of monitoring CRDs (ServiceMonitor) rendered by this helm chart |
| commonLabels | object | `{}` | Labels to set on all resources | | commonLabels | object | `{}` | Labels to set on all resources |
| crds.annotations | object | `{}` | Annotations to be added to all CRDs | | crds.annotations | object | `{}` | Annotations to be added to all CRDs |
| crds.install | bool | `true` | Install and upgrade CRDs | | crds.install | bool | `true` | Install and upgrade CRDs |

View file

@ -190,6 +190,17 @@ Return the appropriate apiVersion for GKE resources
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/*
Return the appropriate apiVersion for monitoring CRDs
*/}}
{{- define "argo-workflows.apiVersions.monitoring" -}}
{{- if .Values.apiVersionOverrides.monitoring -}}
{{- print .Values.apiVersionOverrides.monitoring -}}
{{- else -}}
{{- print "monitoring.coreos.com/v1" -}}
{{- end -}}
{{- end -}}
{{/* {{/*
Expand the namespace of the release. Expand the namespace of the release.
Allows overriding it for multi-namespace deployments in combined charts. Allows overriding it for multi-namespace deployments in combined charts.

View file

@ -1,5 +1,6 @@
{{- if and (or .Values.controller.metricsConfig.enabled .Values.controller.telemetryConfig.enabled) .Values.controller.serviceMonitor.enabled }} {{- $apiVersion := include "argo-workflows.apiVersions.monitoring" . }}
apiVersion: monitoring.coreos.com/v1 {{- if and (.Capabilities.APIVersions.Has $apiVersion) (or .Values.controller.metricsConfig.enabled .Values.controller.telemetryConfig.enabled) .Values.controller.serviceMonitor.enabled }}
apiVersion: {{ $apiVersion }}
kind: ServiceMonitor kind: ServiceMonitor
metadata: metadata:
name: {{ template "argo-workflows.controller.fullname" . }} name: {{ template "argo-workflows.controller.fullname" . }}

View file

@ -42,6 +42,8 @@ apiVersionOverrides:
autoscaling: "" # autoscaling/v2 autoscaling: "" # autoscaling/v2
# -- String to override apiVersion of GKE resources rendered by this helm chart # -- String to override apiVersion of GKE resources rendered by this helm chart
cloudgoogle: "" # cloud.google.com/v1 cloudgoogle: "" # cloud.google.com/v1
# -- String to override apiVersion of monitoring CRDs (ServiceMonitor) rendered by this helm chart
monitoring: "" # monitoring.coreos.com/v1
# -- Restrict Argo to operate only in a single namespace (the namespace of the # -- Restrict Argo to operate only in a single namespace (the namespace of the
# Helm release) by apply Roles and RoleBindings instead of the Cluster # Helm release) by apply Roles and RoleBindings instead of the Cluster