You've already forked prometheus-postgres-exporter
Compare commits
6 Commits
0.1.1
...
98fe8fe2a4
Author | SHA1 | Date | |
---|---|---|---|
98fe8fe2a4
|
|||
7d02c5f7b3
|
|||
cbdf696a4e
|
|||
42af0f9739
|
|||
5c0f2fb310
|
|||
c211bd7a61
|
@ -26,7 +26,7 @@ steps:
|
|||||||
- name: markdown lint
|
- name: markdown lint
|
||||||
commands:
|
commands:
|
||||||
- markdownlint *.md
|
- markdownlint *.md
|
||||||
image: git.cryptic.systems/volker.raschek/markdownlint:0.41.0
|
image: git.cryptic.systems/volker.raschek/markdownlint:0.42.0
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 150
|
cpu: 150
|
||||||
@ -187,7 +187,7 @@ steps:
|
|||||||
|
|
||||||
- name: release-helm-chart
|
- name: release-helm-chart
|
||||||
commands:
|
commands:
|
||||||
- helm repo add prometheus-exporters https://charts.cryptic.systems/prometheus-exporter
|
- helm repo add prometheus-exporters https://charts.cryptic.systems/prometheus-exporters
|
||||||
- helm package --version ${DRONE_TAG} .
|
- helm package --version ${DRONE_TAG} .
|
||||||
- helm cm-push ${DRONE_REPO_NAME}-${DRONE_TAG}.tgz prometheus-exporters
|
- helm cm-push ${DRONE_REPO_NAME}-${DRONE_TAG}.tgz prometheus-exporters
|
||||||
environment:
|
environment:
|
||||||
|
@ -10,8 +10,9 @@ appVersion: "0.15.0"
|
|||||||
|
|
||||||
keywords:
|
keywords:
|
||||||
- prometheus
|
- prometheus
|
||||||
- prometheus exporter
|
- prometheus-exporter
|
||||||
- postgres
|
- postgres-postgres-exporter
|
||||||
|
- postgres-exporter
|
||||||
|
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/prometheus-community/postgres_exporter
|
- https://github.com/prometheus-community/postgres_exporter
|
||||||
|
16
README.md
16
README.md
@ -29,9 +29,9 @@ chart is tested for deployment scenarios with ArgoCD.
|
|||||||
> time is not possible.
|
> time is not possible.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
helm repo add prometheus-exporter https://charts.cryptic.systems/prometheus-exporter
|
helm repo add prometheus-exporters https://charts.cryptic.systems/prometheus-exporters
|
||||||
helm repo update
|
helm repo update
|
||||||
helm install prometheus-exporter/prometheus-postgres-exporter prometheus-postgres-exporter \
|
helm install prometheus-exporters/prometheus-postgres-exporter prometheus-postgres-exporter \
|
||||||
--set 'config.database.secret.databaseUsername=postgres' \
|
--set 'config.database.secret.databaseUsername=postgres' \
|
||||||
--set 'config.database.secret.databasePassword=postgres' \
|
--set 'config.database.secret.databasePassword=postgres' \
|
||||||
--set 'config.database.secret.databaseConnectionUrl="postgres.example.local:5432/postgres?ssl=disable"' \
|
--set 'config.database.secret.databaseConnectionUrl="postgres.example.local:5432/postgres?ssl=disable"' \
|
||||||
@ -45,7 +45,7 @@ version of the chart must be in sync with the `values.yaml`. Newer *minor* versi
|
|||||||
versions can break something!
|
versions can break something!
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
helm show values prometheus-exporter/prometheus-postgres-exporter --version 0.1.0 > values.yaml
|
helm show values prometheus-exporters/prometheus-postgres-exporter --version 0.1.0 > values.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
A complete list of available helm chart versions can be displayed via the following command:
|
A complete list of available helm chart versions can be displayed via the following command:
|
||||||
@ -66,12 +66,12 @@ The following examples serve as individual configurations and as inspiration for
|
|||||||
The first example shows how to deploy the metric exporter with TLS encryption. The verification of the custom TLS
|
The first example shows how to deploy the metric exporter with TLS encryption. The verification of the custom TLS
|
||||||
certification will be skipped by Prometheus.
|
certification will be skipped by Prometheus.
|
||||||
|
|
||||||
> [!WARN]
|
> [!WARNING]
|
||||||
> A TLS secret with the name `prometheus-postgresql-exporter-http` containing a `ca.crt`, `tls.key` and `tls.crt` is
|
> The secret `prometheus-postgresql-exporter-http` containing the TLS certificate is already present. The keys `ca.crt`,
|
||||||
> already present.
|
> `tls.key` and `tls.crt` of the secret can be mounted into the container filesystem for TLS authentication / encryption.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
helm install prometheus-exporter/prometheus-postgres-exporter prometheus-postgres-exporter \
|
helm install prometheus-exporters/prometheus-postgres-exporter prometheus-postgres-exporter \
|
||||||
--set 'config.database.secret.databaseUsername=postgres' \
|
--set 'config.database.secret.databaseUsername=postgres' \
|
||||||
--set 'config.database.secret.databasePassword=postgres' \
|
--set 'config.database.secret.databasePassword=postgres' \
|
||||||
--set 'config.database.secret.databaseConnectionUrl="postgres.example.local:5432/postgres?ssl=disable"' \
|
--set 'config.database.secret.databaseConnectionUrl="postgres.example.local:5432/postgres?ssl=disable"' \
|
||||||
@ -94,7 +94,7 @@ certificate for the metrics exporter - TLS certificate verification can be enabl
|
|||||||
replaced:
|
replaced:
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
helm install prometheus-exporter/prometheus-postgres-exporter prometheus-postgres-exporter \
|
helm install prometheus-exporters/prometheus-postgres-exporter prometheus-postgres-exporter \
|
||||||
--set 'config.database.secret.databaseUsername=postgres' \
|
--set 'config.database.secret.databaseUsername=postgres' \
|
||||||
--set 'config.database.secret.databasePassword=postgres' \
|
--set 'config.database.secret.databasePassword=postgres' \
|
||||||
--set 'config.database.secret.databaseConnectionUrl="postgres.example.local:5432/postgres?ssl=disable"' \
|
--set 'config.database.secret.databaseConnectionUrl="postgres.example.local:5432/postgres?ssl=disable"' \
|
||||||
|
@ -50,10 +50,9 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/* volumeMounts */}}
|
{{/* volumeMounts */}}
|
||||||
|
|
||||||
{{- define "prometheus-postgres-exporter.deployment.volumeMounts" -}}
|
{{- define "prometheus-postgres-exporter.deployment.volumeMounts" -}}
|
||||||
{{- $volumeMounts := dict "volumeMounts" (.Values.deployment.postgresExporter.volumeMounts | default (list) ) }}
|
{{- $volumeMounts := dict "volumeMounts" (.Values.deployment.postgresExporter.volumeMounts | default (list) ) }}
|
||||||
{{- $volumeMounts = merge $volumeMounts (dict "volumeMounts" (list (dict "name" "exporter-config" "mountPath" "/etc/prometheus-postgres-exporter/config.d" ))) }}
|
{{- $volumeMounts = merge $volumeMounts (dict "volumeMounts" (list (dict "name" "config.d" "mountPath" "/etc/prometheus-postgres-exporter/config.d" ))) }}
|
||||||
{{ toYaml $volumeMounts }}
|
{{ toYaml $volumeMounts }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
@ -61,10 +60,18 @@
|
|||||||
|
|
||||||
{{- define "prometheus-postgres-exporter.deployment.volumes" -}}
|
{{- define "prometheus-postgres-exporter.deployment.volumes" -}}
|
||||||
{{- $volumes := dict "volumes" (.Values.deployment.volumes | default (list) ) }}
|
{{- $volumes := dict "volumes" (.Values.deployment.volumes | default (list) ) }}
|
||||||
{{- $secretName := .Values.config.exporterConfig.existingSecret.secretName -}}
|
|
||||||
{{- if not .Values.config.exporterConfig.existingSecret.enabled }}
|
{{- if and (not .Values.config.exporterConfig.existingSecret.enabled) (not .Values.config.webConfig.existingSecret.enabled) (not .Values.config.webConfig.secret.webConfig) }}
|
||||||
{{- $secretName = printf "%s-exporter-config" (include "prometheus-postgres-exporter.fullname" . ) }}
|
{{- $secretName = printf "%s-exporter-config" (include "prometheus-postgres-exporter.fullname" . ) }}
|
||||||
|
{{- $volumes = merge $volumes (dict "volumes" (list (dict "name" "config.d" "secret" (dict "secretName" $secretName)))) }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if and (not .Values.config.exporterConfig.existingSecret.enabled) (or .Values.config.webConfig.existingSecret.enabled .Values.config.webConfig.secret.webConfig) }}
|
||||||
|
{{- $exporterConfigSecretName = .Values.config.exporterConfig.existingSecret.secretName }}
|
||||||
|
{{- $webConfigSecretName = .Values.config.webConfig.existingSecret.secretName }}
|
||||||
|
|
||||||
|
{{- if -}}
|
||||||
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $volumes = merge $volumes (dict "volumes" (list (dict "name" "exporter-config" "secret" (dict "secretName" $secretName)))) }}
|
|
||||||
{{ toYaml $volumes }}
|
{{ toYaml $volumes }}
|
||||||
{{- end -}}
|
{{- end -}}
|
@ -23,7 +23,12 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: postgres-exporter
|
- name: postgres-exporter
|
||||||
args:
|
args:
|
||||||
|
{{- if or .Values.config.exporterConfig.existingSecret.enabled .Values.config.exporterConfig.secret.exporterConfig }}
|
||||||
- "--config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml"
|
- "--config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml"
|
||||||
|
{{- end }}
|
||||||
|
{{- if or .Values.config.webConfig.existingSecret.enabled .Values.config.webConfig.secret.webConfig }}
|
||||||
|
- "--web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml"
|
||||||
|
{{- end }}
|
||||||
- "--web.listen-address=:9187"
|
- "--web.listen-address=:9187"
|
||||||
{{- range .Values.deployment.postgresExporter.args }}
|
{{- range .Values.deployment.postgresExporter.args }}
|
||||||
- {{ . | quote }}
|
- {{ . | quote }}
|
||||||
|
@ -13,14 +13,13 @@ metadata:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}
|
name: {{ include "prometheus-postgres-exporter.fullname" . }}
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ .Release.Namespace }}
|
||||||
spec:
|
automountServiceAccountToken: {{ .Values.serviceAccount.new.automountServiceAccountToken }}
|
||||||
automountServiceAccountToken: {{ .Values.serviceAccount.new.automountServiceAccountToken }}
|
{{- with .Values.serviceAccount.new.imagePullSecrets }}
|
||||||
{{- with .Values.serviceAccount.new.imagePullSecrets }}
|
imagePullSecrets:
|
||||||
imagePullSecrets:
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- with .Values.serviceAccount.new.secrets }}
|
||||||
{{- with .Values.serviceAccount.new.secrets }}
|
secrets:
|
||||||
secrets:
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- end }}
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
@ -43,3 +43,82 @@ tests:
|
|||||||
content:
|
content:
|
||||||
secretRef:
|
secretRef:
|
||||||
name: custom-database-secret
|
name: custom-database-secret
|
||||||
|
|
||||||
|
- it: Test mount exporterConfig.yaml
|
||||||
|
set:
|
||||||
|
config.exporterConfig.existingSecret.enabled: false
|
||||||
|
config.exporterConfig.secret.exporterConfig:
|
||||||
|
foo: bar
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].args
|
||||||
|
value:
|
||||||
|
- --config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml
|
||||||
|
- --web.listen-address=:9187
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts
|
||||||
|
content:
|
||||||
|
mountPath: /etc/prometheus-postgres-exporter/config.d
|
||||||
|
name: config.d
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.volumes
|
||||||
|
content:
|
||||||
|
name: config.d
|
||||||
|
secret:
|
||||||
|
secretName: prometheus-postgres-exporter-unittest-exporter-config
|
||||||
|
|
||||||
|
- it: Test mount exporterConfig.yaml from secret
|
||||||
|
set:
|
||||||
|
config.exporterConfig.existingSecret.enabled: true
|
||||||
|
config.exporterConfig.existingSecret.secretName: my-secret
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].args
|
||||||
|
value:
|
||||||
|
- --config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml
|
||||||
|
- --web.listen-address=:9187
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts
|
||||||
|
content:
|
||||||
|
mountPath: /etc/prometheus-postgres-exporter/config.d
|
||||||
|
name: config.d
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.volumes
|
||||||
|
content:
|
||||||
|
name: config.d
|
||||||
|
secret:
|
||||||
|
secretName: my-secret
|
||||||
|
|
||||||
|
- it: Test mount webConfig.yaml
|
||||||
|
set:
|
||||||
|
config.webConfig.existingSecret.enabled: false
|
||||||
|
config.webConfig.secret.webConfig:
|
||||||
|
foo: bar
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].args
|
||||||
|
value:
|
||||||
|
- --web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml
|
||||||
|
- --web.listen-address=:9187
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts
|
||||||
|
content:
|
||||||
|
mountPath: /etc/prometheus-postgres-exporter/config.d
|
||||||
|
name: config.d
|
||||||
|
- contains:
|
||||||
|
path: spec.template.spec.volumes
|
||||||
|
content:
|
||||||
|
name: config.d
|
||||||
|
secret:
|
||||||
|
secretName: prometheus-postgres-exporter-unittest-web-config
|
||||||
|
|
||||||
|
# - it: Test mount webConfig.yaml from secret
|
||||||
|
# set:
|
||||||
|
# config.webConfig.existingSecret.enabled: true
|
||||||
|
# config.webConfig.existingSecret.secretName: my-secret
|
||||||
|
# asserts:
|
||||||
|
# - equal:
|
||||||
|
# path: spec.template.spec.containers[0].args
|
||||||
|
# value:
|
||||||
|
# - --web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml
|
||||||
|
# - --web.listen-address=:9187
|
@ -29,12 +29,12 @@ tests:
|
|||||||
- notExists:
|
- notExists:
|
||||||
path: metadata.labels
|
path: metadata.labels
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.automountServiceAccountToken
|
path: automountServiceAccountToken
|
||||||
value: true
|
value: true
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.imagePullSecrets
|
path: imagePullSecrets
|
||||||
- notExists:
|
- notExists:
|
||||||
path: spec.secrets
|
path: secrets
|
||||||
|
|
||||||
|
|
||||||
- it: Rendering serviceAccount with custom values.
|
- it: Rendering serviceAccount with custom values.
|
||||||
@ -65,14 +65,14 @@ tests:
|
|||||||
path: metadata.name
|
path: metadata.name
|
||||||
value: prometheus-postgres-exporter-unittest
|
value: prometheus-postgres-exporter-unittest
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.automountServiceAccountToken
|
path: automountServiceAccountToken
|
||||||
value: false
|
value: false
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.imagePullSecrets
|
path: imagePullSecrets
|
||||||
value:
|
value:
|
||||||
- name: "my-pull-secret"
|
- name: "my-pull-secret"
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.secrets
|
path: secrets
|
||||||
value:
|
value:
|
||||||
- name: "my-secret"
|
- name: "my-secret"
|
||||||
namespace: "my-namespace"
|
namespace: "my-namespace"
|
||||||
|
Reference in New Issue
Block a user