kind: ConfigMap
apiVersion: v1
metadata:
  name: thanos-ruler-default-rules
data:
  default_rules.yaml: |
    groups:
      - name: kubernetes-storage
        rules:
        - alert: KubePersistentVolumeFillingUp
          annotations:
            summary: PersistentVolume is filling up.
            description: "The PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} is only {{ $value | humanizePercentage }} free."        
          expr: kubelet_volume_stats_available_bytes{namespace="open-cluster-management-observability"}/kubelet_volume_stats_capacity_bytes{namespace="open-cluster-management-observability"} < 0.03
          for: 1m
          labels:
            instance: "{{ $labels.instance }}"
            cluster: "{{ $labels.cluster }}"
            clusterID: "{{ $labels.clusterID }}"
            PersistentVolumeClaim: "{{ $labels.persistentvolumeclaim }}"
            severity: critical
        - alert: KubePersistentVolumeFillingUp
          annotations:
            summary: PersistentVolume is filling up and is predicted to run out of space in 6h.
            description: "The PersistentVolume claimed by {{ $labels.persistentvolumeclaim }} in Namespace {{ $labels.namespace }} is only {{ $value | humanizePercentage }} free."                        
          expr: (kubelet_volume_stats_available_bytes{namespace="open-cluster-management-observability"}/kubelet_volume_stats_capacity_bytes{namespace="open-cluster-management-observability"}) < 0.15 and (predict_linear(kubelet_volume_stats_available_bytes{namespace="open-cluster-management-observability"}[6h], 4 * 24 * 3600)) <0
          for: 1h
          labels:
            instance: "{{ $labels.instance }}"
            cluster: "{{ $labels.cluster }}"
            clusterID: "{{ $labels.clusterID }}"
            PersistentVolumeClaim: "{{ $labels.persistentvolumeclaim }}"
            severity: warning            

