forked from prometheus-community/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[kube-prometheus-stack] Configure additional aggregation labels + k8s…
….rules split (prometheus-community#3883) * [kube-prometheus-stack] Configure additional aggregation labels Signed-off-by: Jan-Otto Kröpke <[email protected]> * Re-run sync Signed-off-by: Jan-Otto Kröpke <[email protected]> * Re-run sync Signed-off-by: Jan-Otto Kröpke <[email protected]> * Add new values for rules Signed-off-by: Jan-Otto Kröpke <[email protected]> * Add new values for rules Signed-off-by: Jan-Otto Kröpke <[email protected]> * Add new values for rules Signed-off-by: Jan-Otto Kröpke <[email protected]> * [kube-prometheus-stack] Fix names Signed-off-by: Jan-Otto Kröpke <[email protected]> * bump version Signed-off-by: Jan-Otto Kröpke <[email protected]> --------- Signed-off-by: Jan-Otto Kröpke <[email protected]> Signed-off-by: Jan-Otto Kröpke <[email protected]> Signed-off-by: Jan-Otto Kröpke <[email protected]> Co-authored-by: Gabriel Martinez <[email protected]> Signed-off-by: Sacha <[email protected]>
- Loading branch information
1 parent
d6436cb
commit c7ccb04
Showing
27 changed files
with
700 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...us-stack/templates/prometheus/rules-1.14/k8s.rules.container_cpu_usage_seconds_total.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{{- /* | ||
Generated from 'k8s.rules.container-cpu-usage-seconds-total' group from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/kubernetesControlPlane-prometheusRule.yaml | ||
Do not change in-place! In order to change this file first read following link: | ||
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack | ||
*/ -}} | ||
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} | ||
{{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.k8sContainerCpuUsageSecondsTotal }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" .) "k8s.rules.container-cpu-usage-seconds-total" | trunc 63 | trimSuffix "-" }} | ||
namespace: {{ template "kube-prometheus-stack.namespace" . }} | ||
labels: | ||
app: {{ template "kube-prometheus-stack.name" . }} | ||
{{ include "kube-prometheus-stack.labels" . | indent 4 }} | ||
{{- if .Values.defaultRules.labels }} | ||
{{ toYaml .Values.defaultRules.labels | indent 4 }} | ||
{{- end }} | ||
{{- if .Values.defaultRules.annotations }} | ||
annotations: | ||
{{ toYaml .Values.defaultRules.annotations | indent 4 }} | ||
{{- end }} | ||
spec: | ||
groups: | ||
- name: k8s.rules.container_cpu_usage_seconds_total | ||
rules: | ||
- expr: |- | ||
sum by ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod, container) ( | ||
irate(container_cpu_usage_seconds_total{job="kubelet", metrics_path="/metrics/cadvisor", image!=""}[5m]) | ||
) * on ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod) group_left(node) topk by ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod) ( | ||
1, max by ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod, node) (kube_pod_info{node!=""}) | ||
) | ||
record: node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate | ||
{{- if or .Values.defaultRules.additionalRuleLabels .Values.defaultRules.additionalRuleGroupLabels.k8sContainerCpuUsageSecondsTotal }} | ||
labels: | ||
{{- with .Values.defaultRules.additionalRuleLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.defaultRules.additionalRuleGroupLabels.k8sContainerCpuUsageSecondsTotal }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
42 changes: 42 additions & 0 deletions
42
...be-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.container_memory_cache.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{{- /* | ||
Generated from 'k8s.rules.container-memory-cache' group from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/kubernetesControlPlane-prometheusRule.yaml | ||
Do not change in-place! In order to change this file first read following link: | ||
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack | ||
*/ -}} | ||
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} | ||
{{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.k8sContainerMemoryCache }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" .) "k8s.rules.container-memory-cache" | trunc 63 | trimSuffix "-" }} | ||
namespace: {{ template "kube-prometheus-stack.namespace" . }} | ||
labels: | ||
app: {{ template "kube-prometheus-stack.name" . }} | ||
{{ include "kube-prometheus-stack.labels" . | indent 4 }} | ||
{{- if .Values.defaultRules.labels }} | ||
{{ toYaml .Values.defaultRules.labels | indent 4 }} | ||
{{- end }} | ||
{{- if .Values.defaultRules.annotations }} | ||
annotations: | ||
{{ toYaml .Values.defaultRules.annotations | indent 4 }} | ||
{{- end }} | ||
spec: | ||
groups: | ||
- name: k8s.rules.container_memory_cache | ||
rules: | ||
- expr: |- | ||
container_memory_cache{job="kubelet", metrics_path="/metrics/cadvisor", image!=""} | ||
* on ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod) group_left(node) topk by ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod) (1, | ||
max by ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod, node) (kube_pod_info{node!=""}) | ||
) | ||
record: node_namespace_pod_container:container_memory_cache | ||
{{- if or .Values.defaultRules.additionalRuleLabels .Values.defaultRules.additionalRuleGroupLabels.k8sContainerMemoryCache }} | ||
labels: | ||
{{- with .Values.defaultRules.additionalRuleLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.defaultRules.additionalRuleGroupLabels.k8sContainerMemoryCache }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
42 changes: 42 additions & 0 deletions
42
...kube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.container_memory_rss.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{{- /* | ||
Generated from 'k8s.rules.container-memory-rss' group from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/kubernetesControlPlane-prometheusRule.yaml | ||
Do not change in-place! In order to change this file first read following link: | ||
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack | ||
*/ -}} | ||
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} | ||
{{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.k8sContainerMemoryRss }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" .) "k8s.rules.container-memory-rss" | trunc 63 | trimSuffix "-" }} | ||
namespace: {{ template "kube-prometheus-stack.namespace" . }} | ||
labels: | ||
app: {{ template "kube-prometheus-stack.name" . }} | ||
{{ include "kube-prometheus-stack.labels" . | indent 4 }} | ||
{{- if .Values.defaultRules.labels }} | ||
{{ toYaml .Values.defaultRules.labels | indent 4 }} | ||
{{- end }} | ||
{{- if .Values.defaultRules.annotations }} | ||
annotations: | ||
{{ toYaml .Values.defaultRules.annotations | indent 4 }} | ||
{{- end }} | ||
spec: | ||
groups: | ||
- name: k8s.rules.container_memory_rss | ||
rules: | ||
- expr: |- | ||
container_memory_rss{job="kubelet", metrics_path="/metrics/cadvisor", image!=""} | ||
* on ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod) group_left(node) topk by ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod) (1, | ||
max by ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod, node) (kube_pod_info{node!=""}) | ||
) | ||
record: node_namespace_pod_container:container_memory_rss | ||
{{- if or .Values.defaultRules.additionalRuleLabels .Values.defaultRules.additionalRuleGroupLabels.k8sContainerMemoryRss }} | ||
labels: | ||
{{- with .Values.defaultRules.additionalRuleLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.defaultRules.additionalRuleGroupLabels.k8sContainerMemoryRss }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
42 changes: 42 additions & 0 deletions
42
...ube-prometheus-stack/templates/prometheus/rules-1.14/k8s.rules.container_memory_swap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{{- /* | ||
Generated from 'k8s.rules.container-memory-swap' group from https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/main/manifests/kubernetesControlPlane-prometheusRule.yaml | ||
Do not change in-place! In order to change this file first read following link: | ||
https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack/hack | ||
*/ -}} | ||
{{- $kubeTargetVersion := default .Capabilities.KubeVersion.GitVersion .Values.kubeTargetVersionOverride }} | ||
{{- if and (semverCompare ">=1.14.0-0" $kubeTargetVersion) (semverCompare "<9.9.9-9" $kubeTargetVersion) .Values.defaultRules.create .Values.defaultRules.rules.k8sContainerMemorySwap }} | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
name: {{ printf "%s-%s" (include "kube-prometheus-stack.fullname" .) "k8s.rules.container-memory-swap" | trunc 63 | trimSuffix "-" }} | ||
namespace: {{ template "kube-prometheus-stack.namespace" . }} | ||
labels: | ||
app: {{ template "kube-prometheus-stack.name" . }} | ||
{{ include "kube-prometheus-stack.labels" . | indent 4 }} | ||
{{- if .Values.defaultRules.labels }} | ||
{{ toYaml .Values.defaultRules.labels | indent 4 }} | ||
{{- end }} | ||
{{- if .Values.defaultRules.annotations }} | ||
annotations: | ||
{{ toYaml .Values.defaultRules.annotations | indent 4 }} | ||
{{- end }} | ||
spec: | ||
groups: | ||
- name: k8s.rules.container_memory_swap | ||
rules: | ||
- expr: |- | ||
container_memory_swap{job="kubelet", metrics_path="/metrics/cadvisor", image!=""} | ||
* on ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod) group_left(node) topk by ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod) (1, | ||
max by ({{ range $.Values.defaultRules.additionalAggregationLabels }}{{ . }},{{ end }}cluster, namespace, pod, node) (kube_pod_info{node!=""}) | ||
) | ||
record: node_namespace_pod_container:container_memory_swap | ||
{{- if or .Values.defaultRules.additionalRuleLabels .Values.defaultRules.additionalRuleGroupLabels.k8sContainerMemorySwap }} | ||
labels: | ||
{{- with .Values.defaultRules.additionalRuleLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.defaultRules.additionalRuleGroupLabels.k8sContainerMemorySwap }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.