Skip to content

Commit d45f373

Browse files
authored
fix(argus): handle empty cf list and trimmed collector props (#85)
1 parent 17d86a4 commit d45f373

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

charts/argus/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ maintainers:
1111
1212
name: LogicMonitor
1313
name: argus
14-
version: 2.2.0-rc05
14+
version: 2.2.0-rc06
1515
home: https://logicmonitor.github.io/helm-charts-qa
1616
appVersion: v8.2.0-rc1

charts/argus/templates/_collector_conf.tpl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,31 @@
1111
trimmedCollectorAgentConf:
1212
{{- toYaml $propList | nindent 2 }}
1313
{{- end }}
14+
{{- end }}
15+
16+
17+
{{ define "collector-conf" }}
18+
{{ $result := list }}
19+
20+
{{- $keys := dict }}
21+
{{- range .Values.collector.collectorConf.agentConf }}
22+
{{- $_ := set $keys .key true }}
23+
{{- end }}
24+
25+
{{- if gt (len .Values.collector.collectorConf.agentConf) 0 }}
26+
{{- $result = (concat $result .Values.collector.collectorConf.agentConf | uniq ) }}
27+
{{- end }}
28+
29+
{{- if not .Values.collector.disableLightweightCollector }}
30+
{{- $abc := include "trimmed-collector-config-agentConf" . | fromYaml }}
31+
{{- $trimmedList := get $abc "trimmedCollectorAgentConf" }}
32+
{{- range $trimmedList }}
33+
{{- if not (hasKey $keys .key) }}
34+
{{- $result = append $result . }}
35+
{{- end }}
36+
{{- end }}
37+
{{- end }}
38+
39+
resultList:
40+
{{- toYaml $result | nindent 2 }}
1441
{{- end }}

charts/argus/templates/collector-conf.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ metadata:
1414
data:
1515
collector-conf.yaml: |
1616
agentConf:
17-
{{- if not .Values.collector.disableLightweightCollector }}
18-
{{- $abc := include "trimmed-collector-config-agentConf" . | fromYaml }}
19-
{{- get $abc "trimmedCollectorAgentConf" | toYaml | nindent 6 }}
20-
{{- end }}
21-
{{- toYaml .Values.collector.collectorConf.agentConf | nindent 6 }}
17+
{{- $abc := include "collector-conf" . | fromYaml }}
18+
{{- $result := get $abc "resultList" }}
19+
{{- toYaml $result | nindent 6 }}

0 commit comments

Comments
 (0)