Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
add persist storage to prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
yacut committed Nov 12, 2019
1 parent b875a30 commit 79fbb8d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions istio-telemetry/prometheus/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ spec:
imagePullPolicy: {{ .Values.global.imagePullPolicy | default "Always" }}
args:
- '--storage.tsdb.retention={{ .Values.prometheus.retention }}'
- '--storage.tsdb.path=/data'
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- containerPort: 9090
Expand All @@ -56,6 +57,8 @@ spec:
mountPath: /etc/prometheus
- mountPath: /etc/istio-certs
name: istio-certs
- mountPath: /data
name: data
volumes:
- name: config-volume
configMap:
Expand All @@ -67,6 +70,13 @@ spec:
optional: true
{{- end }}
secretName: istio.default
- name: data
{{- if .Values.prometheus.persist }}
persistentVolumeClaim:
claimName: prometheus-pvc
{{- else }}
emptyDir: {}
{{- end }}
affinity:
{{- include "nodeaffinity" . | indent 6 }}
{{- include "podAntiAffinity" . | indent 6 }}
Expand Down
19 changes: 19 additions & 0 deletions istio-telemetry/prometheus/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.prometheus.persist }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: prometheus-pvc
namespace: {{ .Release.Namespace }}
labels:
app: prometheus
chart: {{ template "prometheus.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
spec:
storageClassName: {{ .Values.prometheus.storageClassName }}
accessModes:
- {{ .Values.prometheus.accessMode }}
resources:
requests:
storage: {{ .Values.prometheus.storageSize }}
{{- end }}
5 changes: 5 additions & 0 deletions istio-telemetry/prometheus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,8 @@ prometheus:
# "security" and value "S1".
podAntiAffinityLabelSelector: []
podAntiAffinityTermLabelSelector: []

persist: false
storageClassName: ""
storageSize: 10Gi
accessMode: ReadWriteMany

0 comments on commit 79fbb8d

Please sign in to comment.