[stable/prometheus-mongodb-exporter] Add MONGODB_URI env variable secret (#13959)

* Add MONGODB_URI env variable secret

Signed-off-by: Dagenais, Philippe <pdagenais@nuglif.com>

* Bump chart version

Signed-off-by: Dagenais, Philippe <pdagenais@nuglif.com>

* Use mongodb.uri value, remove the command line argument

Signed-off-by: Dagenais, Philippe <pdagenais@nuglif.com>
This commit is contained in:
Philippe Dagenais
2019-05-17 12:36:13 -07:00
committed by Kubernetes Prow Robot
parent d0c98b2fd7
commit cb3dcd7f1e
4 changed files with 20 additions and 4 deletions
@@ -13,4 +13,4 @@ maintainers:
name: prometheus-mongodb-exporter
sources:
- https://github.com/percona/mongodb_exporter
version: 2.0.1
version: 2.1.0
+1 -1
View File
@@ -16,7 +16,7 @@ This command deploys the MongoDB Exporter with the default configuration. The [c
## Using the Chart
To use the chart, ensure the `mongodb.uri` is populated with a valid [MongoDB URI](https://docs.mongodb.com/manual/reference/connection-string).
If the MongoDB server requires authentication, credentials should be populated in the connection string as well. The MongoDB Exporter supports
If the MongoDB server requires authentication, credentials should be populated in the connection string as well. The MongoDB Exporter supports
connecting to either a MongoDB replica set member, shard, or standalone instance.
The chart comes with a ServiceMonitor for use with the [Prometheus Operator](https://github.com/helm/charts/tree/master/stable/prometheus-operator).
@@ -25,8 +25,13 @@ spec:
spec:
containers:
- name: mongodb-exporter
{{- if .Values.env }}
env:
- name: MONGODB_URI
valueFrom:
secretKeyRef:
name: {{ include "prometheus-mongodb-exporter.fullname" . }}
key: mongodb-uri
{{- if .Values.env }}
{{- range $key, $value := .Values.env }}
- name: "{{ $key }}"
value: "{{ $value }}"
@@ -35,7 +40,6 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --mongodb.uri={{ required "A MongoDB URI is required" .Values.mongodb.uri }}
- --web.listen-address={{ printf ":%s" .Values.port }}
{{- toYaml .Values.extraArgs | nindent 8 }}
ports:
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "prometheus-mongodb-exporter.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "prometheus-mongodb-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "prometheus-mongodb-exporter.chart" . }}
type: Opaque
data:
mongodb-uri: {{ required "A MongoDB URI is required" .Values.mongodb.uri | b64enc }}