From 87cd718fd8cd56d59280dca1751b734addd3cfb4 Mon Sep 17 00:00:00 2001 From: atze234 Date: Fri, 8 Feb 2019 01:14:08 +0100 Subject: [PATCH] [stable/prometheus] Added PVC to Pushgateway (#11234) * Update Ingress to allow Labels configured via values.yaml Signed-off-by: Joerg Schueppel * Bumped Chart Version Signed-off-by: Joerg Schueppel * Added PVC to Pushgateway Signed-off-by: Joerg Schueppel * Bumped Chart Version Signed-off-by: Joerg Schueppel * Update Chart.yaml Signed-off-by: David J. M. Karlsen --- stable/prometheus/Chart.yaml | 2 +- stable/prometheus/README.md | 8 ++++ .../templates/pushgateway-deployment.yaml | 12 +++++ .../prometheus/templates/pushgateway-pvc.yaml | 27 +++++++++++ stable/prometheus/values.yaml | 46 +++++++++++++++++++ 5 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 stable/prometheus/templates/pushgateway-pvc.yaml diff --git a/stable/prometheus/Chart.yaml b/stable/prometheus/Chart.yaml index 897cdd59a4..33e0ae5691 100755 --- a/stable/prometheus/Chart.yaml +++ b/stable/prometheus/Chart.yaml @@ -1,5 +1,5 @@ name: prometheus -version: 8.6.1 +version: 8.7.0 appVersion: 2.7.1 description: Prometheus is a monitoring system and time series database. home: https://prometheus.io/ diff --git a/stable/prometheus/README.md b/stable/prometheus/README.md index 495a447409..40c7752a33 100644 --- a/stable/prometheus/README.md +++ b/stable/prometheus/README.md @@ -215,6 +215,14 @@ Parameter | Description | Default `pushgateway.podAnnotations` | annotations to be added to pushgateway pods | `{}` `pushgateway.tolerations` | node taints to tolerate (requires Kubernetes >=1.6) | `[]` `pushgateway.replicaCount` | desired number of pushgateway pods | `1` +`pushgateway.persistentVolume.enabled` | If true, Prometheus pushgateway will create a Persistent Volume Claim | `false` +`pushgateway.persistentVolume.accessModes` | Prometheus pushgateway data Persistent Volume access modes | `[ReadWriteOnce]` +`pushgateway.persistentVolume.annotations` | Prometheus pushgateway data Persistent Volume annotations | `{}` +`pushgateway.persistentVolume.existingClaim` | Prometheus pushgateway data Persistent Volume existing claim name | `""` +`pushgateway.persistentVolume.mountPath` | Prometheus pushgateway data Persistent Volume mount root path | `/data` +`pushgateway.persistentVolume.size` | Prometheus pushgateway data Persistent Volume size | `2Gi` +`pushgateway.persistentVolume.storageClass` | Prometheus server data Persistent Volume Storage Class | `unset` +`pushgateway.persistentVolume.subPath` | Subdirectory of Prometheus server data Persistent Volume to mount | `""` `pushgateway.priorityClassName` | pushgateway priorityClassName | `nil` `pushgateway.resources` | pushgateway pod resource requests & limits | `{}` `pushgateway.service.annotations` | annotations for pushgateway service | `{}` diff --git a/stable/prometheus/templates/pushgateway-deployment.yaml b/stable/prometheus/templates/pushgateway-deployment.yaml index 7dd7f26fa4..befc4a7973 100644 --- a/stable/prometheus/templates/pushgateway-deployment.yaml +++ b/stable/prometheus/templates/pushgateway-deployment.yaml @@ -45,6 +45,12 @@ spec: timeoutSeconds: 10 resources: {{ toYaml .Values.pushgateway.resources | indent 12 }} + {{- if .Values.pushgateway.persistentVolume.enabled }} + volumeMounts: + - name: storage-volume + mountPath: "{{ .Values.pushgateway.persistentVolume.mountPath }}" + subPath: "{{ .Values.pushgateway.persistentVolume.subPath }}" + {{- end }} {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 2 }} @@ -65,4 +71,10 @@ spec: affinity: {{ toYaml .Values.pushgateway.affinity | indent 8 }} {{- end }} + {{- if .Values.pushgateway.persistentVolume.enabled }} + volumes: + - name: storage-volume + persistentVolumeClaim: + claimName: {{ if .Values.pushgateway.persistentVolume.existingClaim }}{{ .Values.pushgateway.persistentVolume.existingClaim }}{{- else }}{{ template "prometheus.pushgateway.fullname" . }}{{- end }} + {{- end -}} {{- end }} diff --git a/stable/prometheus/templates/pushgateway-pvc.yaml b/stable/prometheus/templates/pushgateway-pvc.yaml new file mode 100644 index 0000000000..061ca19cf2 --- /dev/null +++ b/stable/prometheus/templates/pushgateway-pvc.yaml @@ -0,0 +1,27 @@ +{{- if .Values.pushgateway.persistentVolume.enabled -}} +{{- if not .Values.pushgateway.persistentVolume.existingClaim -}} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + {{- if .Values.pushgateway.persistentVolume.annotations }} + annotations: +{{ toYaml .Values.pushgateway.persistentVolume.annotations | indent 4 }} + {{- end }} + labels: + {{- include "prometheus.pushgateway.labels" . | nindent 4 }} + name: {{ template "prometheus.pushgateway.fullname" . }} +spec: + accessModes: +{{ toYaml .Values.pushgateway.persistentVolume.accessModes | indent 4 }} +{{- if .Values.pushgateway.persistentVolume.storageClass }} +{{- if (eq "-" .Values.pushgateway.persistentVolume.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.pushgateway.persistentVolume.storageClass }}" +{{- end }} +{{- end }} + resources: + requests: + storage: "{{ .Values.pushgateway.persistentVolume.size }}" +{{- end -}} +{{- end -}} diff --git a/stable/prometheus/values.yaml b/stable/prometheus/values.yaml index c57c20206a..3d845e7f43 100644 --- a/stable/prometheus/values.yaml +++ b/stable/prometheus/values.yaml @@ -798,6 +798,7 @@ pushgateway: ## Additional pushgateway container arguments ## + ## for example: persistence.file: /data/pushgateway.data extraArgs: {} ingress: @@ -877,6 +878,51 @@ pushgateway: servicePort: 9091 type: ClusterIP + persistentVolume: + ## If true, pushgateway will create/use a Persistent Volume Claim + ## If false, use emptyDir + ## + enabled: false + + ## pushgateway data Persistent Volume access modes + ## Must match those of existing PV or dynamic provisioner + ## Ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## + accessModes: + - ReadWriteOnce + + ## pushgateway data Persistent Volume Claim annotations + ## + annotations: {} + + ## pushgateway data Persistent Volume existing claim name + ## Requires pushgateway.persistentVolume.enabled: true + ## If defined, PVC must be created manually before volume will be bound + existingClaim: "" + + ## pushgateway data Persistent Volume mount root path + ## + mountPath: /data + + ## pushgateway data Persistent Volume size + ## + size: 2Gi + + ## alertmanager data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + + ## Subdirectory of alertmanager data Persistent Volume to mount + ## Useful if the volume's root directory is not empty + ## + subPath: "" + + ## alertmanager ConfigMap entries ## alertmanagerFiles: