apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  annotations:
    exclude.release.openshift.io/internal-openshift-hosted: "true"
  name: cloud-credential-operator-alerts
  namespace: openshift-cloud-credential-operator
spec:
  groups:
  - name: CloudCredentialOperator
    rules:
    - alert: CloudCredentialOperatorTargetNamespaceMissing
      annotations:
        message: CredentialsRequest(s) pointing to non-existant namespace
      expr: cco_credentials_requests_conditions{condition="MissingTargetNamespace"}
        > 0
      for: 5m
      labels:
        severity: warning
    - alert: CloudCredentialOperatorProvisioningFailed
      annotations:
        message: CredentialsRequest(s) unable to be fulfilled
      expr: cco_credentials_requests_conditions{condition="CredentialsProvisionFailure"}
        > 0
      for: 5m
      labels:
        severity: warning
    - alert: CloudCredentialOperatorDeprovisioningFailed
      annotations:
        message: CredentialsRequest(s) unable to be cleaned up
      expr: cco_credentials_requests_conditions{condition="CredentialsDeprovisionFailure"}
        > 0
      for: 5m
      labels:
        severity: warning
    - alert: CloudCredentialOperatorInsufficientCloudCreds
      annotations:
        message: Cluster's cloud credentials insufficient for minting or passthrough
      expr: cco_credentials_requests_conditions{condition="InsufficientCloudCreds"}
        > 0
      for: 5m
      labels:
        severity: warning
    - alert: CloudCredentialOperatorDown
      annotations:
        message: cloud-credential-operator pod not running
      expr: absent(up{job="cco-metrics"} == 1)
      for: 20m
      labels:
        severity: critical
