From 49e8803addf08bb3c988d2297d1f74fb46419e27 Mon Sep 17 00:00:00 2001 From: Szymon Bezpalko Date: Tue, 19 Apr 2022 08:25:14 +0200 Subject: [PATCH 1/8] Added rules directory --- chart/elastalert2/README.md | 1 + chart/elastalert2/templates/config.yaml | 2 +- chart/elastalert2/values.yaml | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/chart/elastalert2/README.md b/chart/elastalert2/README.md index 1375793a..5245a69a 100644 --- a/chart/elastalert2/README.md +++ b/chart/elastalert2/README.md @@ -56,6 +56,7 @@ The command removes all the Kubernetes components associated with the chart and | `command` | command override for container | `NULL` | | `args` | args override for container | `NULL` | | `replicaCount` | number of replicas to run | 1 | +| `rulesFolder` | Locaton of rules directory | /opt/elastalert/rules | | `elasticsearch.host` | elasticsearch endpoint to use | elasticsearch | | `elasticsearch.port` | elasticsearch port to use | 9200 | | `elasticsearch.useSsl` | whether or not to connect to es_host using SSL | False | diff --git a/chart/elastalert2/templates/config.yaml b/chart/elastalert2/templates/config.yaml index f0415eb3..91d80dcd 100644 --- a/chart/elastalert2/templates/config.yaml +++ b/chart/elastalert2/templates/config.yaml @@ -11,7 +11,7 @@ metadata: data: elastalert_config: |- --- - rules_folder: /opt/elastalert/rules + rules_folder: {{ default .Values.rulesFolder | default "/opt/elastalert/rules" }} {{- if .Values.scanSubdirectories }} scan_subdirectories: {{ .Values.scanSubdirectories }} {{- end }} diff --git a/chart/elastalert2/values.yaml b/chart/elastalert2/values.yaml index 775480f7..b71a86f3 100644 --- a/chart/elastalert2/values.yaml +++ b/chart/elastalert2/values.yaml @@ -7,6 +7,9 @@ revisionHistoryLimit: 5 # Default internal between alert checks against the elasticsearch datasource, in minutes runIntervalMins: 1 +# Location of directory where rules reside +rulesFolder: "" + # Enable/disabe subdirectory scanning for rules scanSubdirectories: true From a38d97777b165b4ed49928f937634bcd70c97106 Mon Sep 17 00:00:00 2001 From: Szymon Bezpalko Date: Tue, 19 Apr 2022 08:26:24 +0200 Subject: [PATCH 2/8] Bumped version --- chart/elastalert2/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart/elastalert2/Chart.yaml b/chart/elastalert2/Chart.yaml index eaf0c713..a3488d44 100644 --- a/chart/elastalert2/Chart.yaml +++ b/chart/elastalert2/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Automated rule-based alerting for Elasticsearch name: elastalert2 -version: 2.4.0 +version: 2.4.1 appVersion: 2.4.0 home: https://github.com/jertel/elastalert2 sources: From d8b1fbe8adfc0246c48aec11e03956d535fe8f2b Mon Sep 17 00:00:00 2001 From: Szymon Bezpalko Date: Tue, 19 Apr 2022 08:28:57 +0200 Subject: [PATCH 3/8] Set default value --- chart/elastalert2/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart/elastalert2/values.yaml b/chart/elastalert2/values.yaml index b71a86f3..3cfb9428 100644 --- a/chart/elastalert2/values.yaml +++ b/chart/elastalert2/values.yaml @@ -8,7 +8,7 @@ revisionHistoryLimit: 5 runIntervalMins: 1 # Location of directory where rules reside -rulesFolder: "" +rulesFolder: "/opt/elastalert/rules" # Enable/disabe subdirectory scanning for rules scanSubdirectories: true From 127072e2600c101a938aff4046c87f38f115672b Mon Sep 17 00:00:00 2001 From: Szymon Bezpalko Date: Tue, 19 Apr 2022 08:31:51 +0200 Subject: [PATCH 4/8] Adjusted deployment --- chart/elastalert2/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart/elastalert2/templates/deployment.yaml b/chart/elastalert2/templates/deployment.yaml index 1dc9a03c..96c9427d 100644 --- a/chart/elastalert2/templates/deployment.yaml +++ b/chart/elastalert2/templates/deployment.yaml @@ -57,7 +57,7 @@ spec: mountPath: '/opt/elastalert/config.yaml' subPath: config.yaml - name: {{ .Values.rulesVolumeName }} - mountPath: '/opt/elastalert/rules' + mountPath: {{ default .Values.rulesFolder | default "/opt/elastalert/rules" }} {{- if .Values.elasticsearch.certsVolumeMounts }} {{ toYaml .Values.elasticsearch.certsVolumeMounts | indent 10 }} {{- end }} From 1a6f67fe2c54b7d24bd19fa6bae3a4917baae93d Mon Sep 17 00:00:00 2001 From: Szymon Bezpalko Date: Tue, 19 Apr 2022 08:51:47 +0200 Subject: [PATCH 5/8] Updated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5a3f8a6..ba436d25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - TBD - [#000](https://github.com/jertel/elastalert2/pull/000) - @some_elastic_contributor_tbd ## Other changes -- None +- [Kubernetes] Add support to specify rules directory - [#816](https://github.com/jertel/elastalert2/pull/816) @SBe # 2.x.x From b064a5bbdcea6a56ff9b05fb324a1bbe200c2e89 Mon Sep 17 00:00:00 2001 From: Szymon Bezpalko Date: Tue, 19 Apr 2022 13:10:32 +0200 Subject: [PATCH 6/8] Adjusted comments --- CHANGELOG.md | 3 ++- chart/elastalert2/Chart.yaml | 2 +- chart/elastalert2/templates/deployment.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15e2f3ce..6d38bde2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - TBD - [#000](https://github.com/jertel/elastalert2/pull/000) - @some_elastic_contributor_tbd ## Other changes -- [Kubernetes] Add support to specify rules directory - [#816](https://github.com/jertel/elastalert2/pull/816) @SBe +- None # 2.x.x @@ -36,6 +36,7 @@ - Upgrade pylint 2.13.4 to 2.13.5 - [#808](https://github.com/jertel/elastalert2/pull/808) - @nsano-rururu - Update documentation on Cloud ID support - [#810](https://github.com/jertel/elastalert2/pull/810) - @ferozsalam - Upgrade tox 3.24.5 to 3.25.0 - [#813](https://github.com/jertel/elastalert2/pull/813) - @nsano-rururu +- [Kubernetes] Add support to specify rules directory - [#816](https://github.com/jertel/elastalert2/pull/816) @SBe # 2.4.0 diff --git a/chart/elastalert2/Chart.yaml b/chart/elastalert2/Chart.yaml index a3488d44..eaf0c713 100644 --- a/chart/elastalert2/Chart.yaml +++ b/chart/elastalert2/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Automated rule-based alerting for Elasticsearch name: elastalert2 -version: 2.4.1 +version: 2.4.0 appVersion: 2.4.0 home: https://github.com/jertel/elastalert2 sources: diff --git a/chart/elastalert2/templates/deployment.yaml b/chart/elastalert2/templates/deployment.yaml index 96c9427d..536f3f63 100644 --- a/chart/elastalert2/templates/deployment.yaml +++ b/chart/elastalert2/templates/deployment.yaml @@ -57,7 +57,7 @@ spec: mountPath: '/opt/elastalert/config.yaml' subPath: config.yaml - name: {{ .Values.rulesVolumeName }} - mountPath: {{ default .Values.rulesFolder | default "/opt/elastalert/rules" }} + mountPath: "/opt/elastalert/rules" {{- if .Values.elasticsearch.certsVolumeMounts }} {{ toYaml .Values.elasticsearch.certsVolumeMounts | indent 10 }} {{- end }} From 7888fc6cffc1f6abe288bd2cc9cf959b25d645ca Mon Sep 17 00:00:00 2001 From: Szymon Bezpalko Date: Tue, 19 Apr 2022 13:55:44 +0200 Subject: [PATCH 7/8] applying comments --- chart/elastalert2/templates/config.yaml | 2 +- chart/elastalert2/templates/deployment.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chart/elastalert2/templates/config.yaml b/chart/elastalert2/templates/config.yaml index 91d80dcd..da2749df 100644 --- a/chart/elastalert2/templates/config.yaml +++ b/chart/elastalert2/templates/config.yaml @@ -11,7 +11,7 @@ metadata: data: elastalert_config: |- --- - rules_folder: {{ default .Values.rulesFolder | default "/opt/elastalert/rules" }} + rules_folder: {{ .Values.rulesFolder }} {{- if .Values.scanSubdirectories }} scan_subdirectories: {{ .Values.scanSubdirectories }} {{- end }} diff --git a/chart/elastalert2/templates/deployment.yaml b/chart/elastalert2/templates/deployment.yaml index 536f3f63..8ca92830 100644 --- a/chart/elastalert2/templates/deployment.yaml +++ b/chart/elastalert2/templates/deployment.yaml @@ -57,7 +57,7 @@ spec: mountPath: '/opt/elastalert/config.yaml' subPath: config.yaml - name: {{ .Values.rulesVolumeName }} - mountPath: "/opt/elastalert/rules" + mountPath: {{ .Values.rulesFolder }} {{- if .Values.elasticsearch.certsVolumeMounts }} {{ toYaml .Values.elasticsearch.certsVolumeMounts | indent 10 }} {{- end }} From b871a4e80d473b93d9ada15da90b0403b5b48c2a Mon Sep 17 00:00:00 2001 From: Szymon Bezpalko Date: Tue, 19 Apr 2022 14:11:09 +0200 Subject: [PATCH 8/8] Added readme --- chart/elastalert2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart/elastalert2/README.md b/chart/elastalert2/README.md index 5245a69a..d4d549b4 100644 --- a/chart/elastalert2/README.md +++ b/chart/elastalert2/README.md @@ -56,7 +56,7 @@ The command removes all the Kubernetes components associated with the chart and | `command` | command override for container | `NULL` | | `args` | args override for container | `NULL` | | `replicaCount` | number of replicas to run | 1 | -| `rulesFolder` | Locaton of rules directory | /opt/elastalert/rules | +| `rulesFolder` | Locaton of rules directory. Usefull when you have one docker image and different set on rules per environemnt. For example development can reside in `/opt/elastalert/develop` and production in `/opt/elastalert/production`. | /opt/elastalert/rules | | `elasticsearch.host` | elasticsearch endpoint to use | elasticsearch | | `elasticsearch.port` | elasticsearch port to use | 9200 | | `elasticsearch.useSsl` | whether or not to connect to es_host using SSL | False |