diff --git a/README.md b/README.md index a39337600e7382197f970d2d314a76ff41d85b13..04a580b8d5ad689c16998e46caf3d9975c13fb1c 100644 --- a/README.md +++ b/README.md @@ -196,9 +196,11 @@ The helperPod is allowed to run on nodes experiencing disk pressure conditions, `sharedFileSystemPath` allows the provisioner to use a filesystem that is mounted on all nodes at the same time. In this case all access modes are supported: `ReadWriteOnce`, `ReadOnlyMany` and `ReadWriteMany` for storage claims. +`storageClassConfigs` is a map from storage class names to objects containing `nodePathMap` or `sharedFilesystemPath`, as described above. + In addition `volumeBindingMode: Immediate` can be used in StorageClass definition. -Please note that `nodePathMap` and `sharedFileSystemPath` are mutually exclusive. If `sharedFileSystemPath` is used, then `nodePathMap` must be set to `[]`. +Please note that `nodePathMap`, `sharedFileSystemPath`, and `storageClassConfigs` are mutually exclusive. If `sharedFileSystemPath` or `stroageClassConfigs` are used, then `nodePathMap` must be set to `[]`. The `setupCommand` and `teardownCommand` allow you to specify the path to binary files in helperPod that will be called when creating or deleting pvc respectively. This can be useful if you need to use distroless images for security reasons. See the examples/distroless directory for an example. A binary file can take the following parameters: | Parameter | Description | diff --git a/deploy/chart/local-path-provisioner/templates/configmap.yaml b/deploy/chart/local-path-provisioner/templates/configmap.yaml index 0f45cdab9bdc2f3d025bfb8798fc36a0cb0dbc3a..60181e060c2e81783dcdc6b6ba280b21229ab424 100644 --- a/deploy/chart/local-path-provisioner/templates/configmap.yaml +++ b/deploy/chart/local-path-provisioner/templates/configmap.yaml @@ -14,8 +14,19 @@ data: {{- with .Values.sharedFileSystemPath }} {{- $config = set $config "sharedFileSystemPath" . }} {{- end }} - {{- with .Values.multipleStorageClasses }} - {{- $config = set $config "sharedFileSystemPath" . }} + {{- with .Values.storageClassConfigs }} + {{- $configs := dict }} + {{- range $key, $value := . }} + {{- $configValue := dict }} + {{- with $value.nodePathMap }} + {{- $configValue = set $configValue "nodePathMap" . }} + {{- end }} + {{- with $value.sharedFileSystemPath }} + {{- $configValue = set $configValue "sharedFileSystemPath" . }} + {{- end }} + {{- $configs = set $configs $key $configValue }} + {{- end }} + {{- $config = set $config "storageClassConfigs" $configs }} {{- end }} {{- $config | toPrettyJson | nindent 4 }} setup: |- diff --git a/deploy/chart/local-path-provisioner/templates/storageclass.yaml b/deploy/chart/local-path-provisioner/templates/storageclass.yaml index 70fe8c995e3e17b95b0375a91e0734bae3ce5bcf..6a41ce15e0cbce49f9d420128e4384905236a6c6 100644 --- a/deploy/chart/local-path-provisioner/templates/storageclass.yaml +++ b/deploy/chart/local-path-provisioner/templates/storageclass.yaml @@ -1,16 +1,16 @@ {{- $storageClasses := list }} -{{ if .Values.multipleStorageClasses }} -{{ $storageClasses = .Values.multipleStorageClasses }} +{{ if .Values.storageClassConfigs }} +{{ $storageClasses = .Values.storageClassConfigs }} {{- else }} -{{ $storageClasses = list .Values }} +{{ $storageClasses = dict .Values.storageClass.name .Values }} {{ end }} {{- $dot := . }} -{{- range $values := $storageClasses }} +{{- range $name, $values := $storageClasses }} {{ if $values.storageClass.create -}} apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: - name: {{ $values.storageClass.name }} + name: {{ $name }} labels: {{ include "local-path-provisioner.labels" $dot | indent 4 }} annotations: diff --git a/deploy/chart/local-path-provisioner/values.yaml b/deploy/chart/local-path-provisioner/values.yaml index 5b3fb0b7589a4c1bd943a4676a07309ae3964760..b3a6c549c4e7ba658b616c4f9f41726c71d836e8 100644 --- a/deploy/chart/local-path-provisioner/values.yaml +++ b/deploy/chart/local-path-provisioner/values.yaml @@ -73,20 +73,21 @@ nodePathMap: # If `sharedFileSystemPath` is used, then `nodePathMap` must be set to `[]`. # sharedFileSystemPath: "" -# `multipleStorageClasses` allows the provisioner to manage multiple independent storage classes. +# `storageClassConfigs` allows the provisioner to manage multiple independent storage classes. # Each storage class must have a unique name, and contains the same fields as shown above for # a single storage class setup, EXCEPT for the provisionerName, which is the same for all -# storage classes -# multipleStorageClasses: -# - storageClass: -# name: my-storage-class-name -# create: true -# defaultClass: false -# reclaimPolicy: Delete -# sharedFileSystemPath: "" -# ## OR -# # See above -# nodePathMap: {} +# storage classes, and name, which is the key of the map. +# storageClassConfigs: {} +# my-storage-class: +# storageClass: +# create: true +# defaultClass: false +# defaultVolumeType: hostPath +# reclaimPolicy: Delete +# sharedFileSystemPath: "" +# ## OR +# # See above +# nodePathMap: {} podAnnotations: {}