Skip to content

Commit

Permalink
fix(application-template): capability api 제거, 오타 수정 (#18)
Browse files Browse the repository at this point in the history
* fix: typo

* fix: remove capability api

* fix: update chart version
  • Loading branch information
atobaum authored Apr 5, 2024
1 parent d8f9e8f commit 59d307a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion charts/application-template/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ maintainers:
- name: modusign
url: https://github.com/modusign
name: application-template
version: 1.5.0
version: 1.5.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PrometheusRule" }}
{{- if and .Values.scheduler.enabled (or .Values.scheduler.observability.prometheus.alerting_rules.enabled .Values.scheduler.observability.prometheus.istio_alerting_rules.enabled) }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
Expand Down Expand Up @@ -78,4 +77,3 @@ spec:
description: "[{{ include "application.scheduler.name" . | title }}][istio-proxy] 서비스의 최근 메모리 사용량이 {{ .Values.scheduler.observability.prometheus.istio_alerting_rules.highMemoryUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"
{{- end }}
{{- end }}
{{- end }}
28 changes: 13 additions & 15 deletions charts/application-template/templates/server/prometheus-rule.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PrometheusRule" }}
{{- if and .Values.server.enabled (or .Values.server.observability.prometheus.rules.enabled .Values.server.observability.prometheus.istio_rules.enabled) }}
{{- if and .Values.server.enabled (or .Values.server.observability.prometheus.alerting_rules.enabled .Values.server.observability.prometheus.istio_alerting_rules.enabled) }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ template "application.server.name" . }}
namespace: {{ .Release.Namespace }}
spec:
groups:
{{- if .Values.server.observability.prometheus.rules.enabled }}
{{- if .Values.server.observability.prometheus.alerting_rules.enabled }}
- name: ServiceContainerResourceUsage
rules:
alerting_rules:
- alert: "HighServiceContainerCPUUsage"
expr: |
avg(
Expand All @@ -18,13 +17,13 @@ spec:
(kube_pod_container_resource_limits{ resource="cpu", container={{ .Values.server.name | quote }} })
)
* 100
> {{ .Values.server.observability.prometheus.rules.highCpuUsageThreshold }}
> {{ .Values.server.observability.prometheus.alerting_rules.highCpuUsageThreshold }}
for: 5m
labels:
severity: critical
annotations:
summary: "[{{ include "application.server.name" . | title }}] High CPU usage"
description: "[{{ include "application.server.name" . | title }}] 서비스의 최근 CPU 사용량이 {{ .Values.server.observability.prometheus.rules.highCpuUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"
description: "[{{ include "application.server.name" . | title }}] 서비스의 최근 CPU 사용량이 {{ .Values.server.observability.prometheus.alerting_rules.highCpuUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"

- alert: HighServiceContainerMemoryUsage
expr: |
Expand All @@ -33,18 +32,18 @@ spec:
/ on(pod)
(kube_pod_container_resource_limits{ resource="memory", container={{ .Values.server.name | quote }} })
) * 100
> {{ .Values.server.observability.prometheus.rules.highMemoryUsageThreshold }}
> {{ .Values.server.observability.prometheus.alerting_rules.highMemoryUsageThreshold }}
for: 5m
labels:
service: {{ include "application.server.name" . | quote }}
severity: critical
annotations:
summary: "[{{ include "application.server.name" . | title }}] High memory usage"
description: "[{{ include "application.server.name" . | title }}] 서비스의 최근 메모리 사용량이 {{ .Values.server.observability.prometheus.rules.highMemoryUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"
description: "[{{ include "application.server.name" . | title }}] 서비스의 최근 메모리 사용량이 {{ .Values.server.observability.prometheus.alerting_rules.highMemoryUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"
{{- end }}
{{- if .Values.server.observability.prometheus.istio_rules.enabled }}
{{- if .Values.server.observability.prometheus.istio_alerting_rules.enabled }}
- name: IstioContainerResourceUsage
rules:
alerting_rules:
- alert: "HighIstioContainerCPUUsage"
expr: |
avg(
Expand All @@ -53,13 +52,13 @@ spec:
(kube_pod_container_resource_limits{ resource="cpu", container="istio-proxy" })
)
* 100
> {{ .Values.server.observability.prometheus.istio_rules.highCpuUsageThreshold }}
> {{ .Values.server.observability.prometheus.istio_alerting_rules.highCpuUsageThreshold }}
for: 5m
labels:
severity: critical
annotations:
summary: "[{{ include "application.server.name" . | title }}][istio-proxy] High CPU usage"
description: "[{{ include "application.server.name" . | title }}][istio-proxy] 서비스의 최근 CPU 사용량이 {{ .Values.server.observability.prometheus.istio_rules.highCpuUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"
description: "[{{ include "application.server.name" . | title }}][istio-proxy] 서비스의 최근 CPU 사용량이 {{ .Values.server.observability.prometheus.istio_alerting_rules.highCpuUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"

- alert: HighIstioContainerMemoryUsage
expr: |
Expand All @@ -68,14 +67,13 @@ spec:
/ on(pod)
(kube_pod_container_resource_limits{ resource="memory", container="istio-proxy" })
) * 100
> {{ .Values.server.observability.prometheus.istio_rules.highMemoryUsageThreshold }}
> {{ .Values.server.observability.prometheus.istio_alerting_rules.highMemoryUsageThreshold }}
for: 5m
labels:
service: {{ include "application.server.name" . | quote }}
severity: critical
annotations:
summary: "[{{ include "application.server.name" . | title }}][istio-proxy] High memory usage"
description: "[{{ include "application.server.name" . | title }}][istio-proxy] 서비스의 최근 메모리 사용량이 {{ .Values.server.observability.prometheus.istio_rules.highMemoryUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"
description: "[{{ include "application.server.name" . | title }}][istio-proxy] 서비스의 최근 메모리 사용량이 {{ .Values.server.observability.prometheus.istio_alerting_rules.highMemoryUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"
{{- end }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/application-template/templates/service_monitor.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.global.observability.prometheus.serviceMonitor.enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1/ServiceMonitor") }}
{{- if .Values.global.observability.prometheus.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1/PrometheusRule" }}
{{- if and .Values.worker.enabled (or .Values.worker.observability.prometheus.alerting_rules.enabled .Values.worker.observability.prometheus.istio_alerting_rules.enabled) }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
Expand Down Expand Up @@ -78,4 +77,3 @@ spec:
description: "[{{ include "application.worker.name" . | title }}][istio-proxy] 서비스의 최근 메모리 사용량이 {{ .Values.worker.observability.prometheus.istio_alerting_rules.highMemoryUsageThreshold }}% 이상이 되었습니다. 현재값: {{`{{ .Value | humanize }}`}}%"
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 59d307a

Please sign in to comment.