---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  creationTimestamp: "2022-03-08T10:14:04Z"
  generation: 1
  labels:
    name: samples-operator-alerts
  managedFields:
  - apiVersion: monitoring.coreos.com/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:labels:
          .: {}
          f:name: {}
      f:spec:
        .: {}
        f:groups: {}
    manager: cluster-version-operator
    operation: Update
    time: "2022-03-08T10:14:04Z"
  name: samples-operator-alerts
  namespace: openshift-cluster-samples-operator
  resourceVersion: "1341"
  selfLink: /apis/monitoring.coreos.com/v1/namespaces/openshift-cluster-samples-operator/prometheusrules/samples-operator-alerts
  uid: 2125f803-47e8-4215-a901-5318f193ad63
spec:
  groups:
  - name: SamplesOperator
    rules:
    - alert: SamplesRetriesMissingOnImagestreamImportFailing
      annotations:
        message: |
          Samples operator is detecting problems with imagestream image imports, and the periodic retries of those
          imports are not occurring.  Contact support.  You can look at the "openshift-samples" ClusterOperator object
          for details. Most likely there are issues with the external image registry hosting the images that need to
          be investigated.  The list of ImageStreams that have failing imports are:
          {{ range query "openshift_samples_failed_imagestream_import_info > 0" }}
            {{ .Labels.name }}
          {{ end }}
          However, the list of ImageStreams for which samples operator is retrying imports is:
          retrying imports:
          {{ range query "openshift_samples_retry_imagestream_import_total > 0" }}
             {{ .Labels.imagestreamname }}
          {{ end }}
      expr: sum(openshift_samples_failed_imagestream_import_info) > sum(openshift_samples_retry_imagestream_import_total) - sum(openshift_samples_retry_imagestream_import_total offset 30m)
      for: 2h
      labels:
        severity: warning
    - alert: SamplesImagestreamImportFailing
      annotations:
        message: |
          Samples operator is detecting problems with imagestream image imports.  You can look at the "openshift-samples"
          ClusterOperator object for details. Most likely there are issues with the external image registry hosting
          the images that needs to be investigated.  Or you can consider marking samples opertaor Removed if you do not
          care about having sample imagestreams available.  The list of ImageStreams for which samples operator is
          retrying imports:
          {{ range query "openshift_samples_retry_imagestream_import_total > 0" }}
             {{ .Labels.imagestreamname }}
          {{ end }}
      expr: sum(openshift_samples_retry_imagestream_import_total) - sum(openshift_samples_retry_imagestream_import_total offset 30m) > sum(openshift_samples_failed_imagestream_import_info)
      for: 2h
      labels:
        severity: warning
    - alert: SamplesDegraded
      annotations:
        message: |
          Samples could not be deployed and the operator is degraded. Review the "openshift-samples" ClusterOperator object for further details.
      expr: openshift_samples_degraded_info == 1
      for: 2h
      labels:
        severity: warning
    - alert: SamplesInvalidConfig
      annotations:
        message: |
          Samples operator has been given an invalid configuration.
      expr: openshift_samples_invalidconfig_info == 1
      for: 2h
      labels:
        severity: warning
    - alert: SamplesMissingSecret
      annotations:
        message: |
          Samples operator cannot find the samples pull secret in the openshift namespace.
      expr: openshift_samples_invalidsecret_info{reason="missing_secret"} == 1
      for: 2h
      labels:
        severity: warning
    - alert: SamplesMissingTBRCredential
      annotations:
        message: |
          The samples operator cannot find credentials for 'registry.redhat.io'. Many of the sample ImageStreams will fail to import unless the 'samplesRegistry' in the operator configuration is changed.
      expr: openshift_samples_invalidsecret_info{reason="missing_tbr_credential"} == 1
      for: 2h
      labels:
        severity: warning
    - alert: SamplesTBRInaccessibleOnBoot
      annotations:
        message: |
          Samples operator could not access 'registry.redhat.io' during its initial installation and it boostrapped as removed.
      expr: openshift_samples_tbr_inaccessible_info == 1
      for: 2d
      labels:
        severity: info
