Skip to content

Commit

Permalink
Make it possible to skip mysql logs integration (#1218)
Browse files Browse the repository at this point in the history
* Make it possible to skip mysql logs integration

Signed-off-by: Pete Wall <[email protected]>

* Catch more instances

Signed-off-by: Pete Wall <[email protected]>

---------

Signed-off-by: Pete Wall <[email protected]>
  • Loading branch information
petewall authored Feb 9, 2025
1 parent 068117b commit 326e18c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
{{- $defaultValues := "integrations/mysql-values.yaml" | .Files.Get | fromYaml }}
{{- $logsEnabled := false }}
{{- range $instance := .Values.mysql.instances }}
{{- with merge $instance $defaultValues (dict "type" "integration.mysql") }}
{{- $logsEnabled = or $logsEnabled $instance.logs.enabled }}
{{- end }}
{{- $logsEnabled = or $logsEnabled (dig "logs" "enabled" true $instance) }}
{{- end }}
{{- $logsEnabled -}}
{{- end }}

{{- define "integrations.mysql.logs.discoveryRules" }}
{{- range $instance := $.Values.mysql.instances }}
{{- if $instance.logs.enabled }}
{{- if ne (dig "logs" "enabled" true $instance) false }}
{{- $labelList := list }}
{{- $valueList := list }}
{{- if .logs.namespaces }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tests:
auth:
username: db-admin
password: db-password
logs: {enabled: false}
asserts:
- template: configmap.yaml
isKind:
Expand Down Expand Up @@ -84,16 +85,19 @@ tests:
exporter:
dataSource:
host: database.test.svc
logs: {enabled: false}
- name: staging-db
exporter:
dataSourceName: "root:[email protected]:3306/"
logs: {enabled: false}
- name: prod-db
exporter:
dataSource:
host: database.prod.svc
auth:
username: db-admin
password: db-password
logs: {enabled: false}
asserts:
- template: configmap.yaml
isKind:
Expand Down Expand Up @@ -210,6 +214,7 @@ tests:
create: false
name: test-database-mysql
namespace: mysql
logs: {enabled: false}
asserts:
- template: configmap.yaml
isKind:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ integrations:
exporter:
dataSourceName: "root:[email protected]:3306/"
logs:
labelSelectors:
app.kubernetes.io/instance: staging-db
enabled: false

- name: prod-db
exporter:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ integrations:
exporter:
dataSourceName: "root:[email protected]:3306/"
logs:
labelSelectors:
app.kubernetes.io/instance: staging-db
enabled: false

- name: prod-db
exporter:
Expand Down

0 comments on commit 326e18c

Please sign in to comment.