
{{- $Values := (.helm).Values | default .Values }}
{{- $runbookUrl := ($Values.defaultRules).runbookUrl | default "https://runbooks.prometheus-operator.dev/runbooks" }}
{{- $clusterLabel := ($Values.global).clusterLabel | default "cluster" }}
{{- $additionalGroupByLabels := append $Values.defaultRules.additionalGroupByLabels $clusterLabel }}
{{- $groupLabels := join "," (uniq $additionalGroupByLabels) }}
{{- $grafanaAddr := include "vm-k8s-stack.grafana.addr" . }}
name: kube-scheduler.rules
rules:
- expr: histogram_quantile(0.99, sum(rate(scheduler_scheduling_attempt_duration_seconds_bucket{job="kube-scheduler"}[5m])) without(instance,pod))
  condition: true
  labels:
    quantile: "0.99"
  record: cluster_quantile:scheduler_scheduling_attempt_duration_seconds:histogram_quantile
- expr: histogram_quantile(0.99, sum(rate(scheduler_scheduling_algorithm_duration_seconds_bucket{job="kube-scheduler"}[5m])) without(instance,pod))
  condition: true
  labels:
    quantile: "0.99"
  record: cluster_quantile:scheduler_scheduling_algorithm_duration_seconds:histogram_quantile
- expr: histogram_quantile(0.99, sum(rate(scheduler_pod_scheduling_sli_duration_seconds_bucket{job="kube-scheduler"}[5m])) without(instance,pod))
  condition: true
  labels:
    quantile: "0.99"
  record: cluster_quantile:scheduler_pod_scheduling_sli_duration_seconds:histogram_quantile
- expr: histogram_quantile(0.9, sum(rate(scheduler_scheduling_attempt_duration_seconds_bucket{job="kube-scheduler"}[5m])) without(instance,pod))
  condition: true
  labels:
    quantile: "0.9"
  record: cluster_quantile:scheduler_scheduling_attempt_duration_seconds:histogram_quantile
- expr: histogram_quantile(0.9, sum(rate(scheduler_scheduling_algorithm_duration_seconds_bucket{job="kube-scheduler"}[5m])) without(instance,pod))
  condition: true
  labels:
    quantile: "0.9"
  record: cluster_quantile:scheduler_scheduling_algorithm_duration_seconds:histogram_quantile
- expr: histogram_quantile(0.9, sum(rate(scheduler_pod_scheduling_sli_duration_seconds_bucket{job="kube-scheduler"}[5m])) without(instance,pod))
  condition: true
  labels:
    quantile: "0.9"
  record: cluster_quantile:scheduler_pod_scheduling_sli_duration_seconds:histogram_quantile
- expr: histogram_quantile(0.5, sum(rate(scheduler_scheduling_attempt_duration_seconds_bucket{job="kube-scheduler"}[5m])) without(instance,pod))
  condition: true
  labels:
    quantile: "0.5"
  record: cluster_quantile:scheduler_scheduling_attempt_duration_seconds:histogram_quantile
- expr: histogram_quantile(0.5, sum(rate(scheduler_scheduling_algorithm_duration_seconds_bucket{job="kube-scheduler"}[5m])) without(instance,pod))
  condition: true
  labels:
    quantile: "0.5"
  record: cluster_quantile:scheduler_scheduling_algorithm_duration_seconds:histogram_quantile
- expr: histogram_quantile(0.5, sum(rate(scheduler_pod_scheduling_sli_duration_seconds_bucket{job="kube-scheduler"}[5m])) without(instance,pod))
  condition: true
  labels:
    quantile: "0.5"
  record: cluster_quantile:scheduler_pod_scheduling_sli_duration_seconds:histogram_quantile
condition: {{ ($Values.kubeScheduler).enabled }}
