From 71f25ebd0a0b6604dbc5d48e8cebe72459f26806 Mon Sep 17 00:00:00 2001 From: Bigli <9610820+TheBigLee@users.noreply.github.com> Date: Fri, 17 Nov 2023 12:52:55 +0100 Subject: [PATCH] Update component/component/common.libsonnet --- component/component/common.libsonnet | 8 ++++---- .../vshn/appcat/appcat/21_composition_vshn_postgres.yaml | 8 ++++---- .../appcat/21_composition_vshn_postgresrestore.yaml | 8 ++++---- .../vshn/appcat/appcat/21_composition_vshn_redis.yaml | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/component/component/common.libsonnet b/component/component/common.libsonnet index e1b950c0a..2e6be9510 100644 --- a/component/component/common.libsonnet +++ b/component/component/common.libsonnet @@ -200,9 +200,9 @@ local generatePrometheusNonSLORules(serviceName, memoryContainerName, additional }, forProvider+: { manifest+: { + apiVersion: 'monitoring.coreos.com/v1', + kind: 'PrometheusRule', metadata: { - apiVersion: 'monitoring.coreos.com/v1', - kind: 'PrometheusRule', name: '%s-rules' % serviceNameLower, }, spec: { @@ -242,11 +242,11 @@ local generatePrometheusNonSLORules(serviceName, memoryContainerName, additional alert: serviceName + 'MemoryCritical', name: std.asciiLower(serviceName) + '-memory', annotations: { - description: 'The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 90% for 2 hours.\n Please reducde the load of this instance, or increase the memory.', + description: 'The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 85% for 2 hours.\n Please reducde the load of this instance, or increase the memory.', // runbook_url: 'TBD', summary: 'Memory usage critical', }, - expr: std.strReplace(topPod('(container_memory_working_set_bytes{container="%s"} / on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"} * 100) > 90') % memoryContainerName, toReplace, 'vshn-' + serviceNameLower), + expr: std.strReplace(topPod('(container_memory_working_set_bytes{container="%s"} / on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"} * 100) > 85') % memoryContainerName, toReplace, 'vshn-' + serviceNameLower), 'for': '120m', labels: { severity: 'critical', diff --git a/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_postgres.yaml b/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_postgres.yaml index 1d04032f5..cec83ca65 100644 --- a/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_postgres.yaml +++ b/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_postgres.yaml @@ -954,9 +954,9 @@ spec: spec: forProvider: manifest: + apiVersion: monitoring.coreos.com/v1 + kind: PrometheusRule metadata: - apiVersion: monitoring.coreos.com/v1 - kind: PrometheusRule name: postgresql-rules spec: groups: @@ -1006,12 +1006,12 @@ spec: - alert: PostgreSQLMemoryCritical annotations: description: |- - The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 90% for 2 hours. + The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 85% for 2 hours. Please reducde the load of this instance, or increase the memory. summary: Memory usage critical expr: label_replace( topk(1, (container_memory_working_set_bytes{container="patroni"} / on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"} - * 100) > 90) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace) + * 100) > 85) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace) kube_namespace_labels, "name", "$1", "namespace", "vshn-postgresql-(.+)-.+") for: 120m labels: diff --git a/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_postgresrestore.yaml b/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_postgresrestore.yaml index 0ebad1b20..04e97c2e4 100644 --- a/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_postgresrestore.yaml +++ b/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_postgresrestore.yaml @@ -1056,9 +1056,9 @@ spec: spec: forProvider: manifest: + apiVersion: monitoring.coreos.com/v1 + kind: PrometheusRule metadata: - apiVersion: monitoring.coreos.com/v1 - kind: PrometheusRule name: postgresql-rules spec: groups: @@ -1108,12 +1108,12 @@ spec: - alert: PostgreSQLMemoryCritical annotations: description: |- - The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 90% for 2 hours. + The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 85% for 2 hours. Please reducde the load of this instance, or increase the memory. summary: Memory usage critical expr: label_replace( topk(1, (container_memory_working_set_bytes{container="patroni"} / on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"} - * 100) > 90) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace) + * 100) > 85) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace) kube_namespace_labels, "name", "$1", "namespace", "vshn-postgresql-(.+)-.+") for: 120m labels: diff --git a/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_redis.yaml b/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_redis.yaml index 9dc04aa3c..e32e8dc3c 100644 --- a/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_redis.yaml +++ b/component/tests/golden/vshn/appcat/appcat/21_composition_vshn_redis.yaml @@ -91,9 +91,9 @@ spec: spec: forProvider: manifest: + apiVersion: monitoring.coreos.com/v1 + kind: PrometheusRule metadata: - apiVersion: monitoring.coreos.com/v1 - kind: PrometheusRule name: redis-rules spec: groups: @@ -143,12 +143,12 @@ spec: - alert: redisMemoryCritical annotations: description: |- - The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 90% for 2 hours. + The memory claimed by the instance {{ $labels.name }} in namespace {{ $labels.label_appcat_vshn_io_claim_namespace }} has been over 85% for 2 hours. Please reducde the load of this instance, or increase the memory. summary: Memory usage critical expr: label_replace( topk(1, (container_memory_working_set_bytes{container="redis"} / on(container,pod,namespace) kube_pod_container_resource_limits{resource="memory"} - * 100) > 90) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace) + * 100) > 85) * on(namespace) group_left(label_appcat_vshn_io_claim_namespace) kube_namespace_labels, "name", "$1", "namespace", "vshn-redis-(.+)-.+") for: 120m labels: