diff --git a/charts/rclone-bucket/README.md b/charts/rclone-bucket/README.md index a41148f..7fd4c02 100644 --- a/charts/rclone-bucket/README.md +++ b/charts/rclone-bucket/README.md @@ -1,6 +1,6 @@ # rclone-bucket -![Version: 0.10.0](https://img.shields.io/badge/Version-0.10.0-informational?style=flat-square) ![AppVersion: v1.74.0](https://img.shields.io/badge/AppVersion-v1.74.0-informational?style=flat-square) +![Version: 0.10.1](https://img.shields.io/badge/Version-0.10.1-informational?style=flat-square) ![AppVersion: v1.74.1](https://img.shields.io/badge/AppVersion-v1.74.1-informational?style=flat-square) Rclone CronJob to replicate buckets @@ -27,9 +27,10 @@ Rclone CronJob to replicate buckets |-----|------|---------|-------------| | additionalLabels | object | `{}` | Add additional labels | | cronJob | object | `{"backoffLimit":3,"parallelism":1,"schedule":"0 0 * * *","suspend":false,"timeZone":"America/Chicago"}` | CronJob configuration | -| image | object | `{"pullPolicy":"IfNotPresent","repository":"rclone/rclone","tag":"1.74.0@sha256:d2e0e88359d0b2e67cfcd2c43d5405185eb8adfc207079df27c42da82c5207bc"}` | Default image | +| image | object | `{"pullPolicy":"IfNotPresent","repository":"rclone/rclone","tag":"1.74.1@sha256:eb8788b795f0009324e9572b0e2acb9b56885327c2746b07d67a9d3b893a6602"}` | Default image | | metrics | object | `{"enabled":true}` | Metrics | | nameOverride | string | `""` | Default pattern follows -backup | +| prometheusRule | object | `{"enabled":true}` | Prometheus Rule | | prune | object | `{"ageToPrune":"90d","enabled":false,"exclude":"","include":""}` | Enable prune job | | rclone | object | `{"destination":{"bucketName":"bucket","forcePathStyle":true,"providerType":"Other"},"providerType":"Other","source":{"bucketName":"bucket","forcePathStyle":true,"providerType":"Other"}}` | rclone configuration | | rclone.destination | object | `{"bucketName":"bucket","forcePathStyle":true,"providerType":"Other"}` | Destination configuration | diff --git a/charts/rclone-bucket/templates/_helpers.tpl b/charts/rclone-bucket/templates/_helpers.tpl index 3d3e72a..b0caba2 100644 --- a/charts/rclone-bucket/templates/_helpers.tpl +++ b/charts/rclone-bucket/templates/_helpers.tpl @@ -62,16 +62,16 @@ DEST_ENDPOINT {{/* Create chart name and version as used by the chart label. */}} -{{- define "secretRclone.chart" -}} +{{- define "rclone.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} -{{- define "secretRclone.labels" -}} -helm.sh/chart: {{ include "secretRclone.chart" $ }} -{{ include "secretRclone.selectorLabels" $ }} +{{- define "rclone.labels" -}} +helm.sh/chart: {{ include "rclone.chart" $ }} +{{ include "rclone.selectorLabels" $ }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.Version | quote }} {{- end }} @@ -84,7 +84,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "secretRclone.selectorLabels" -}} +{{- define "rclone.selectorLabels" -}} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/part-of: {{ .Release.Name }} {{- end }} diff --git a/charts/rclone-bucket/templates/external-secret.yaml b/charts/rclone-bucket/templates/external-secret.yaml index d4cd129..7cc7bd7 100644 --- a/charts/rclone-bucket/templates/external-secret.yaml +++ b/charts/rclone-bucket/templates/external-secret.yaml @@ -6,7 +6,7 @@ metadata: name: {{ include "rclone.sourceSecretName" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "secretRclone.labels" . | nindent 4 }} + {{- include "rclone.labels" . | nindent 4 }} app.kubernetes.io/name: {{ include "rclone.sourceSecretName" . }} {{- with .Values.additionalLabels }} {{- toYaml . | nindent 4 }} @@ -40,7 +40,7 @@ metadata: name: {{ include "rclone.destinationSecretName" . }} namespace: {{ .Release.Namespace }} labels: - {{- include "secretRclone.labels" . | nindent 4 }} + {{- include "rclone.labels" . | nindent 4 }} app.kubernetes.io/name: {{ include "rclone.destinationSecretName" . }} {{- with .Values.additionalLabels }} {{- toYaml . | nindent 4 }} diff --git a/charts/rclone-bucket/templates/prometheus-rule.yaml b/charts/rclone-bucket/templates/prometheus-rule.yaml new file mode 100644 index 0000000..5aa83c3 --- /dev/null +++ b/charts/rclone-bucket/templates/prometheus-rule.yaml @@ -0,0 +1,32 @@ +{{- if .Values.prometheusRule.enabled }} +--- +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: {{ include "rclone.name" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "rclone.labels" . | nindent 4 }} + app.kubernetes.io/name: {{ include "rclone.name" . }} + {{- with .Values.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + groups: + - name: rclone.alerts + rules: + - alert: RclonePodFailed + expr: | + (kube_pod_container_status_last_terminated_exitcode > 0) + * on(pod, namespace) group_left(owner_name) + kube_pod_owner{owner_kind="Job", owner_name=~"rclone-.*"} + for: 1m + labels: + severity: critical + annotations: + summary: "Rclone Pod failed in {{ `{{ $labels.namespace }}` }}" + description: | + A pod for the Rclone sync of s3 bucket '{{ .Values.rclone.source.bucketName }}' failed with exit code {{ `{{ $value }}` }}. + Job: {{ `{{ $labels.owner_name }}` }} + Namespace: {{ `{{ $labels.namespace }}` }} +{{- end }} diff --git a/charts/rclone-bucket/values.yaml b/charts/rclone-bucket/values.yaml index e210e8b..1240324 100644 --- a/charts/rclone-bucket/values.yaml +++ b/charts/rclone-bucket/values.yaml @@ -86,3 +86,7 @@ secret: # -- Metrics metrics: enabled: true + +# -- Prometheus Rule +prometheusRule: + enabled: true