[stable/postgresql] add persistence.existingClaim (#616)

* add persistence.existingClaim to postgresql

* update docs

* make template inline

* nope, that was not right

* up version

* clean up templating

* bump minor version
This commit is contained in:
Philip Champon
2017-03-15 11:06:46 +00:00
committed by Adnan Abdulhussein
parent ad5a4a0f73
commit 3d2733d2c1
6 changed files with 23 additions and 6 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: postgresql
version: 0.4.0
version: 0.5.0
description: Object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
keywords:
- postgresql
+11 -1
View File
@@ -52,6 +52,7 @@ The following tables lists the configurable parameters of the PostgresSQL chart
| `postgresPassword` | Password for the new user. | random 10 characters |
| `postgresDatabase` | Name for new database to create. | `postgres` |
| `persistence.enabled` | Use a PVC to persist data | `true` |
| `persistence.existingClaim`| Provide an existing PersistentVolumeClaim | `nil` |
| `persistence.storageClass` | Storage class of backing PVC | `nil` (uses alpha storage class annotation) |
| `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` |
| `persistence.size` | Size of data volume | `8Gi` |
@@ -87,7 +88,16 @@ $ helm install --name my-release -f values.yaml stable/postgresql
The [postgres](https://github.com/docker-library/postgres) image stores the PostgreSQL data and configurations at the `/var/lib/postgresql/data/pgdata` path of the container.
The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) volume at this location. The volume is created using dynamic volume provisioning.
The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) volume at this location. The volume is created using dynamic volume provisioning. If the PersistentVolumeClaim should not be managed by the chart, define `persistence.existingClaim`.
### Existing PersistentVolumeClaims
1. Create the PersistentVolume
1. Create the PersistentVolumeClaim
1. Install the chart
```bash
$ helm install --set persistence.existingClaim=PVC_NAME postgresql
```
The volume defaults to mount at a subdirectory of the volume instead of the volume root to avoid the volume's hidden directories from interfering with `initdb`. If you are upgrading this chart from before version `0.4.0`, set `persistence.subPath` to `""`.
+1
View File
@@ -14,3 +14,4 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
+2 -2
View File
@@ -54,7 +54,7 @@ spec:
mountPath: /var/lib/postgresql/data/pgdata
subPath: {{ .Values.persistence.subPath }}
{{- if .Values.metrics.enabled }}
- name: metrics
- name: metrics
image: "{{ .Values.metrics.image }}:{{ .Values.metrics.imageTag }}"
imagePullPolicy: {{ default "" .Values.metrics.imagePullPolicy | quote }}
env:
@@ -70,7 +70,7 @@ spec:
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}
claimName: {{ .Values.persistence.existingClaim | default (include "fullname" .) }}
{{- else }}
emptyDir: {}
{{- end -}}
+2 -2
View File
@@ -1,4 +1,4 @@
{{- if .Values.persistence.enabled }}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
@@ -20,4 +20,4 @@ spec:
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end }}
{{- end -}}
+6
View File
@@ -24,6 +24,12 @@ imageTag: "9.5.4"
## Persist data to a persitent volume
persistence:
enabled: true
## A manually managed Persistent Volume and Claim
## Requires persistence.enabled: true
## If defined, PVC must be created manually before volume will be bound
# existingClaim:
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
## Default: volume.alpha.kubernetes.io/storage-class: default
##