diff --git a/charts/argo-workflows/Chart.yaml b/charts/argo-workflows/Chart.yaml index 99b190bc..e15f79c3 100644 --- a/charts/argo-workflows/Chart.yaml +++ b/charts/argo-workflows/Chart.yaml @@ -3,7 +3,7 @@ appVersion: v3.5.5 name: argo-workflows description: A Helm chart for Argo Workflows type: application -version: 0.40.14 +version: 0.40.15 icon: https://argo-workflows.readthedocs.io/en/stable/assets/logo.png home: https://github.com/argoproj/argo-helm sources: @@ -17,4 +17,4 @@ annotations: url: https://argoproj.github.io/argo-helm/pgp_keys.asc artifacthub.io/changes: | - kind: added - description: Support namespaceOverride + description: Check Prometheus CRDs are available before creating Service Monitor resource(s) diff --git a/charts/argo-workflows/README.md b/charts/argo-workflows/README.md index 785bf9f8..8b9c78ec 100644 --- a/charts/argo-workflows/README.md +++ b/charts/argo-workflows/README.md @@ -212,6 +212,7 @@ Fields to note: | controller.serviceAnnotations | object | `{}` | Annotations to be applied to the controller Service | | controller.serviceLabels | object | `{}` | Optional labels to add to the controller Service | | controller.serviceMonitor.additionalLabels | object | `{}` | Prometheus ServiceMonitor labels | +| controller.serviceMonitor.apiVersion | string | `"monitoring.coreos.com/v1"` | ApiVersion for the serviceMonitor resource | | controller.serviceMonitor.enabled | bool | `false` | Enable a prometheus ServiceMonitor | | controller.serviceMonitor.namespace | string | `""` | Prometheus ServiceMonitor namespace | | controller.serviceType | string | `"ClusterIP"` | Service type of the controller Service | diff --git a/charts/argo-workflows/templates/controller/workflow-controller-servicemonitor.yaml b/charts/argo-workflows/templates/controller/workflow-controller-servicemonitor.yaml index df318fc2..d0b773ec 100644 --- a/charts/argo-workflows/templates/controller/workflow-controller-servicemonitor.yaml +++ b/charts/argo-workflows/templates/controller/workflow-controller-servicemonitor.yaml @@ -1,5 +1,7 @@ {{- if and (or .Values.controller.metricsConfig.enabled .Values.controller.telemetryConfig.enabled) .Values.controller.serviceMonitor.enabled }} -apiVersion: monitoring.coreos.com/v1 +{{- $prometheusApiVersion := .Values.controller.serviceMonitor.apiVersion -}} +{{- if .Capabilities.APIVersions.Has $prometheusApiVersion }} +apiVersion: {{ $prometheusApiVersion }} kind: ServiceMonitor metadata: name: {{ template "argo-workflows.controller.fullname" . }} @@ -48,3 +50,4 @@ spec: matchLabels: {{- include "argo-workflows.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 6 }} {{- end }} +{{- end }} diff --git a/charts/argo-workflows/values.yaml b/charts/argo-workflows/values.yaml index 0f2d6ca7..aaf5d86e 100644 --- a/charts/argo-workflows/values.yaml +++ b/charts/argo-workflows/values.yaml @@ -240,6 +240,8 @@ controller: additionalLabels: {} # -- Prometheus ServiceMonitor namespace namespace: "" # "monitoring" + # -- ApiVersion for the serviceMonitor resource + apiVersion: monitoring.coreos.com/v1 serviceAccount: # -- Create a service account for the controller create: true