[stable/drupal] PV hostPath (#1057)

* Existing PVC support for stable/drupal

* Move ExistingClaim value below drupal, because it only applies to Drupal PVC

* Rename existingClaim to match chart case format

* drupal-data volume hostPath template

* drupal.persistence.hostPath default nil value comments

* hostPath deployment option

* hostPath README documentation

* Simplify hostpath PVC name (was redundant NAME-drupal-drupal-hostpath)

* Fix existingClaim case on hostPath additions

* Chart stable/drupal minor version bump for new hostPath feature

* Reuse PVC template

* Roll back deployment PVC name change, since we now re-use existing PVC template

* Add hostPath system compatibility and mounting steps to README

* Update README with minikube mount option
This commit is contained in:
Scott Rigby
2017-06-14 10:01:40 +02:00
committed by Adnan Abdulhussein
parent 72c243cc89
commit 163eca9eff
5 changed files with 42 additions and 1 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: drupal
version: 0.6.1
version: 0.7.0
appVersion: 8.3.2
description: One of the most versatile open source content management systems.
keywords:
+16
View File
@@ -66,6 +66,7 @@ The following tables lists the configurable parameters of the Drupal chart and t
| `persistence.drupal.storageClass` | PVC Storage Class for Drupal volume | `nil` (uses alpha storage class annotation) |
| `persistence.drupal.accessMode` | PVC Access Mode for Drupal volume | `ReadWriteOnce` |
| `persistence.drupal.existingClaim`| An Existing PVC name | `nil` |
| `persistence.drupal.hostPath` | Host mount path for Drupal volume | `nil` (will not mount to a host path) |
| `persistence.drupal.size` | PVC Storage Request for Drupal volume | `8Gi` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
@@ -123,3 +124,18 @@ See the [Configuration](#configuration) section to configure the PVC or to disab
```bash
$ helm install --name my-release --set persistence.drupal.existingClaim=PVC_NAME stable/drupal
```
### Host path
#### System compatibility
- The local filesystem accessibility to a container in a pod with `hostPath` has been tested on OSX/MacOS with xhyve, and Linux with VirtualBox.
- Windows has not been tested with the supported VM drivers. Minikube does however officially support [Mounting Host Folders](https://github.com/kubernetes/minikube/blob/master/docs/host_folder_mount.md) per pod. Or you may manually sync your container whenever host files are changed with tools like [docker-sync](https://github.com/EugenMayer/docker-sync) or [docker-bg-sync](https://github.com/cweagans/docker-bg-sync).
#### Mounting steps
1. The specified `hostPath` directory must already exist (create one if it does not).
1. Install the chart
```bash
$ helm install --name my-release --set persistence.drupal.hostPath=/PATH/TO/HOST/MOUNT stable/drupal
```
This will mount the `drupal-data` volume into the `hostPath` directory, if the site has not already been initialized. If it has, your host machine changes will persist.
1. Because the container can not control the host machines directory permissions, you must set the Drupal file directory permissions yourself and disable or clear Drupal cache. See Drupal Cores [INSTALL.txt](http://cgit.drupalcode.org/drupal/tree/core/INSTALL.txt?h=8.3.x#n152) for setting file permissions, and see [Drupal handbook page](https://www.drupal.org/node/2598914) to disable cache, or [Drush handbook](https://drushcommands.com/drush-8x/cache/cache-rebuild/) to clear cache.
+13
View File
@@ -0,0 +1,13 @@
{{- if and .Values.persistence.enabled .Values.persistence.drupal.hostPath (not .Values.persistence.drupal.existingClaim) -}}
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ template "fullname" . }}-drupal
spec:
accessModes:
- {{ .Values.persistence.drupal.accessMode | quote }}
capacity:
storage: {{ .Values.persistence.drupal.size | quote }}
hostPath:
path: {{ .Values.persistence.drupal.hostPath | quote }}
{{- end -}}
+5
View File
@@ -8,13 +8,18 @@ metadata:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
{{- if (not .Values.persistence.drupal.hostPath) }}
annotations:
{{- if .Values.persistence.drupal.storageClass }}
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.drupal.storageClass | quote }}
{{- else }}
volume.alpha.kubernetes.io/storage-class: default
{{- end }}
{{- end }}
spec:
{{- if .Values.persistence.drupal.hostPath }}
storageClassName: ""
{{- end }}
accessModes:
- {{ .Values.persistence.drupal.accessMode | quote }}
resources:
+7
View File
@@ -106,6 +106,13 @@ persistence:
##
# existingClaim:
## If defined, the drupal-data volume will mount to the speficied hostPath.
## Requires persistence.enabled: true
## Requires persistence.existingClaim: nil|false
## Default: nil.
##
# hostPath:
## Configure resource requests and limits
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
##