Skip to content

Commit

Permalink
chore(chart): check CRDs available before installing prometheus resou…
Browse files Browse the repository at this point in the history
…rces

Prometheus  resources should not be rendered unless Prometheus CRDs are
available.

This changeset includes an extra option to override the `apiVersion` Prometheus
provides.

close #107

Signed-off-by: cmontemuino <1761056+cmontemuino@users.noreply.github.com>
  • Loading branch information
cmontemuino committed Jan 29, 2024
1 parent 161b5af commit 06a76b7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deploy/charts/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ keywords:
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.4.13
version: 0.4.14

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
2 changes: 2 additions & 0 deletions deploy/charts/templates/podmonitors.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
{{- range $monitoringAddon, $fields := .Values.openebsMonitoringAddon }}
{{- if (and (hasKey $fields "enabled") ($fields.enabled)) }}
{{- if (hasKey $fields "podMonitor") }}
Expand Down Expand Up @@ -27,3 +28,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions deploy/charts/templates/prometheusRules.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
{{- $alertRules := dict -}}
{{- range $monitoringAddon,$fields := .Values.openebsMonitoringAddon }}
{{- if (and (hasKey $fields "enabled") ($fields.enabled)) }}
Expand Down Expand Up @@ -28,3 +29,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions deploy/charts/templates/servicemonitors.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
{{- range $monitoringAddon, $fields := .Values.openebsMonitoringAddon }}
{{- if (and (hasKey $fields "enabled") ($fields.enabled)) }}
{{- if (hasKey $fields "serviceMonitor") }}
Expand Down Expand Up @@ -27,3 +28,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 06a76b7

Please sign in to comment.