Prometheus: Use volume claims to support RWO storage class

This PS uses volumeClaimTemplates to provide multiple
pvcs and pvs to prometheus statefulset's multiple pods.
This gives ability to provide read-write-many access
backend by a read-write-once storage class.

Change-Id: I53d1b866c0c87f0833941b612d3acfbe5742744f
This commit is contained in:
Siri Kim 2018-01-18 17:33:42 +09:00 committed by Pete Birley
parent 3ec7f5f0ff
commit 74db52a349
3 changed files with 14 additions and 39 deletions

View File

@ -1,31 +0,0 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
{{- if .Values.manifests.pvc }}
{{- $envAll := . }}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ .Values.storage.pvc.name }}
spec:
accessModes:
- {{ .Values.storage.pvc.access_mode }}
resources:
requests:
storage: {{ .Values.storage.requests.storage }}
storageClassName: {{ .Values.storage.storage_class }}
{{- end }}

View File

@ -158,13 +158,19 @@ spec:
configMap:
name: prometheus-bin
defaultMode: 0555
{{- if .Values.storage.enabled }}
- name: storage
persistentVolumeClaim:
claimName: {{ .Values.storage.pvc.name }}
{{- else }}
{{ if $mounts_prometheus.volumes }}{{ toYaml $mounts_prometheus.volumes | indent 8 }}{{ end }}
{{- if not .Values.storage.enabled }}
- name: storage
emptyDir: {}
{{- end }}
{{ if $mounts_prometheus.volumes }}{{ toYaml $mounts_prometheus.volumes | indent 8 }}{{ end }}
{{- else }}
volumeClaimTemplates:
- metadata:
name: storage
spec:
accessModes: {{ .Values.storage.pvc.access_mode }}
resources:
requests:
storage: {{ .Values.storage.requests.storage }}
storageClassName: {{ .Values.storage.storage_class }}
{{- end }}
{{- end }}

View File

@ -165,7 +165,7 @@ storage:
enabled: true
pvc:
name: prometheus-pvc
access_mode: ReadWriteMany
access_mode: [ "ReadWriteOnce" ]
requests:
storage: 5Gi
storage_class: general