From 59d307a5d8c672a9fd89bb920d86e5eb6fde8383 Mon Sep 17 00:00:00 2001 From: "Kim Hyunyoung, Abel" Date: Fri, 5 Apr 2024 18:50:39 +0900 Subject: [PATCH] =?UTF-8?q?fix(application-template):=20capability=20api?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0,=20=EC=98=A4=ED=83=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20(#18)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: typo * fix: remove capability api * fix: update chart version --- charts/application-template/Chart.yaml | 2 +- .../templates/scheduler/prometheus-rule.yaml | 2 -- .../templates/server/prometheus-rule.yaml | 28 +++++++++---------- .../templates/service_monitor.yaml | 2 +- .../templates/worker/prometheus-rule.yaml | 2 -- 5 files changed, 15 insertions(+), 21 deletions(-) diff --git a/charts/application-template/Chart.yaml b/charts/application-template/Chart.yaml index 6e8b411..0be76d0 100644 --- a/charts/application-template/Chart.yaml +++ b/charts/application-template/Chart.yaml @@ -9,4 +9,4 @@ maintainers: - name: modusign url: https://github.com/modusign name: application-template -version: 1.5.0 +version: 1.5.1 diff --git a/charts/application-template/templates/scheduler/prometheus-rule.yaml b/charts/application-template/templates/scheduler/prometheus-rule.yaml index 40b577b..ca7d77e 100644 --- a/charts/application-template/templates/scheduler/prometheus-rule.yaml +++ b/charts/application-template/templates/scheduler/prometheus-rule.yaml @@ -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 @@ -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 }} diff --git a/charts/application-template/templates/server/prometheus-rule.yaml b/charts/application-template/templates/server/prometheus-rule.yaml index 2f12afa..91bad31 100644 --- a/charts/application-template/templates/server/prometheus-rule.yaml +++ b/charts/application-template/templates/server/prometheus-rule.yaml @@ -1,5 +1,4 @@ -{{- 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: @@ -7,9 +6,9 @@ metadata: 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( @@ -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: | @@ -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( @@ -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: | @@ -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 }} diff --git a/charts/application-template/templates/service_monitor.yaml b/charts/application-template/templates/service_monitor.yaml index abad42c..87d9585 100644 --- a/charts/application-template/templates/service_monitor.yaml +++ b/charts/application-template/templates/service_monitor.yaml @@ -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: diff --git a/charts/application-template/templates/worker/prometheus-rule.yaml b/charts/application-template/templates/worker/prometheus-rule.yaml index 0fd7e79..89faa0b 100644 --- a/charts/application-template/templates/worker/prometheus-rule.yaml +++ b/charts/application-template/templates/worker/prometheus-rule.yaml @@ -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 @@ -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 }}