Compare commits
No commits in common. "c1a2a098c883aa978ade20c4cb3177d06b7283f2" and "98fe8fe2a401b0230747466d85b0ea179768c712" have entirely different histories.
c1a2a098c8
...
98fe8fe2a4
@ -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 }}
|
||||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user