apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  labels:
    name: image-registry-operator-alerts
  name: image-registry-operator-alerts
  namespace: openshift-image-registry
spec:
  groups:
  - name: ImageRegistryOperator
    rules:
    - alert: ImageRegistryStorageReconfigured
      expr: increase(image_registry_operator_storage_reconfigured_total[30m]) > 0
      labels:
        severity: warning
      annotations:
        message: |
          Image Registry Storage configuration has changed in the last 30
          minutes. This change may have caused data loss.
    - alert: ImageRegistryRemoved
      expr: cluster_operator_conditions{name="image-registry",condition="Available",reason="Removed"} > 0
      for: 5m
      labels:
        severity: warning
      annotations:
        message: |
          Image Registry has been removed. ImageStreamTags, BuildConfigs and
          DeploymentConfigs which reference ImageStreamTags may not work as
          expected. Please configure storage and update the config to Managed
          state by editing configs.imageregistry.operator.openshift.io.
  - name: ImagePruner
    rules:
    - alert: ImagePruningDisabled
      expr: image_registry_operator_image_pruner_install_status < 2
      labels:
        severity: warning
      annotations:
        message: |
          Automatic image pruning is not enabled. Regular pruning of images
          no longer referenced by ImageStreams is strongly recommended to
          ensure your cluster remains healthy.
          
          To remove this warning, install the image pruner by creating an
          imagepruner.imageregistry.operator.openshift.io resource with the
          name `cluster`. Ensure that the `suspend` field is set to `false`.
