Skip to content

Commit

Permalink
[prometheus-consul-exporter] Support extra containers, environment va…
Browse files Browse the repository at this point in the history
…riables and volumes (prometheus-community#162)

* [consul-exporter] Support extra containers and volumes

Signed-off-by: Yong Wen Chua <lawliet89@users.noreply.github.com>

* Add environment variables

Signed-off-by: Yong Wen Chua <lawliet89@users.noreply.github.com>

* Add Init Container

Signed-off-by: Yong Wen Chua <lawliet89@users.noreply.github.com>

* Fix indentation

Signed-off-by: Yong Wen Chua <lawliet89@users.noreply.github.com>
  • Loading branch information
lawliet89 authored Oct 4, 2020
1 parent c3f8b97 commit c3a0c0d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 13 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-consul-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.4.0"
description: A Helm chart for the Prometheus Consul Exporter
name: prometheus-consul-exporter
version: 0.1.7
version: 0.2.0
keywords:
- metrics
- consul
Expand Down
36 changes: 24 additions & 12 deletions charts/prometheus-consul-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ spec:
release: {{ .Release.Name }}
spec:
serviceAccountName: {{ template "prometheus-consul-exporter.serviceAccountName" . }}
{{- with .Values.initContainers }}
initContainers: {{ toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["consul_exporter"]
args: [
"--consul.server={{ .Values.consulServer }}",
args:
- "--consul.server={{ .Values.consulServer }}"
{{- range $key, $value := .Values.options }}
"--{{ $key }}{{ if $value }}={{ $value }}{{ end }}",
- "--{{ $key }}{{ if $value }}={{ $value }}{{ end }}"
{{- end }}
]
ports:
- name: http
containerPort: {{ .Values.service.port }}
Expand All @@ -47,17 +49,27 @@ spec:
port: http
initialDelaySeconds: 30
timeoutSeconds: 10
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.extraVolumeMounts }}
volumeMounts: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.extraEnv }}
env: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
nodeSelector: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | indent 8 }}
affinity: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | indent 8 }}
tolerations: {{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.extraVolumes }}
volumes: {{ toYaml . | nindent 8 }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/prometheus-consul-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,23 @@ nodeSelector: {}
tolerations: []

affinity: {}

# Extra environment variables
extraEnv: []

# Init Containers for Exporter Pod
initContainers: []

# Extra containers for the exporter pod
extraContainers: []

# Extra Volumes for the pod
extraVolumes: []
# - name: example
# configMap:
# name: example

# Extra Volume Mounts for the exporter container
extraVolumeMounts: []
# - name: example
# mountPath: /example

0 comments on commit c3a0c0d

Please sign in to comment.