Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/helm_lib/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
type: library
name: deckhouse_lib_helm
version: 1.68.1
version: 1.68.2
description: "Helm utils template definitions for Deckhouse modules."
16 changes: 9 additions & 7 deletions charts/helm_lib/templates/_monitoring_prometheus_rules.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

{{- if gt (len .) 3 }} {{- $currentDir = index . 3 }} {{- else }} {{- $currentDir = $rootDir }} {{- end }}
{{- if gt (len .) 4 }} {{- $fileList = index . 4 }} {{- end }}

{{- $currentDirIndex := (sub ($currentDir | splitList "/" | len) 1) }}
{{- $rootDirIndex := (sub ($rootDir | splitList "/" | len) 1) }}
{{- $folderNamesIndex := (add1 $rootDirIndex) }}
Expand All @@ -22,7 +22,7 @@
{{- if gt (len $fileList) 0 }}
{{- $shouldProcess = has $path $fileList }}
{{- end }}

{{- if $shouldProcess }}
{{- $fileName := ($path | splitList "/" | last ) }}
{{- $definition := "" }}
Expand Down Expand Up @@ -62,9 +62,10 @@
{{- $useObservabilityRules := has "observability.deckhouse.io/v1alpha1/ClusterObservabilityMetricsRulesGroup" $context.Values.global.discovery.apiVersions }}
{{- if and $hasObservabilityModule $useObservabilityRules }}
{{- range $idx, $group := $definitionStruct.Rules }}
{{- $_ := unset $group "name" }}
{{- $resourceName = $resourceName | replace "propagated-" "" }}
{{- $groupResourceName := printf "%s-%d" $resourceName $idx }}
{{- if $group.rules }}
{{- $_ := unset $group "name" }}
{{- $resourceName = $resourceName | replace "propagated-" "" }}
{{- $groupResourceName := printf "%s-%d" $resourceName $idx }}
---
apiVersion: observability.deckhouse.io/v1alpha1
kind: {{ $propagated | ternary "ClusterObservabilityPropagatedMetricsRulesGroup" "ClusterObservabilityMetricsRulesGroup" }}
Expand All @@ -73,6 +74,7 @@ metadata:
{{- include "helm_lib_module_labels" (list $context (dict "app" "prometheus" "prometheus" "main" "component" "rules")) | nindent 2 }}
spec:
{{- $group | toYaml | nindent 2 }}
{{- end }}
{{- end }}
{{- else }}
{{- if $definitionStruct.Rules }}
Expand All @@ -87,7 +89,7 @@ metadata:
spec:
groups:
{{- $definition | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand Down Expand Up @@ -130,4 +132,4 @@ spec:
{{- else -}}
{{ $timeout }}s
{{- end }}
{{- end }}
{{- end }}