You've already forked prometheus-postgres-exporter
Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
7ea826a2a1
|
|||
aa8c279fe0
|
|||
dfd4c1f991
|
|||
d6c2e4f992
|
|||
ae7652a335
|
|||
16cfa36fda
|
|||
94fbc5e38f
|
|||
dcc7bae921
|
|||
503c622df5
|
|||
bf9bd4853f
|
|||
80a8e8096d
|
|||
79b61b0035
|
|||
d33b17b973 | |||
a0d241c90c
|
|||
1d061fe95f
|
|||
bb4a5d48b4
|
|||
1f6550d169
|
|||
a01c7d8c45
|
|||
2dd99e8b13
|
|||
4945cd1c2e
|
|||
ed10c5362a
|
|||
70abc21fb4
|
|||
8618b52ef6
|
|||
967d36cafb
|
|||
8f36f688d0
|
|||
8d1f6622b8
|
|||
bd04d4a349
|
|||
3105f2a408
|
|||
3a96e4ac5d
|
|||
abd73d82f2
|
|||
19b5ac5969
|
|||
7b98e68b03
|
|||
6c30756f8d
|
|||
688718008f
|
|||
be0e152de8
|
|||
4edf2660de
|
|||
c1a2a098c8
|
|||
085a68c60c
|
|||
98fe8fe2a4
|
|||
7d02c5f7b3
|
|||
cbdf696a4e
|
|||
42af0f9739
|
|||
5c0f2fb310
|
14
.drone.yml
14
.drone.yml
@ -12,7 +12,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: clone repository
|
- name: clone repository
|
||||||
image: git.cryptic.systems/volker.raschek/git:1.3.1
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
- name: helm lint
|
- name: helm lint
|
||||||
commands:
|
commands:
|
||||||
@ -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
|
||||||
@ -73,7 +73,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: clone repository
|
- name: clone repository
|
||||||
image: git.cryptic.systems/volker.raschek/git:1.3.1
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
- name: helm unittest
|
- name: helm unittest
|
||||||
commands:
|
commands:
|
||||||
@ -125,14 +125,14 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: clone repository
|
- name: clone repository
|
||||||
image: git.cryptic.systems/volker.raschek/git:1.3.1
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
- name: generate README
|
- name: generate README
|
||||||
commands:
|
commands:
|
||||||
- npm install
|
- npm install
|
||||||
- npm run readme:parameters
|
- npm run readme:parameters
|
||||||
- npm run readme:lint
|
- npm run readme:lint
|
||||||
image: docker.io/library/node:22.9.0-alpine
|
image: docker.io/library/node:22.11.0-alpine
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 150
|
cpu: 150
|
||||||
@ -141,7 +141,7 @@ steps:
|
|||||||
- name: detect diff
|
- name: detect diff
|
||||||
commands:
|
commands:
|
||||||
- git diff --exit-code --name-only README.md
|
- git diff --exit-code --name-only README.md
|
||||||
image: git.cryptic.systems/volker.raschek/git:1.3.1
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
- name: email-notification
|
- name: email-notification
|
||||||
environment:
|
environment:
|
||||||
@ -183,7 +183,7 @@ platform:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: clone repository
|
- name: clone repository
|
||||||
image: git.cryptic.systems/volker.raschek/git:1.3.1
|
image: git.cryptic.systems/volker.raschek/git:1.4.0
|
||||||
|
|
||||||
- name: release-helm-chart
|
- name: release-helm-chart
|
||||||
commands:
|
commands:
|
||||||
|
@ -4,14 +4,15 @@ description: Prometheus metric exporter for PostgreSQL
|
|||||||
type: application
|
type: application
|
||||||
kubeVersion: ">=1.20.0"
|
kubeVersion: ">=1.20.0"
|
||||||
version: "0.1.0"
|
version: "0.1.0"
|
||||||
appVersion: "0.15.0"
|
appVersion: "0.16.0"
|
||||||
|
|
||||||
# icon: https://annotations.example.com/icon.png
|
# icon: https://annotations.example.com/icon.png
|
||||||
|
|
||||||
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
|
||||||
|
72
README.md
72
README.md
@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
[](https://drone.cryptic.systems/volker.raschek/prometheus-postgres-exporter)
|
[](https://drone.cryptic.systems/volker.raschek/prometheus-postgres-exporter)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> This is not the official *community* helm chart of the Prometheus metric exporter for PostgreSQL databases. You can
|
||||||
|
> find the official community chart [here](https://github.com/prometheus-community/helm-charts).
|
||||||
|
|
||||||
This helm chart enables the deployment of a Prometheus metrics exporter for PostgreSQL databases and allows the
|
This helm chart enables the deployment of a Prometheus metrics exporter for PostgreSQL databases and allows the
|
||||||
individual configuration of additional containers/initContainers, mounting of volumes, defining additional environment
|
individual configuration of additional containers/initContainers, mounting of volumes, defining additional environment
|
||||||
variables, apply a user-defined web-config.yaml and much more.
|
variables, apply a user-defined `webConfig.yaml` and much more.
|
||||||
|
|
||||||
Chapter [configuration and installation](#helm-configuration-and-installation) describes the basics how to configure helm
|
Chapter [configuration and installation](#helm-configuration-and-installation) describes the basics how to configure helm
|
||||||
and use it to deploy the exporter. It also contains further configuration examples.
|
and use it to deploy the exporter. It also contains further configuration examples.
|
||||||
|
|
||||||
Furthermore, this helm chart unit tests to detect regressions and stabilize the deployment. Additionally, this helm
|
Furthermore, this helm chart contains unit tests to detect regressions and stabilize the deployment. Additionally, this
|
||||||
chart is tested for deployment scenarios with ArgoCD.
|
helm chart is tested for deployment scenarios with **ArgoCD**.
|
||||||
|
|
||||||
> ![NOTE]
|
|
||||||
> This is not the official *community* helm chart of the Prometheus metric exporter for PostgreSQL databases. You can
|
|
||||||
> find the official community chart [here](https://github.com/prometheus-community/helm-charts).
|
|
||||||
|
|
||||||
## Helm: configuration and installation
|
## Helm: configuration and installation
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ chart is tested for deployment scenarios with ArgoCD.
|
|||||||
```bash
|
```bash
|
||||||
helm repo add prometheus-exporters https://charts.cryptic.systems/prometheus-exporters
|
helm repo add prometheus-exporters https://charts.cryptic.systems/prometheus-exporters
|
||||||
helm repo update
|
helm repo update
|
||||||
helm install prometheus-exporters/prometheus-postgres-exporter prometheus-postgres-exporter \
|
helm install prometheus-postgres-exporter prometheus-exporters/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"' \
|
||||||
@ -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-exporters/prometheus-postgres-exporter prometheus-postgres-exporter \
|
helm install prometheus-postgres-exporter prometheus-exporters/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-exporters/prometheus-postgres-exporter prometheus-postgres-exporter \
|
helm install prometheus-postgres-exporter prometheus-exporters/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"' \
|
||||||
@ -126,25 +126,25 @@ replaced:
|
|||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
| Name | Description | Value |
|
| Name | Description | Value |
|
||||||
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
||||||
| `config.database.existingSecret.enabled` | Mount an existing secret containing the application specific `DATA_SOURCE_` prefixed environment variables. | `false` |
|
| `config.database.existingSecret.enabled` | Mount an existing secret containing the application specific `DATA_SOURCE_` prefixed environment variables. | `false` |
|
||||||
| `config.database.existingSecret.secretName` | Name of the existing secret containing the application specific `DATA_SOURCE_` prefixed environment variables. | `""` |
|
| `config.database.existingSecret.secretName` | Name of the existing secret containing the application specific `DATA_SOURCE_` prefixed environment variables. | `""` |
|
||||||
| `config.database.secret.annotations` | Additional annotations of the secret containing the database credentials. | `{}` |
|
| `config.database.secret.annotations` | Additional annotations of the secret containing the database credentials. | `{}` |
|
||||||
| `config.database.secret.labels` | Additional labels of the secret containing the database credentials. | `{}` |
|
| `config.database.secret.labels` | Additional labels of the secret containing the database credentials. | `{}` |
|
||||||
| `config.database.secret.databaseUsername` | Database username. Will be defined as env `DATA_SOURCE_USER` as part of a secret. | `""` |
|
| `config.database.secret.databaseUsername` | Database username. Will be defined as env `DATA_SOURCE_USER` as part of a secret. | `""` |
|
||||||
| `config.database.secret.databasePassword` | Database password. Will be defined as env `DATA_SOURCE_PASS` as part of a secret. | `""` |
|
| `config.database.secret.databasePassword` | Database password. Will be defined as env `DATA_SOURCE_PASS` as part of a secret. | `""` |
|
||||||
| `config.database.secret.databaseConnectionUrl` | Complex database connection URL. Will be defined as env `DATA_SOURCE_URI` as part of a secret. | `""` |
|
| `config.database.secret.databaseConnectionUrl` | Complex database connection URL. Will be defined as env `DATA_SOURCE_URI` as part of a secret. | `""` |
|
||||||
| `config.exporterConfig.existingSecret.enabled` | Mount an existing secret containing the key `exporter_config.yaml`. | `false` |
|
| `config.exporterConfig.existingSecret.enabled` | Mount an existing secret containing the key `exporterConfig.yaml`. | `false` |
|
||||||
| `config.exporterConfig.existingSecret.secretName` | Name of the existing secret containing the key `exporter_config.yaml`. | `""` |
|
| `config.exporterConfig.existingSecret.secretName` | Name of the existing secret containing the key `exporterConfig.yaml`. | `""` |
|
||||||
| `config.exporterConfig.secret.annotations` | Additional annotations of the secret containing the `exporterConfig.yaml`. | `{}` |
|
| `config.exporterConfig.secret.annotations` | Additional annotations of the secret containing the `exporterConfig.yaml`. | `{}` |
|
||||||
| `config.exporterConfig.secret.labels` | Additional labels of the secret containing the `exporterConfig.yaml`. | `{}` |
|
| `config.exporterConfig.secret.labels` | Additional labels of the secret containing the `exporterConfig.yaml`. | `{}` |
|
||||||
| `config.exporterConfig.secret.exporterConfig` | Content of the `exporterConfig.yaml`. Further information can be found [here](https://prometheus.io/docs/prometheus/latest/configuration/https/). | `{}` |
|
| `config.exporterConfig.secret.exporterConfig` | Content of the `exporterConfig.yaml`. Further information can be found [here](https://github.com/prometheus-community/postgres_exporter?tab=readme-ov-file#multi-target-support-beta). | `{}` |
|
||||||
| `config.webConfig.existingSecret.enabled` | Mount an existing secret containing the key `webConfig.yaml`. | `false` |
|
| `config.webConfig.existingSecret.enabled` | Mount an existing secret containing the key `webConfig.yaml`. | `false` |
|
||||||
| `config.webConfig.existingSecret.secretName` | Name of the existing secret containing the key `webConfig.yaml`. | `""` |
|
| `config.webConfig.existingSecret.secretName` | Name of the existing secret containing the key `webConfig.yaml`. | `""` |
|
||||||
| `config.webConfig.secret.annotations` | Additional annotations of the secret containing the `webConfig.yaml`. | `{}` |
|
| `config.webConfig.secret.annotations` | Additional annotations of the secret containing the `webConfig.yaml`. | `{}` |
|
||||||
| `config.webConfig.secret.labels` | Additional labels of the secret containing the `webConfig.yaml`. | `{}` |
|
| `config.webConfig.secret.labels` | Additional labels of the secret containing the `webConfig.yaml`. | `{}` |
|
||||||
| `config.webConfig.secret.webConfig` | Content of the `webConfig.yaml`. Further information can be found [here](https://prometheus.io/docs/prometheus/latest/configuration/https/). | `{}` |
|
| `config.webConfig.secret.webConfig` | Content of the `webConfig.yaml`. Further information can be found [here](https://prometheus.io/docs/prometheus/latest/configuration/https/). | `{}` |
|
||||||
|
|
||||||
### Deployment
|
### Deployment
|
||||||
|
|
||||||
@ -170,10 +170,11 @@ replaced:
|
|||||||
| `deployment.postgresExporter.image.pullPolicy` | Image pull policy. | `IfNotPresent` |
|
| `deployment.postgresExporter.image.pullPolicy` | Image pull policy. | `IfNotPresent` |
|
||||||
| `deployment.postgresExporter.resources` | CPU and memory resources of the pod. | `{}` |
|
| `deployment.postgresExporter.resources` | CPU and memory resources of the pod. | `{}` |
|
||||||
| `deployment.postgresExporter.securityContext` | Security context of the container of the deployment. | `{}` |
|
| `deployment.postgresExporter.securityContext` | Security context of the container of the deployment. | `{}` |
|
||||||
| `deployment.postgresExporter.volumeMounts` | Additional volume mounts. | `{}` |
|
| `deployment.postgresExporter.volumeMounts` | Additional volume mounts. | `[]` |
|
||||||
| `deployment.nodeSelector` | NodeSelector of the postgres-exporter deployment. | `{}` |
|
| `deployment.nodeSelector` | NodeSelector of the postgres-exporter deployment. | `{}` |
|
||||||
| `deployment.priorityClassName` | PriorityClassName of the postgres-exporter deployment. | `""` |
|
| `deployment.priorityClassName` | PriorityClassName of the postgres-exporter deployment. | `""` |
|
||||||
| `deployment.replicaCount` | Number of replicas for the postgres-exporter deployment. | `1` |
|
| `deployment.replicaCount` | Number of replicas for the postgres-exporter deployment. | `1` |
|
||||||
|
| `deployment.restartPolicy` | Restart policy of the postgres-exporter deployment. | `""` |
|
||||||
| `deployment.securityContext` | Security context of the postgres-exporter deployment. | `{}` |
|
| `deployment.securityContext` | Security context of the postgres-exporter deployment. | `{}` |
|
||||||
| `deployment.strategy.type` | Strategy type - `Recreate` or `Rollingupdate`. | `Recreate` |
|
| `deployment.strategy.type` | Strategy type - `Recreate` or `Rollingupdate`. | `Recreate` |
|
||||||
| `deployment.strategy.rollingUpdate.maxSurge` | The maximum number of pods that can be scheduled above the desired number of pods during a rolling update. | `1` |
|
| `deployment.strategy.rollingUpdate.maxSurge` | The maximum number of pods that can be scheduled above the desired number of pods during a rolling update. | `1` |
|
||||||
@ -220,7 +221,7 @@ replaced:
|
|||||||
| `prometheus.metrics.enabled` | Enable of scraping metrics by Prometheus. | `true` |
|
| `prometheus.metrics.enabled` | Enable of scraping metrics by Prometheus. | `true` |
|
||||||
| `prometheus.metrics.podMonitor.enabled` | Enable creation of a podMonitor. Excludes the existence of a serviceMonitor resource. | `false` |
|
| `prometheus.metrics.podMonitor.enabled` | Enable creation of a podMonitor. Excludes the existence of a serviceMonitor resource. | `false` |
|
||||||
| `prometheus.metrics.podMonitor.annotations` | Additional podMonitor annotations. | `{}` |
|
| `prometheus.metrics.podMonitor.annotations` | Additional podMonitor annotations. | `{}` |
|
||||||
| `prometheus.metrics.podMonitor.enableHttp2` | Enable HTTP2. | `false` |
|
| `prometheus.metrics.podMonitor.enableHttp2` | Enable HTTP2. | `true` |
|
||||||
| `prometheus.metrics.podMonitor.followRedirects` | FollowRedirects configures whether scrape requests follow HTTP 3xx redirects. | `false` |
|
| `prometheus.metrics.podMonitor.followRedirects` | FollowRedirects configures whether scrape requests follow HTTP 3xx redirects. | `false` |
|
||||||
| `prometheus.metrics.podMonitor.honorLabels` | Honor labels. | `false` |
|
| `prometheus.metrics.podMonitor.honorLabels` | Honor labels. | `false` |
|
||||||
| `prometheus.metrics.podMonitor.labels` | Additional podMonitor labels. | `{}` |
|
| `prometheus.metrics.podMonitor.labels` | Additional podMonitor labels. | `{}` |
|
||||||
@ -233,12 +234,11 @@ replaced:
|
|||||||
| `prometheus.metrics.serviceMonitor.enabled` | Enable creation of a serviceMonitor. Excludes the existence of a podMonitor resource. | `false` |
|
| `prometheus.metrics.serviceMonitor.enabled` | Enable creation of a serviceMonitor. Excludes the existence of a podMonitor resource. | `false` |
|
||||||
| `prometheus.metrics.serviceMonitor.annotations` | Additional serviceMonitor annotations. | `{}` |
|
| `prometheus.metrics.serviceMonitor.annotations` | Additional serviceMonitor annotations. | `{}` |
|
||||||
| `prometheus.metrics.serviceMonitor.labels` | Additional serviceMonitor labels. | `{}` |
|
| `prometheus.metrics.serviceMonitor.labels` | Additional serviceMonitor labels. | `{}` |
|
||||||
| `prometheus.metrics.serviceMonitor.enableHttp2` | Enable HTTP2. | `false` |
|
| `prometheus.metrics.serviceMonitor.enableHttp2` | Enable HTTP2. | `true` |
|
||||||
| `prometheus.metrics.serviceMonitor.followRedirects` | FollowRedirects configures whether scrape requests follow HTTP 3xx redirects. | `false` |
|
| `prometheus.metrics.serviceMonitor.followRedirects` | FollowRedirects configures whether scrape requests follow HTTP 3xx redirects. | `false` |
|
||||||
| `prometheus.metrics.serviceMonitor.honorLabels` | Honor labels. | `false` |
|
| `prometheus.metrics.serviceMonitor.honorLabels` | Honor labels. | `false` |
|
||||||
| `prometheus.metrics.serviceMonitor.interval` | Interval at which metrics should be scraped. If not specified Prometheus' global scrape interval is used. | `60s` |
|
| `prometheus.metrics.serviceMonitor.interval` | Interval at which metrics should be scraped. If not specified Prometheus' global scrape interval is used. | `60s` |
|
||||||
| `prometheus.metrics.serviceMonitor.path` | HTTP path for scraping Prometheus metrics. | `/metrics` |
|
| `prometheus.metrics.serviceMonitor.path` | HTTP path for scraping Prometheus metrics. | `/metrics` |
|
||||||
| `prometheus.metrics.serviceMonitor.port` | HTTP port for scraping Prometheus metrics. | `9187` |
|
|
||||||
| `prometheus.metrics.serviceMonitor.relabelings` | RelabelConfigs to apply to samples before scraping. Prometheus Operator automatically adds relabelings for a few standard Kubernetes fields. | `[]` |
|
| `prometheus.metrics.serviceMonitor.relabelings` | RelabelConfigs to apply to samples before scraping. Prometheus Operator automatically adds relabelings for a few standard Kubernetes fields. | `[]` |
|
||||||
| `prometheus.metrics.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended. If not specified, global Prometheus scrape timeout is used. | `30s` |
|
| `prometheus.metrics.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended. If not specified, global Prometheus scrape timeout is used. | `30s` |
|
||||||
| `prometheus.metrics.serviceMonitor.scheme` | HTTP scheme to use for scraping. For example `http` or `https`. | `http` |
|
| `prometheus.metrics.serviceMonitor.scheme` | HTTP scheme to use for scraping. For example `http` or `https`. | `http` |
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
"matchUpdateTypes": [ "minor", "patch"]
|
"matchUpdateTypes": [ "minor", "patch"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"addLabels": [ "renovate/prometheus-postgres-exporter", "renovate/automerge" ],
|
"addLabels": [ "renovate/markdownlint", "renovate/automerge" ],
|
||||||
"automerge": true,
|
"automerge": true,
|
||||||
"matchPackageNames": [ "prometheus-postgres-exporter" ],
|
"matchPackageNames": [ "markdownlint-cli", "@bitnami/readme-generator-for-helm" ],
|
||||||
"matchManagers": [ "regex" ],
|
"matchManagers": [ "npm" ],
|
||||||
"matchUpdateTypes": [ "minor", "patch"]
|
"matchUpdateTypes": [ "minor", "patch"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -52,19 +52,28 @@
|
|||||||
{{/* volumeMounts */}}
|
{{/* volumeMounts */}}
|
||||||
|
|
||||||
{{- define "prometheus-postgres-exporter.deployment.volumeMounts" -}}
|
{{- define "prometheus-postgres-exporter.deployment.volumeMounts" -}}
|
||||||
{{- $volumeMounts := dict "volumeMounts" (.Values.deployment.postgresExporter.volumeMounts | default (list) ) }}
|
{{- $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 = concat $volumeMounts (list (dict "name" "config-d" "mountPath" "/etc/prometheus-postgres-exporter/config.d" )) }}
|
||||||
{{ toYaml $volumeMounts }}
|
{{ toYaml (dict "volumeMounts" $volumeMounts) }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{/* volumes */}}
|
{{/* volumes */}}
|
||||||
|
|
||||||
{{- define "prometheus-postgres-exporter.deployment.volumes" -}}
|
{{- define "prometheus-postgres-exporter.deployment.volumes" -}}
|
||||||
{{- $volumes := dict "volumes" (.Values.deployment.volumes | default (list) ) }}
|
{{- $volumes := .Values.deployment.volumes | default list }}
|
||||||
{{- $secretName := .Values.config.exporterConfig.existingSecret.secretName -}}
|
|
||||||
|
{{- $exporterSecretName := .Values.config.exporterConfig.existingSecret.secretName -}}
|
||||||
{{- if not .Values.config.exporterConfig.existingSecret.enabled }}
|
{{- if not .Values.config.exporterConfig.existingSecret.enabled }}
|
||||||
{{- $secretName = printf "%s-exporter-config" (include "prometheus-postgres-exporter.fullname" . ) }}
|
{{- $exporterSecretName = printf "%s-exporter-config" (include "prometheus-postgres-exporter.fullname" . ) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $volumes = merge $volumes (dict "volumes" (list (dict "name" "exporter-config" "secret" (dict "secretName" $secretName)))) }}
|
|
||||||
{{ toYaml $volumes }}
|
{{- $webConfigSecretName := .Values.config.webConfig.existingSecret.secretName -}}
|
||||||
|
{{- if not .Values.config.webConfig.existingSecret.enabled }}
|
||||||
|
{{- $webConfigSecretName = printf "%s-web-config" (include "prometheus-postgres-exporter.fullname" . ) }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- $volumes = concat $volumes (list (dict "name" "config-d" "projected" (dict "defaultMode" 444 "sources" (list (dict "secret" (dict "name" $exporterSecretName)) (dict "secret" (dict "name" $webConfigSecretName)))))) }}
|
||||||
|
|
||||||
|
{{ toYaml (dict "volumes" $volumes) }}
|
||||||
|
|
||||||
{{- end -}}
|
{{- end -}}
|
@ -13,5 +13,5 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- define "prometheus-postgres-exporter.pod.selectorLabels" -}}
|
{{- define "prometheus-postgres-exporter.pod.selectorLabels" -}}
|
||||||
{{ include "prometheus-postgres-exporter.pod.labels" . }}
|
{{ include "prometheus-postgres-exporter.selectorLabels" . }}
|
||||||
{{- end }}
|
{{- end }}
|
@ -24,6 +24,7 @@ spec:
|
|||||||
- name: postgres-exporter
|
- name: postgres-exporter
|
||||||
args:
|
args:
|
||||||
- "--config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml"
|
- "--config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml"
|
||||||
|
- "--web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml"
|
||||||
- "--web.listen-address=:9187"
|
- "--web.listen-address=:9187"
|
||||||
{{- range .Values.deployment.postgresExporter.args }}
|
{{- range .Values.deployment.postgresExporter.args }}
|
||||||
- {{ . | quote }}
|
- {{ . | quote }}
|
||||||
@ -59,7 +60,7 @@ spec:
|
|||||||
- name: http
|
- name: http
|
||||||
containerPort: 9187
|
containerPort: 9187
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
{{- with .Values.deployment.containerResources }}
|
{{- with .Values.deployment.postgresExporter.resources }}
|
||||||
resources:
|
resources:
|
||||||
{{- toYaml . | nindent 10 }}
|
{{- toYaml . | nindent 10 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@ -80,7 +81,7 @@ spec:
|
|||||||
dnsPolicy: {{ .Values.deployment.dnsPolicy }}
|
dnsPolicy: {{ .Values.deployment.dnsPolicy }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.deployment.hostname }}
|
{{- if .Values.deployment.hostname }}
|
||||||
hostname: {{ .Values.batch.dbUpdate.hostname }}
|
hostname: {{ .Values.deployment.hostname }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
hostNetwork: {{ .Values.deployment.hostNetwork }}
|
hostNetwork: {{ .Values.deployment.hostNetwork }}
|
||||||
{{- with .Values.deployment.imagePullSecrets }}
|
{{- with .Values.deployment.imagePullSecrets }}
|
||||||
@ -94,7 +95,9 @@ spec:
|
|||||||
{{- if .Values.deployment.priorityClassName }}
|
{{- if .Values.deployment.priorityClassName }}
|
||||||
priorityClassName: {{ .Values.deployment.priorityClassName }}
|
priorityClassName: {{ .Values.deployment.priorityClassName }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .Values.deployment.restartPolicy }}
|
||||||
restartPolicy: {{ .Values.deployment.restartPolicy }}
|
restartPolicy: {{ .Values.deployment.restartPolicy }}
|
||||||
|
{{- end }}
|
||||||
{{- with .Values.deployment.securityContext }}
|
{{- with .Values.deployment.securityContext }}
|
||||||
securityContext:
|
securityContext:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
|
@ -16,7 +16,7 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
{{- with .Values.prometheus.rules }}
|
{{- with .Values.prometheus.rules }}
|
||||||
groups:
|
groups:
|
||||||
- name: {{ template "prometheus-postgres-exporter.name" $ }}
|
- name: {{ template "prometheus-postgres-exporter.fullname" $ }}
|
||||||
rules:
|
rules:
|
||||||
{{ toYaml . | nindent 4 }}
|
{{ toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{- if and (not (.Values.config.webConfig.existingSecret.enabled)) .Values.config.webConfig.secret.webConfig }}
|
{{- if not .Values.config.webConfig.existingSecret.enabled }}
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
@ -11,7 +11,7 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
name: {{ include "prometheus-postgres-exporter.fullname" . }}-webconfig
|
name: {{ include "prometheus-postgres-exporter.fullname" . }}-web-config
|
||||||
namespace: {{ .Release.Namespace }}
|
namespace: {{ .Release.Namespace }}
|
||||||
stringData:
|
stringData:
|
||||||
webConfig.yaml: |
|
webConfig.yaml: |
|
||||||
|
@ -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 }}
|
@ -25,8 +25,8 @@ spec:
|
|||||||
{{- toYaml . | nindent 6 }}
|
{{- toYaml . | nindent 6 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
scrapeTimeout: {{ required "The scrape timeout of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scrapeTimeout }}
|
scrapeTimeout: {{ required "The scrape timeout of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scrapeTimeout }}
|
||||||
scheme: {{ required "The scheme of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scheme}}
|
scheme: {{ required "The scheme of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.scheme }}
|
||||||
targetPort: {{ required "The port of the serviceMonitor is not defined!" .Values.prometheus.metrics.serviceMonitor.port }}
|
targetPort: {{ required "The port of the service is not defined!" .Values.services.http.port }}
|
||||||
{{- with .Values.prometheus.metrics.serviceMonitor.tlsConfig }}
|
{{- with .Values.prometheus.metrics.serviceMonitor.tlsConfig }}
|
||||||
tlsConfig:
|
tlsConfig:
|
||||||
{{- toYaml . | nindent 6 }}
|
{{- toYaml . | nindent 6 }}
|
||||||
|
@ -32,8 +32,98 @@ tests:
|
|||||||
content:
|
content:
|
||||||
secretRef:
|
secretRef:
|
||||||
name: prometheus-postgres-exporter-unittest-database-env
|
name: prometheus-postgres-exporter-unittest-database-env
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].args
|
||||||
|
value:
|
||||||
|
- --config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml
|
||||||
|
- --web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml
|
||||||
|
- --web.listen-address=:9187
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts
|
||||||
|
value:
|
||||||
|
- mountPath: /etc/prometheus-postgres-exporter/config.d
|
||||||
|
name: config-d
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.volumes
|
||||||
|
value:
|
||||||
|
- name: config-d
|
||||||
|
projected:
|
||||||
|
defaultMode: 444
|
||||||
|
sources:
|
||||||
|
- secret:
|
||||||
|
name: prometheus-postgres-exporter-unittest-exporter-config
|
||||||
|
- secret:
|
||||||
|
name: prometheus-postgres-exporter-unittest-web-config
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].image
|
||||||
|
value: quay.io/prometheuscommunity/postgres-exporter:v0.1.0
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].imagePullPolicy
|
||||||
|
value: IfNotPresent
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.containers[0].resources
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.containers[0].securityContext
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.dnsConfig
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.dnsPolicy
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.hostname
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.hostNetwork
|
||||||
|
value: false
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.imagePullSecrets
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.nodeSelector
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.priorityClassName
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.restartPolicy
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.subdomain
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.terminationGracePeriodSeconds
|
||||||
|
value: 60
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.tolerations
|
||||||
|
- notExists:
|
||||||
|
path: spec.template.spec.topologySpreadConstraints
|
||||||
|
|
||||||
- it: Test custom database secret
|
- it: Test additional arguments
|
||||||
|
set:
|
||||||
|
deployment.postgresExporter.args:
|
||||||
|
- "--foo=bar"
|
||||||
|
- "--bar=foo"
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].args
|
||||||
|
value:
|
||||||
|
- --config.file=/etc/prometheus-postgres-exporter/config.d/exporterConfig.yaml
|
||||||
|
- --web.config.file=/etc/prometheus-postgres-exporter/config.d/webConfig.yaml
|
||||||
|
- --web.listen-address=:9187
|
||||||
|
- --foo=bar
|
||||||
|
- --bar=foo
|
||||||
|
|
||||||
|
- it: Test custom imageRegistry and imageRepository
|
||||||
|
set:
|
||||||
|
deployment.postgresExporter.image.registry: registry.example.local
|
||||||
|
deployment.postgresExporter.image.repository: path/special/prometheus-postgres-exporter
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].image
|
||||||
|
value: registry.example.local/path/special/prometheus-postgres-exporter:v0.1.0
|
||||||
|
|
||||||
|
- it: Test custom imagePullPolicy
|
||||||
|
set:
|
||||||
|
deployment.postgresExporter.image.pullPolicy: Always
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].imagePullPolicy
|
||||||
|
value: Always
|
||||||
|
|
||||||
|
- it: Test config.database.existingSecret
|
||||||
set:
|
set:
|
||||||
config.database.existingSecret.enabled: true
|
config.database.existingSecret.enabled: true
|
||||||
config.database.existingSecret.secretName: custom-database-secret
|
config.database.existingSecret.secretName: custom-database-secret
|
||||||
@ -43,3 +133,243 @@ tests:
|
|||||||
content:
|
content:
|
||||||
secretRef:
|
secretRef:
|
||||||
name: custom-database-secret
|
name: custom-database-secret
|
||||||
|
|
||||||
|
- it: Test config.exporterConfig.existingSecret
|
||||||
|
set:
|
||||||
|
config.exporterConfig.existingSecret.enabled: true
|
||||||
|
config.exporterConfig.existingSecret.secretName: exporter-config-secret
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts
|
||||||
|
value:
|
||||||
|
- mountPath: /etc/prometheus-postgres-exporter/config.d
|
||||||
|
name: config-d
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.volumes
|
||||||
|
value:
|
||||||
|
- name: config-d
|
||||||
|
projected:
|
||||||
|
defaultMode: 444
|
||||||
|
sources:
|
||||||
|
- secret:
|
||||||
|
name: exporter-config-secret
|
||||||
|
- secret:
|
||||||
|
name: prometheus-postgres-exporter-unittest-web-config
|
||||||
|
|
||||||
|
- it: Test config.webConfig.existingSecret
|
||||||
|
set:
|
||||||
|
config.webConfig.existingSecret.enabled: true
|
||||||
|
config.webConfig.existingSecret.secretName: web-config-secret
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts
|
||||||
|
value:
|
||||||
|
- mountPath: /etc/prometheus-postgres-exporter/config.d
|
||||||
|
name: config-d
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.volumes
|
||||||
|
value:
|
||||||
|
- name: config-d
|
||||||
|
projected:
|
||||||
|
defaultMode: 444
|
||||||
|
sources:
|
||||||
|
- secret:
|
||||||
|
name: prometheus-postgres-exporter-unittest-exporter-config
|
||||||
|
- secret:
|
||||||
|
name: web-config-secret
|
||||||
|
|
||||||
|
- it: Test custom resource limits and requests
|
||||||
|
set:
|
||||||
|
deployment.postgresExporter.resources:
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 250MB
|
||||||
|
requests:
|
||||||
|
cpu: 25m
|
||||||
|
memory: 100MB
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].resources
|
||||||
|
value:
|
||||||
|
limits:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 250MB
|
||||||
|
requests:
|
||||||
|
cpu: 25m
|
||||||
|
memory: 100MB
|
||||||
|
|
||||||
|
- it: Test custom securityContext
|
||||||
|
set:
|
||||||
|
deployment.postgresExporter.securityContext:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_RAW
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
privileged: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1000
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].securityContext
|
||||||
|
value:
|
||||||
|
capabilities:
|
||||||
|
add:
|
||||||
|
- NET_RAW
|
||||||
|
drop:
|
||||||
|
- ALL
|
||||||
|
privileged: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1000
|
||||||
|
|
||||||
|
- it: Test dnsConfig
|
||||||
|
set:
|
||||||
|
deployment.dnsConfig:
|
||||||
|
nameservers:
|
||||||
|
- "8.8.8.8"
|
||||||
|
- "8.8.4.4"
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.dnsConfig
|
||||||
|
value:
|
||||||
|
nameservers:
|
||||||
|
- "8.8.8.8"
|
||||||
|
- "8.8.4.4"
|
||||||
|
|
||||||
|
- it: Test dnsPolicy
|
||||||
|
set:
|
||||||
|
deployment.dnsPolicy: ClusterFirst
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.dnsPolicy
|
||||||
|
value: ClusterFirst
|
||||||
|
|
||||||
|
- it: Test hostNetwork, hostname, subdomain
|
||||||
|
set:
|
||||||
|
deployment.hostNetwork: true
|
||||||
|
deployment.hostname: pg-exporter
|
||||||
|
deployment.subdomain: exporters.internal
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.hostNetwork
|
||||||
|
value: true
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.hostname
|
||||||
|
value: pg-exporter
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.subdomain
|
||||||
|
value: exporters.internal
|
||||||
|
|
||||||
|
- it: Test imagePullSecrets
|
||||||
|
set:
|
||||||
|
deployment.imagePullSecrets:
|
||||||
|
- name: my-pull-secret
|
||||||
|
- name: my-special-secret
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.imagePullSecrets
|
||||||
|
value:
|
||||||
|
- name: my-pull-secret
|
||||||
|
- name: my-special-secret
|
||||||
|
|
||||||
|
- it: Test nodeSelector
|
||||||
|
set:
|
||||||
|
deployment.nodeSelector:
|
||||||
|
foo: bar
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.nodeSelector
|
||||||
|
value:
|
||||||
|
foo: bar
|
||||||
|
|
||||||
|
- it: Test priorityClassName
|
||||||
|
set:
|
||||||
|
deployment.priorityClassName: my-priority
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.priorityClassName
|
||||||
|
value: my-priority
|
||||||
|
|
||||||
|
- it: Test restartPolicy
|
||||||
|
set:
|
||||||
|
deployment.restartPolicy: Always
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.restartPolicy
|
||||||
|
value: Always
|
||||||
|
|
||||||
|
- it: Test terminationGracePeriodSeconds
|
||||||
|
set:
|
||||||
|
deployment.terminationGracePeriodSeconds: 120
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.terminationGracePeriodSeconds
|
||||||
|
value: 120
|
||||||
|
|
||||||
|
- it: Test tolerations
|
||||||
|
set:
|
||||||
|
deployment.tolerations:
|
||||||
|
- key: database/type
|
||||||
|
operator: Equal
|
||||||
|
value: postgres
|
||||||
|
effect: NoSchedule
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.tolerations
|
||||||
|
value:
|
||||||
|
- key: database/type
|
||||||
|
operator: Equal
|
||||||
|
value: postgres
|
||||||
|
effect: NoSchedule
|
||||||
|
|
||||||
|
- it: Test topologySpreadConstraints
|
||||||
|
set:
|
||||||
|
deployment.topologySpreadConstraints:
|
||||||
|
- topologyKey: kubernetes.io/hostname
|
||||||
|
whenUnsatisfiable: DoNotSchedule
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: prometheus-postgres-exporter
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.topologySpreadConstraints
|
||||||
|
value:
|
||||||
|
- topologyKey: kubernetes.io/hostname
|
||||||
|
whenUnsatisfiable: DoNotSchedule
|
||||||
|
labelSelector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: prometheus-postgres-exporter
|
||||||
|
|
||||||
|
- it: Test additional volumeMounts and volumes
|
||||||
|
set:
|
||||||
|
deployment.postgresExporter.volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /usr/lib/prometheus-postgres-exporter/data
|
||||||
|
deployment.volumes:
|
||||||
|
- name: data
|
||||||
|
hostPath:
|
||||||
|
path: /usr/lib/prometheus-postgres-exporter/data
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.containers[0].volumeMounts
|
||||||
|
value:
|
||||||
|
- name: data
|
||||||
|
mountPath: /usr/lib/prometheus-postgres-exporter/data
|
||||||
|
- name: config-d
|
||||||
|
mountPath: /etc/prometheus-postgres-exporter/config.d
|
||||||
|
- equal:
|
||||||
|
path: spec.template.spec.volumes
|
||||||
|
value:
|
||||||
|
- name: data
|
||||||
|
hostPath:
|
||||||
|
path: /usr/lib/prometheus-postgres-exporter/data
|
||||||
|
- name: config-d
|
||||||
|
projected:
|
||||||
|
defaultMode: 444
|
||||||
|
sources:
|
||||||
|
- secret:
|
||||||
|
name: prometheus-postgres-exporter-unittest-exporter-config
|
||||||
|
- secret:
|
||||||
|
name: prometheus-postgres-exporter-unittest-web-config
|
@ -58,7 +58,7 @@ tests:
|
|||||||
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.podMetricsEndpoints[0].enableHttp2
|
path: spec.podMetricsEndpoints[0].enableHttp2
|
||||||
value: false
|
value: true
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.podMetricsEndpoints[0].followRedirects
|
path: spec.podMetricsEndpoints[0].followRedirects
|
||||||
value: false
|
value: false
|
||||||
@ -90,10 +90,7 @@ tests:
|
|||||||
path: spec.selector.matchLabels
|
path: spec.selector.matchLabels
|
||||||
value:
|
value:
|
||||||
app.kubernetes.io/instance: prometheus-postgres-exporter-unittest
|
app.kubernetes.io/instance: prometheus-postgres-exporter-unittest
|
||||||
app.kubernetes.io/managed-by: Helm
|
|
||||||
app.kubernetes.io/name: prometheus-postgres-exporter
|
app.kubernetes.io/name: prometheus-postgres-exporter
|
||||||
app.kubernetes.io/version: 0.1.0
|
|
||||||
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
|
||||||
|
|
||||||
- it: Render podMonitor with custom annotations and labels.
|
- it: Render podMonitor with custom annotations and labels.
|
||||||
set:
|
set:
|
||||||
@ -122,7 +119,7 @@ tests:
|
|||||||
set:
|
set:
|
||||||
prometheus.metrics.enabled: true
|
prometheus.metrics.enabled: true
|
||||||
prometheus.metrics.podMonitor.enabled: true
|
prometheus.metrics.podMonitor.enabled: true
|
||||||
prometheus.metrics.podMonitor.enableHttp2: true
|
prometheus.metrics.podMonitor.enableHttp2: false
|
||||||
prometheus.metrics.podMonitor.followRedirects: true
|
prometheus.metrics.podMonitor.followRedirects: true
|
||||||
prometheus.metrics.podMonitor.honorLabels: true
|
prometheus.metrics.podMonitor.honorLabels: true
|
||||||
prometheus.metrics.podMonitor.interval: "180s"
|
prometheus.metrics.podMonitor.interval: "180s"
|
||||||
@ -140,7 +137,7 @@ tests:
|
|||||||
count: 1
|
count: 1
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.podMetricsEndpoints[0].enableHttp2
|
path: spec.podMetricsEndpoints[0].enableHttp2
|
||||||
value: true
|
value: false
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.podMetricsEndpoints[0].followRedirects
|
path: spec.podMetricsEndpoints[0].followRedirects
|
||||||
value: true
|
value: true
|
||||||
|
@ -8,34 +8,14 @@ release:
|
|||||||
templates:
|
templates:
|
||||||
- templates/prometheus-postgres-exporter/secretWebConfig.yaml
|
- templates/prometheus-postgres-exporter/secretWebConfig.yaml
|
||||||
tests:
|
tests:
|
||||||
- it: Skip rendering by using existing secret.
|
- it: Rendering default secret.
|
||||||
set:
|
|
||||||
config.webConfig.existingSecret.enabled: true
|
|
||||||
asserts:
|
|
||||||
- hasDocuments:
|
|
||||||
count: 0
|
|
||||||
|
|
||||||
- it: Skip rendering when no webConfig.yaml is defined.
|
|
||||||
set:
|
|
||||||
config.webConfig.existingSecret.enabled: false
|
|
||||||
asserts:
|
|
||||||
- hasDocuments:
|
|
||||||
count: 0
|
|
||||||
|
|
||||||
- it: Rendering database secret.
|
|
||||||
set:
|
|
||||||
config.webConfig.secret.webConfig:
|
|
||||||
tls_server_config:
|
|
||||||
cert_file: /path/to/cert.pem
|
|
||||||
client_ca_file: /path/to/ca.pem
|
|
||||||
key_file: /path/to/key.pem
|
|
||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 1
|
count: 1
|
||||||
- containsDocument:
|
- containsDocument:
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
name: prometheus-postgres-exporter-unittest-webconfig
|
name: prometheus-postgres-exporter-unittest-web-config
|
||||||
namespace: testing
|
namespace: testing
|
||||||
- notExists:
|
- notExists:
|
||||||
path: metadata.annotations
|
path: metadata.annotations
|
||||||
@ -47,6 +27,19 @@ tests:
|
|||||||
app.kubernetes.io/name: prometheus-postgres-exporter
|
app.kubernetes.io/name: prometheus-postgres-exporter
|
||||||
app.kubernetes.io/version: 0.1.0
|
app.kubernetes.io/version: 0.1.0
|
||||||
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
||||||
|
- equal:
|
||||||
|
path: stringData["webConfig.yaml"]
|
||||||
|
value: |
|
||||||
|
{}
|
||||||
|
|
||||||
|
- it: Rendering custom webconfig.
|
||||||
|
set:
|
||||||
|
config.webConfig.secret.webConfig:
|
||||||
|
tls_server_config:
|
||||||
|
cert_file: /path/to/cert.pem
|
||||||
|
client_ca_file: /path/to/ca.pem
|
||||||
|
key_file: /path/to/key.pem
|
||||||
|
asserts:
|
||||||
- equal:
|
- equal:
|
||||||
path: stringData["webConfig.yaml"]
|
path: stringData["webConfig.yaml"]
|
||||||
value: |
|
value: |
|
||||||
|
@ -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"
|
||||||
|
@ -59,7 +59,7 @@ tests:
|
|||||||
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.endpoints[0].enableHttp2
|
path: spec.endpoints[0].enableHttp2
|
||||||
value: false
|
value: true
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.endpoints[0].followRedirects
|
path: spec.endpoints[0].followRedirects
|
||||||
value: false
|
value: false
|
||||||
@ -121,7 +121,7 @@ tests:
|
|||||||
set:
|
set:
|
||||||
prometheus.metrics.enabled: true
|
prometheus.metrics.enabled: true
|
||||||
prometheus.metrics.serviceMonitor.enabled: true
|
prometheus.metrics.serviceMonitor.enabled: true
|
||||||
prometheus.metrics.serviceMonitor.enableHttp2: true
|
prometheus.metrics.serviceMonitor.enableHttp2: false
|
||||||
prometheus.metrics.serviceMonitor.followRedirects: true
|
prometheus.metrics.serviceMonitor.followRedirects: true
|
||||||
prometheus.metrics.serviceMonitor.honorLabels: true
|
prometheus.metrics.serviceMonitor.honorLabels: true
|
||||||
prometheus.metrics.serviceMonitor.interval: "180s"
|
prometheus.metrics.serviceMonitor.interval: "180s"
|
||||||
@ -134,13 +134,12 @@ tests:
|
|||||||
action: "drop"
|
action: "drop"
|
||||||
prometheus.metrics.serviceMonitor.scrapeTimeout: "5s"
|
prometheus.metrics.serviceMonitor.scrapeTimeout: "5s"
|
||||||
prometheus.metrics.serviceMonitor.scheme: "http"
|
prometheus.metrics.serviceMonitor.scheme: "http"
|
||||||
prometheus.metrics.serviceMonitor.port: 10443
|
|
||||||
asserts:
|
asserts:
|
||||||
- hasDocuments:
|
- hasDocuments:
|
||||||
count: 1
|
count: 1
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.endpoints[0].enableHttp2
|
path: spec.endpoints[0].enableHttp2
|
||||||
value: true
|
value: false
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.endpoints[0].followRedirects
|
path: spec.endpoints[0].followRedirects
|
||||||
value: true
|
value: true
|
||||||
@ -166,7 +165,4 @@ tests:
|
|||||||
value: 5s
|
value: 5s
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.endpoints[0].scheme
|
path: spec.endpoints[0].scheme
|
||||||
value: http
|
value: http
|
||||||
- equal:
|
|
||||||
path: spec.endpoints[0].targetPort
|
|
||||||
value: 10443
|
|
@ -63,10 +63,7 @@ tests:
|
|||||||
path: spec.selector
|
path: spec.selector
|
||||||
value:
|
value:
|
||||||
app.kubernetes.io/instance: prometheus-postgres-exporter-unittest
|
app.kubernetes.io/instance: prometheus-postgres-exporter-unittest
|
||||||
app.kubernetes.io/managed-by: Helm
|
|
||||||
app.kubernetes.io/name: prometheus-postgres-exporter
|
app.kubernetes.io/name: prometheus-postgres-exporter
|
||||||
app.kubernetes.io/version: 0.1.0
|
|
||||||
helm.sh/chart: prometheus-postgres-exporter-0.1.0
|
|
||||||
- equal:
|
- equal:
|
||||||
path: spec.sessionAffinity
|
path: spec.sessionAffinity
|
||||||
value: None
|
value: None
|
||||||
|
21
values.yaml
21
values.yaml
@ -30,15 +30,15 @@ config:
|
|||||||
databaseConnectionUrl: ""
|
databaseConnectionUrl: ""
|
||||||
|
|
||||||
exporterConfig:
|
exporterConfig:
|
||||||
## @param config.exporterConfig.existingSecret.enabled Mount an existing secret containing the key `exporter_config.yaml`.
|
## @param config.exporterConfig.existingSecret.enabled Mount an existing secret containing the key `exporterConfig.yaml`.
|
||||||
## @param config.exporterConfig.existingSecret.secretName Name of the existing secret containing the key `exporter_config.yaml`.
|
## @param config.exporterConfig.existingSecret.secretName Name of the existing secret containing the key `exporterConfig.yaml`.
|
||||||
existingSecret:
|
existingSecret:
|
||||||
enabled: false
|
enabled: false
|
||||||
secretName: ""
|
secretName: ""
|
||||||
|
|
||||||
## @param config.exporterConfig.secret.annotations Additional annotations of the secret containing the `exporterConfig.yaml`.
|
## @param config.exporterConfig.secret.annotations Additional annotations of the secret containing the `exporterConfig.yaml`.
|
||||||
## @param config.exporterConfig.secret.labels Additional labels of the secret containing the `exporterConfig.yaml`.
|
## @param config.exporterConfig.secret.labels Additional labels of the secret containing the `exporterConfig.yaml`.
|
||||||
## @param config.exporterConfig.secret.exporterConfig Content of the `exporterConfig.yaml`. Further information can be found [here](https://prometheus.io/docs/prometheus/latest/configuration/https/).
|
## @param config.exporterConfig.secret.exporterConfig Content of the `exporterConfig.yaml`. Further information can be found [here](https://github.com/prometheus-community/postgres_exporter?tab=readme-ov-file#multi-target-support-beta).
|
||||||
## @skip config.exporterConfig.secret.exporterConfig Skip individual postgres exporter configuration.
|
## @skip config.exporterConfig.secret.exporterConfig Skip individual postgres exporter configuration.
|
||||||
secret:
|
secret:
|
||||||
annotations: {}
|
annotations: {}
|
||||||
@ -190,7 +190,7 @@ deployment:
|
|||||||
# runAsUser: 1000
|
# runAsUser: 1000
|
||||||
|
|
||||||
## @param deployment.postgresExporter.volumeMounts Additional volume mounts.
|
## @param deployment.postgresExporter.volumeMounts Additional volume mounts.
|
||||||
volumeMounts: {}
|
volumeMounts: []
|
||||||
# - name: my-configmap-volume
|
# - name: my-configmap-volume
|
||||||
# mountPath: /configmap
|
# mountPath: /configmap
|
||||||
# readOnly: true
|
# readOnly: true
|
||||||
@ -204,6 +204,9 @@ deployment:
|
|||||||
## @param deployment.replicaCount Number of replicas for the postgres-exporter deployment.
|
## @param deployment.replicaCount Number of replicas for the postgres-exporter deployment.
|
||||||
replicaCount: 1
|
replicaCount: 1
|
||||||
|
|
||||||
|
## @param deployment.restartPolicy Restart policy of the postgres-exporter deployment.
|
||||||
|
restartPolicy: ""
|
||||||
|
|
||||||
## @param deployment.securityContext Security context of the postgres-exporter deployment.
|
## @param deployment.securityContext Security context of the postgres-exporter deployment.
|
||||||
securityContext: {}
|
securityContext: {}
|
||||||
# fsGroup: 2000
|
# fsGroup: 2000
|
||||||
@ -222,6 +225,10 @@ deployment:
|
|||||||
|
|
||||||
## @param deployment.tolerations Tolerations of the postgres-exporter deployment.
|
## @param deployment.tolerations Tolerations of the postgres-exporter deployment.
|
||||||
tolerations: []
|
tolerations: []
|
||||||
|
# - key: database/type
|
||||||
|
# operator: Equal
|
||||||
|
# value: postgres
|
||||||
|
# effect: NoSchedule
|
||||||
|
|
||||||
## @param deployment.topologySpreadConstraints TopologySpreadConstraints of the postgres-exporter deployment.
|
## @param deployment.topologySpreadConstraints TopologySpreadConstraints of the postgres-exporter deployment.
|
||||||
topologySpreadConstraints: []
|
topologySpreadConstraints: []
|
||||||
@ -306,7 +313,7 @@ prometheus:
|
|||||||
podMonitor:
|
podMonitor:
|
||||||
enabled: false
|
enabled: false
|
||||||
annotations: {}
|
annotations: {}
|
||||||
enableHttp2: false
|
enableHttp2: true
|
||||||
followRedirects: false
|
followRedirects: false
|
||||||
honorLabels: false
|
honorLabels: false
|
||||||
labels: {}
|
labels: {}
|
||||||
@ -325,7 +332,6 @@ prometheus:
|
|||||||
## @param prometheus.metrics.serviceMonitor.honorLabels Honor labels.
|
## @param prometheus.metrics.serviceMonitor.honorLabels Honor labels.
|
||||||
## @param prometheus.metrics.serviceMonitor.interval Interval at which metrics should be scraped. If not specified Prometheus' global scrape interval is used.
|
## @param prometheus.metrics.serviceMonitor.interval Interval at which metrics should be scraped. If not specified Prometheus' global scrape interval is used.
|
||||||
## @param prometheus.metrics.serviceMonitor.path HTTP path for scraping prometheus metrics.
|
## @param prometheus.metrics.serviceMonitor.path HTTP path for scraping prometheus metrics.
|
||||||
## @param prometheus.metrics.serviceMonitor.port HTTP port for scraping prometheus metrics.
|
|
||||||
## @param prometheus.metrics.serviceMonitor.relabelings RelabelConfigs to apply to samples before scraping. Prometheus Operator automatically adds relabelings for a few standard Kubernetes fields.
|
## @param prometheus.metrics.serviceMonitor.relabelings RelabelConfigs to apply to samples before scraping. Prometheus Operator automatically adds relabelings for a few standard Kubernetes fields.
|
||||||
## @param prometheus.metrics.serviceMonitor.scrapeTimeout Timeout after which the scrape is ended. If not specified, global Prometheus scrape timeout is used.
|
## @param prometheus.metrics.serviceMonitor.scrapeTimeout Timeout after which the scrape is ended. If not specified, global Prometheus scrape timeout is used.
|
||||||
## @param prometheus.metrics.serviceMonitor.scheme HTTP scheme to use for scraping. For example `http` or `https`.
|
## @param prometheus.metrics.serviceMonitor.scheme HTTP scheme to use for scraping. For example `http` or `https`.
|
||||||
@ -335,12 +341,11 @@ prometheus:
|
|||||||
enabled: false
|
enabled: false
|
||||||
annotations: {}
|
annotations: {}
|
||||||
labels: {}
|
labels: {}
|
||||||
enableHttp2: false
|
enableHttp2: true
|
||||||
followRedirects: false
|
followRedirects: false
|
||||||
honorLabels: false
|
honorLabels: false
|
||||||
interval: "60s"
|
interval: "60s"
|
||||||
path: "/metrics"
|
path: "/metrics"
|
||||||
port: 9187
|
|
||||||
relabelings: []
|
relabelings: []
|
||||||
scrapeTimeout: "30s"
|
scrapeTimeout: "30s"
|
||||||
scheme: "http"
|
scheme: "http"
|
||||||
|
Reference in New Issue
Block a user