diff --git a/helm/.helmignore b/helm/.helmignore index 0e8a0eb3..8150aec8 100644 --- a/helm/.helmignore +++ b/helm/.helmignore @@ -21,3 +21,5 @@ .idea/ *.tmproj .vscode/ +# Dir with local binaries +bin diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 29fc5465..a8d9c2e1 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: sql-exporter description: Database agnostic SQL exporter for Prometheus type: application -version: 0.2.3 +version: 0.2.4 appVersion: 0.13.0 keywords: - exporter diff --git a/helm/README.md b/helm/README.md index 8164b36a..2fb0f0fa 100644 --- a/helm/README.md +++ b/helm/README.md @@ -1,6 +1,6 @@ # sql-exporter -![Version: 0.2.2](https://img.shields.io/badge/Version-0.2.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.13.0](https://img.shields.io/badge/AppVersion-0.13.0-informational?style=flat-square) +![Version: 0.2.4](https://img.shields.io/badge/Version-0.2.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.13.0](https://img.shields.io/badge/AppVersion-0.13.0-informational?style=flat-square) Database agnostic SQL exporter for Prometheus @@ -72,4 +72,4 @@ It's also possible to define collectors (i.e. metrics and queries) in separate f ## Dev Notes -After updating default `Values`, please execute `make gen_docs` to update the `README.md` file +After changing default `Values`, please execute `make gen_docs` to update the `README.md` file. Readme file is generated by the `helm-docs` tool, so make sure not to edit it manually. diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 4636513c..7de0a158 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -54,6 +54,26 @@ spec: readOnly: true mountPath: /etc/sql_exporter/collectors/ {{- end }} + {{- if .Values.env }} + env: + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + {{- if $value.value }} + value: {{ $value.value }} + {{- else }} + valueFrom: + {{- if eq $value.from.kind "Secret" }} + secretKeyRef: + {{- else if eq $value.from.kind "ConfigMap" }} + configMapKeyRef: + {{- else }} + {{- fail "Values.env[].from.kind should be either Secret or ConfigMap" }} + {{- end }} + name: {{ $value.from.name }} + key: {{ $value.from.key }} + {{- end }} + {{- end }} + {{- end }} livenessProbe: httpGet: path: /healthz diff --git a/helm/values.yaml b/helm/values.yaml index 72a942d9..148d323b 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -23,13 +23,15 @@ service: # -- Service labels labels: {} # -- Service annotations - annotations: {} + annotations: + {} # example of prometheus usage # prometheus.io/scrape: "true" # prometheus.io/path: "/metrics" # -- Resource limits and requests for the application controller pods -resources: {} +resources: + {} # limits: # cpu: 100m # memory: 128Mi @@ -43,7 +45,8 @@ podLabels: {} podAnnotations: {} # -- Pod security context -podSecurityContext: {} +podSecurityContext: + {} # capabilities: # drop: # - ALL @@ -64,6 +67,16 @@ serviceMonitor: # -- ServiceMonitor scrape timeout # scrapeTimeout: 10s +# Additional env variables +# - kind should be either Secret or ConfigMap +# - name is the name of the Secret or ConfigMap that should be used +# - key is the key of the object inside of a Secret or ConfigMap +# env: +# SQLEXPORTER_TARGET_DSN: +# from: +# kind: Secret +# name: sql_exporter_secret +# key: CONNECTION_STRING config: global: # -- Scrape timeout @@ -76,7 +89,6 @@ config: max_connections: 3 # -- Number of idle connections. max_idle_connections: 3 - # Target and collectors are not set so the chart is more flexible. Please configure it yourself. # target: # data_source_name: 'sqlserver://prom_user:prom_password@dbserver1.example.com:1433'