From ff684c0776d0f38b3adb8eb1fe82327d04453b4a Mon Sep 17 00:00:00 2001 From: Vaibhav Kumbhar Date: Tue, 20 Sep 2022 14:55:42 +0530 Subject: [PATCH] feat(argus,csc): accept agent.conf customizations for collector (#78) --- charts/argus/Chart.yaml | 2 +- charts/argus/templates/_collector_conf.tpl | 14 +++ charts/argus/templates/collector-conf.yaml | 21 ++++ charts/argus/templates/collectorset.yaml | 1 + charts/argus/values.schema.json | 104 ++++++++++++++++++ charts/argus/values.yaml | 6 +- charts/collectorset-controller/Chart.yaml | 4 +- .../crds/collectorset.yaml | 2 + 8 files changed, 149 insertions(+), 5 deletions(-) create mode 100644 charts/argus/templates/_collector_conf.tpl create mode 100644 charts/argus/templates/collector-conf.yaml diff --git a/charts/argus/Chart.yaml b/charts/argus/Chart.yaml index 45d6325..17931d0 100644 --- a/charts/argus/Chart.yaml +++ b/charts/argus/Chart.yaml @@ -11,6 +11,6 @@ maintainers: - email: argus@logicmonitor.com name: LogicMonitor name: argus -version: 2.2.0-rc04 +version: 2.2.0-rc05 home: https://logicmonitor.github.io/helm-charts-qa appVersion: v8.2.0-rc1 diff --git a/charts/argus/templates/_collector_conf.tpl b/charts/argus/templates/_collector_conf.tpl new file mode 100644 index 0000000..5f79faa --- /dev/null +++ b/charts/argus/templates/_collector_conf.tpl @@ -0,0 +1,14 @@ +{{/* vim: set filetype=mustache: */}} + +{{- define "trimmed-collector-config-agentConf" -}} +{{- $trimmedCollectorProps := list "jdbc" "perfmon" "wmi" "netapp" "esx" "xen" "mongo" "wineventlog" "snmptrap" "syslog"}} +{{- $propList := list }} +{{- range $val := $trimmedCollectorProps }} +{{- $kv := dict}} +{{- $_ := set $kv "key" (printf "collector.%s.enable" $val) }} +{{- $_1 := set $kv "value" "false" }} +{{- $propList = append $propList $kv }} +trimmedCollectorAgentConf: +{{- toYaml $propList | nindent 2 }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/argus/templates/collector-conf.yaml b/charts/argus/templates/collector-conf.yaml new file mode 100644 index 0000000..a04cfd8 --- /dev/null +++ b/charts/argus/templates/collector-conf.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "argus.fullname" . }}-collector + namespace: {{ template "argus.namespace" . }} + labels: + {{- include "argus.labels" . | nindent 4 }} + annotations: + helm-chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + helm-revision: "{{ .Release.Revision }}" + ## keep value false as string, spinnaker's limitation, otherwise spinnaker fails to cast boolean to string + strategy.spinnaker.io/versioned: "false" + {{- include "argus.annotations" . | nindent 4 }} +data: + collector-conf.yaml: | + agentConf: + {{- if not .Values.collector.disableLightweightCollector }} + {{- $abc := include "trimmed-collector-config-agentConf" . | fromYaml }} + {{- get $abc "trimmedCollectorAgentConf" | toYaml | nindent 6 }} + {{- end }} + {{- toYaml .Values.collector.collectorConf.agentConf | nindent 6 }} \ No newline at end of file diff --git a/charts/argus/templates/collectorset.yaml b/charts/argus/templates/collectorset.yaml index 5e30d5e..d76acec 100644 --- a/charts/argus/templates/collectorset.yaml +++ b/charts/argus/templates/collectorset.yaml @@ -53,3 +53,4 @@ spec: {{ toYaml .Values.collector.statefulsetSpec | nindent 4 }} {{- end }} probe: {{ toYaml .Values.collector.probe | nindent 4 }} + collectorConfigMapName: {{ include "argus.fullname" . }}-collector diff --git a/charts/argus/values.schema.json b/charts/argus/values.schema.json index 7630509..35c1c83 100644 --- a/charts/argus/values.schema.json +++ b/charts/argus/values.schema.json @@ -1916,6 +1916,25 @@ } }, "additionalProperties": false + }, + "disableLightweightCollector": { + "$id": "#/properties/collector/properties/enableLightweightCollector", + "type": "boolean", + "default": false + }, + "collectorConf": { + "$id": "#/properties/collector/properties/collectorConf", + "type": "object", + "properties": { + "agentConf": { + "type": "array", + "items": { + "$ref": "#/definitions/collectorConfKeyVal" + }, + "uniqueItems": true + } + }, + "additionalProperties": false } }, "additionalProperties": false @@ -2310,6 +2329,91 @@ }, "additionalProperties": false, "definitions": { + "collectorConfKeyVal": { + "if": { + "properties": { + "discrete": { + "type": "boolean", + "enum": [ + false + ] + } + } + }, + "then": { + "additionalProperties": false, + "properties": { + "discrete": { + "type": "boolean" + }, + "value": { + "type": [ + "object", + "number", + "null", + "integer", + "array", + "boolean", + "string" + ] + }, + "key": { + "type": "string", + "minLength": 1 + }, + "dontOverride": { + "type": "boolean" + }, + "coalesceFormat": { + "enum": [ + "", + "csv", + "json", + "pipe" + ], + "default": "" + } + } + }, + "else": { + "additionalProperties": false, + "properties": { + "discrete": { + "type": "boolean" + }, + "values": { + "type": "array", + "items": { + "type": [ + "object", + "number", + "null", + "integer", + "array", + "boolean", + "string" + ] + } + }, + "key": { + "type": "string", + "minLength": 1 + }, + "dontOverride": { + "type": "boolean" + }, + "coalesceFormat": { + "enum": [ + "", + "csv", + "json", + "pipe" + ], + "default": "" + } + } + } + }, "toleration": { "oneOf": [ { diff --git a/charts/argus/values.yaml b/charts/argus/values.yaml index c1eb683..3e16036 100644 --- a/charts/argus/values.yaml +++ b/charts/argus/values.yaml @@ -138,8 +138,10 @@ collector: pullPolicy: "" ## OPTIONAL VALUES - # On a collector downloading event, either download the latest EA version or the latest GD version. - + disableLightweightCollector: false + # collector application configuration such as agent.conf + collectorConf: + agentConf: [] # The Http/s proxy url of the collectors. proxy: url: "" diff --git a/charts/collectorset-controller/Chart.yaml b/charts/collectorset-controller/Chart.yaml index 722bfc3..978f5f5 100644 --- a/charts/collectorset-controller/Chart.yaml +++ b/charts/collectorset-controller/Chart.yaml @@ -6,6 +6,6 @@ maintainers: - email: argus@logicmonitor.com name: LogicMonitor name: collectorset-controller -version: 1.1.0-rc05 +version: 1.1.0-rc06 home: https://logicmonitor.github.io/helm-charts-qa -appVersion: v4.1.0-rc2 +appVersion: v4.1.0-rc3 diff --git a/charts/collectorset-controller/crds/collectorset.yaml b/charts/collectorset-controller/crds/collectorset.yaml index 79864e8..8439a9e 100644 --- a/charts/collectorset-controller/crds/collectorset.yaml +++ b/charts/collectorset-controller/crds/collectorset.yaml @@ -1141,6 +1141,8 @@ spec: invalid. For ex: 29.101 is invalid, correct input is 29101)' minimum: 0 type: integer + collectorConfigMapName: + type: string required: - replicas - clusterName