
{{- $Values := (.helm).Values | default .Values }}
{{- $multicluster := ((($Values.grafana).sidecar).dashboards).multicluster | default false }}
{{- $defaultDatasource := "prometheus" -}}
{{- $clusterLabel := ($Values.global).clusterLabel | default "cluster" }}
{{- range (($Values.defaultDatasources).victoriametrics).datasources | default list }}
  {{- if and .isDefault .type }}{{ $defaultDatasource = .type }}{{- end }}
{{- end }}
title: Kubernetes / Controller Manager
templating:
  list:
  - name: datasource
    label: Data source
    type: datasource
    query: {{ $defaultDatasource }}
    hide: 0
    current:
      selected: true
      text: default
      value: default
    regex: ""
  - name: cluster
    label: cluster
    datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    type: {{ ternary "query" "constant" $multicluster }}
    query: {{ ternary (printf "label_values(up{job=\"kube-controller-manager\"}, %s)" $clusterLabel) ".*" $multicluster }}
    hide: {{ ternary 0 2 $multicluster }}
    refresh: 2
    sort: 1
  - name: instance
    label: instance
    includeAll: true
    datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    type: query
    query: {{ printf "label_values(up{%s=~\"$cluster\",job=\"kube-controller-manager\"}, instance)" $clusterLabel }}
    hide: 0
    refresh: 2
    sort: 1
editable: false
timezone: {{ default "UTC" ($Values.defaultDashboards).defaultTimezone }}
tags:
- kubernetes-mixin
- vm-k8s-stack
panels:
- title: Up
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "sum(up{%s=~\"$cluster\",job=\"kube-controller-manager\"}) by(%s)" $clusterLabel $clusterLabel }}
    instant: true
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      unit: none
  gridPos:
    h: 7
    w: 4
    x: 0
    "y": 0
  id: 1
  interval: 1m
  options:
    colorMode: none
  pluginVersion: v11.4.0
  type: stat
- title: Work Queue Add Rate
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "sum(rate(workqueue_adds_total{%s=~\"$cluster\",job=\"kube-controller-manager\",instance=~\"$instance\"}[$__rate_interval])) by(%s,instance,name)" $clusterLabel $clusterLabel }}
    legendFormat: '{{`{{`}}cluster{{`}}`}} {{`{{`}}instance{{`}}`}} {{`{{`}}name{{`}}`}}'
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      custom:
        fillOpacity: 10
        showPoints: never
        spanNulls: true
      unit: ops
  gridPos:
    h: 7
    w: 20
    x: 4
    "y": 0
  id: 2
  interval: 1m
  options:
    legend:
      asTable: true
      calcs:
      - lastNotNull
      displayMode: table
      placement: right
      showLegend: true
    tooltip:
      mode: single
  pluginVersion: v11.4.0
  type: timeseries
- title: Work Queue Depth
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "sum(rate(workqueue_depth{%s=~\"$cluster\",job=\"kube-controller-manager\",instance=~\"$instance\"}[$__rate_interval])) by(%s,instance,name)" $clusterLabel $clusterLabel }}
    legendFormat: '{{`{{`}}cluster{{`}}`}} {{`{{`}}instance{{`}}`}} {{`{{`}}name{{`}}`}}'
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      custom:
        fillOpacity: 10
        showPoints: never
        spanNulls: true
      unit: short
  gridPos:
    h: 7
    w: 24
    x: 0
    "y": 7
  id: 3
  interval: 1m
  options:
    legend:
      asTable: true
      calcs:
      - lastNotNull
      displayMode: table
      placement: right
      showLegend: true
    tooltip:
      mode: single
  pluginVersion: v11.4.0
  type: timeseries
- title: Work Queue Latency
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "histogram_quantile(0.99, sum(rate(workqueue_queue_duration_seconds_bucket{%s=~\"$cluster\",job=\"kube-controller-manager\",instance=~\"$instance\"}[$__rate_interval])) by(%s,instance,name,le))" $clusterLabel $clusterLabel }}
    legendFormat: '{{`{{`}}cluster{{`}}`}} {{`{{`}}instance{{`}}`}} {{`{{`}}name{{`}}`}}'
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      custom:
        fillOpacity: 10
        showPoints: never
        spanNulls: true
      unit: s
  gridPos:
    h: 7
    w: 24
    x: 0
    "y": 14
  id: 4
  interval: 1m
  options:
    legend:
      asTable: true
      calcs:
      - lastNotNull
      displayMode: table
      placement: right
      showLegend: true
    tooltip:
      mode: single
  pluginVersion: v11.4.0
  type: timeseries
- title: Kube API Request Rate
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "sum(rate(rest_client_requests_total{job=\"kube-controller-manager\",instance=~\"$instance\",code=~\"2..\",%s=~\"$cluster\"}[$__rate_interval])) by(%s)" $clusterLabel $clusterLabel }}
    legendFormat: 2xx
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "sum(rate(rest_client_requests_total{job=\"kube-controller-manager\",instance=~\"$instance\",code=~\"3..\",%s=~\"$cluster\"}[$__rate_interval])) by(%s)" $clusterLabel $clusterLabel }}
    legendFormat: 3xx
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "sum(rate(rest_client_requests_total{job=\"kube-controller-manager\",instance=~\"$instance\",code=~\"4..\",%s=~\"$cluster\"}[$__rate_interval])) by(%s)" $clusterLabel $clusterLabel }}
    legendFormat: 4xx
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "sum(rate(rest_client_requests_total{job=\"kube-controller-manager\",instance=~\"$instance\",code=~\"5..\",%s=~\"$cluster\"}[$__rate_interval])) by(%s)" $clusterLabel $clusterLabel }}
    legendFormat: 5xx
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      custom:
        fillOpacity: 10
        showPoints: never
        spanNulls: true
      unit: ops
  gridPos:
    h: 7
    w: 8
    x: 0
    "y": 21
  id: 5
  interval: 1m
  options:
    legend:
      asTable: true
      calcs:
      - lastNotNull
      displayMode: table
      placement: right
      showLegend: true
    tooltip:
      mode: single
  pluginVersion: v11.4.0
  type: timeseries
- title: Post Request Latency 99th Quantile
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "histogram_quantile(0.99, sum(rate(rest_client_request_duration_seconds_bucket{%s=~\"$cluster\",job=\"kube-controller-manager\",instance=~\"$instance\",verb=\"POST\"}[$__rate_interval])) by(verb,le,%s))" $clusterLabel $clusterLabel }}
    legendFormat: '{{`{{`}}verb{{`}}`}}'
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      custom:
        fillOpacity: 10
        showPoints: never
        spanNulls: true
      unit: s
  gridPos:
    h: 7
    w: 16
    x: 8
    "y": 21
  id: 6
  interval: 1m
  options:
    legend:
      asTable: true
      calcs:
      - lastNotNull
      displayMode: table
      placement: right
      showLegend: true
    tooltip:
      mode: single
  pluginVersion: v11.4.0
  type: timeseries
- title: Get Request Latency 99th Quantile
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "histogram_quantile(0.99, sum(rate(rest_client_request_duration_seconds_bucket{%s=~\"$cluster\",job=\"kube-controller-manager\",instance=~\"$instance\",verb=\"GET\"}[$__rate_interval])) by(verb,le,%s))" $clusterLabel $clusterLabel }}
    legendFormat: '{{`{{`}}verb{{`}}`}}'
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      custom:
        fillOpacity: 10
        showPoints: never
        spanNulls: true
      unit: s
  gridPos:
    h: 7
    w: 24
    x: 0
    "y": 28
  id: 7
  interval: 1m
  options:
    legend:
      asTable: true
      calcs:
      - lastNotNull
      displayMode: table
      placement: right
      showLegend: true
    tooltip:
      mode: single
  pluginVersion: v11.4.0
  type: timeseries
- title: Memory
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "process_resident_memory_bytes{%s=~\"$cluster\",job=\"kube-controller-manager\",instance=~\"$instance\"}" $clusterLabel }}
    legendFormat: '{{`{{`}}instance{{`}}`}}'
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      custom:
        fillOpacity: 10
        showPoints: never
        spanNulls: true
      unit: bytes
  gridPos:
    h: 7
    w: 8
    x: 0
    "y": 35
  id: 8
  interval: 1m
  options:
    legend:
      asTable: true
      calcs:
      - lastNotNull
      displayMode: table
      placement: right
      showLegend: true
    tooltip:
      mode: single
  pluginVersion: v11.4.0
  type: timeseries
- title: CPU usage
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "rate(process_cpu_seconds_total{%s=~\"$cluster\",job=\"kube-controller-manager\",instance=~\"$instance\"}[$__rate_interval])" $clusterLabel }}
    legendFormat: '{{`{{`}}instance{{`}}`}}'
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      custom:
        fillOpacity: 10
        showPoints: never
        spanNulls: true
      unit: short
  gridPos:
    h: 7
    w: 8
    x: 8
    "y": 35
  id: 9
  interval: 1m
  options:
    legend:
      asTable: true
      calcs:
      - lastNotNull
      displayMode: table
      placement: right
      showLegend: true
    tooltip:
      mode: single
  pluginVersion: v11.4.0
  type: timeseries
- title: Goroutines
  targets:
  - datasource:
      type: {{ $defaultDatasource }}
      uid: ${datasource}
    expr: {{ printf "go_goroutines{%s=~\"$cluster\",job=\"kube-controller-manager\",instance=~\"$instance\"}" $clusterLabel }}
    legendFormat: '{{`{{`}}instance{{`}}`}}'
  datasource:
    type: datasource
    uid: -- Mixed --
  fieldConfig:
    defaults:
      custom:
        fillOpacity: 10
        showPoints: never
        spanNulls: true
      unit: short
  gridPos:
    h: 7
    w: 8
    x: 16
    "y": 35
  id: 10
  interval: 1m
  options:
    legend:
      asTable: true
      calcs:
      - lastNotNull
      displayMode: table
      placement: right
      showLegend: true
    tooltip:
      mode: single
  pluginVersion: v11.4.0
  type: timeseries
condition: {{ ($Values.kubeControllerManager).enabled }}
links:
- asDropdown: true
  includeVars: true
  keepTime: true
  tags:
  - kubernetes-mixin
  targetBlank: false
  title: Kubernetes
  type: dashboards
refresh: 10s
schemaVersion: 39
time:
  from: now-1h
  to: now
uid: 72e0e05bef5099e5f049b05fdc429ed4
