Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.monitoring.prometheus.enabled }}
{{- include "base-cluster.helm.resourceWithDependencies" (dict "name" "base-cluster-current" "resource" (include "base-cluster.currentVersionRule" .) "render" false "dependencies" (dict "monitoring" "kube-prometheus-stack") "context" $ "additionalLabels" (dict "monitoring/provisioned-by" "base-cluster")) }}
{{- end -}}

{{- define "base-cluster.currentVersionRule" -}}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: base-cluster-current
namespace: flux-system
Comment thread
cwrau marked this conversation as resolved.
labels: {{- include "common.labels.standard" . | nindent 4 }}
monitoring/provisioned-by: base-cluster
spec:
groups:
- name: base-cluster-current
rules:
- record: base_cluster_current_version:info
expr: vector(1)
labels: {{- with semver .Chart.Version }}
tag: {{ printf "%d.%d.%d" .Major .Minor .Patch | quote }}
{{- end }}
Comment thread
cwrau marked this conversation as resolved.
Comment thread
cwrau marked this conversation as resolved.
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{- if .Values.monitoring.prometheus.enabled }}
{{- include "base-cluster.helm.resourceWithDependencies" (dict "name" "base-cluster-update" "resource" (include "base-cluster.updateAlert" .) "render" false "dependencies" (dict "monitoring" "kube-prometheus-stack") "context" $ "additionalLabels" (dict "monitoring/provisioned-by" "base-cluster")) }}
{{- end -}}

{{- define "base-cluster.updateAlert" -}}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: base-cluster-update
namespace: flux-system
Comment thread
cwrau marked this conversation as resolved.
labels: {{- include "common.labels.standard" . | nindent 4 }}
monitoring/provisioned-by: base-cluster
spec:
groups:
- name: base-cluster-update
rules:
- alert: BaseClusterUpdateAvailable
annotations:
description: {{ "New base-cluster version is available. New version: {{ $labels.tag }}." | quote }}
summary: New base-cluster version is available.
expr: |-
(
(
(max(image_policy_latest_version{customresource_namespace="flux-system",customresource_name="base-cluster-chart"}) by (tag))
-
base_cluster_current_version:info
)
or
(max(image_policy_latest_version{customresource_namespace="flux-system",customresource_name="base-cluster-chart"}) by (tag))
) == 1
for: 1w
labels:
Comment thread
cwrau marked this conversation as resolved.
severity: critical
period: WorkingHours
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if and .Values.monitoring.prometheus.enabled }}
apiVersion: image.toolkit.fluxcd.io/v1
kind: ImageRepository
metadata:
name: base-cluster-chart
namespace: flux-system
labels: {{- include "common.labels.standard" . | nindent 4 }}
monitoring/provisioned-by: base-cluster
spec:
image: ghcr.io/teutonet/teutonet-helm-charts/base-cluster # artifacthub-ignore
interval: 24h
---
apiVersion: image.toolkit.fluxcd.io/v1
kind: ImagePolicy
metadata:
name: base-cluster-chart
namespace: flux-system
labels: {{- include "common.labels.standard" . | nindent 4 }}
monitoring/provisioned-by: base-cluster
spec:
imageRepositoryRef:
name: base-cluster-chart
Comment thread
cwrau marked this conversation as resolved.
policy:
semver:
range: x.x.x
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,34 @@ customResourceState:
)
)
-}}
{{- end }}
{{- end -}}

{{- $resources = append $resources (dict
"groupVersionKind" (dict
"group" "image.toolkit.fluxcd.io"
"kind" "ImagePolicy"
)
"metricNamePrefix" "image_policy"
"metrics" (list
(dict
"name" "latest_version"
"help" "The latest version of the image as determined by the ImagePolicy."
"each" (dict
"type" "Info"
"info" (dict
"labelsFromPath" (dict
"tag" (list "status" "latestRef" "tag")
)
)
)
"labelsFromPath" (dict
"customresource_namespace" (list "metadata" "namespace")
"customresource_name" (list "metadata" "name")
)
)
)
)
}}
resources: {{- toYaml $resources | nindent 8 }}
podAnnotations:
checksum/config: {{ toYaml $resources | sha256sum | quote }}
Expand Down
Loading