Support multiple local volume provisioner StorageClasses (#3450)

- Local Volume StorageClass configuration is now manged by `local_volume_provisioner_storage_classes`, a list of maps that specifies local storage classes with `name` `host_dir` and `mount_dir` keys per entry
- Tasks and templates updated to loop through local volume storage classes
- Previous defaults for path/class names were not changed
- Fixed an issue where a `kubernetes/preinstall` was creating directories inconsistently with the `kubernetes-apps/external_provisioner/local_volume_provisioner` task
This commit is contained in:
Chad Swenson
2018-10-05 07:52:25 -05:00
committed by k8s-ci-robot
parent 9232261665
commit 6602760a48
12 changed files with 66 additions and 35 deletions

View File

@@ -6,6 +6,8 @@ metadata:
namespace: {{ local_volume_provisioner_namespace }}
data:
storageClassMap: |
{{ local_volume_provisioner_storage_class }}:
hostDir: {{ local_volume_provisioner_base_dir }}
mountDir: {{ local_volume_provisioner_mount_dir }}
{% for class in local_volume_provisioner_storage_classes %}
{{ class.name }}:
hostDir: {{ class.host_dir }}
mountDir: {{ class.mount_dir }}
{% endfor %}

View File

@@ -44,13 +44,17 @@ spec:
- name: local-volume-provisioner
mountPath: /etc/provisioner/config
readOnly: true
- name: local-volume-provisioner-hostpath-mnt-disks
mountPath: {{ local_volume_provisioner_mount_dir }}
{% for class in local_volume_provisioner_storage_classes %}
- name: {{ class.name }}
mountPath: {{ class.mount_dir }}
mountPropagation: "HostToContainer"
{% endfor %}
volumes:
- name: local-volume-provisioner
configMap:
name: local-volume-provisioner
- name: local-volume-provisioner-hostpath-mnt-disks
{% for class in local_volume_provisioner_storage_classes %}
- name: {{ class.name }}
hostPath:
path: {{ local_volume_provisioner_base_dir }}
path: {{ class.host_dir }}
{% endfor %}

View File

@@ -25,8 +25,10 @@ spec:
- 'downwardAPI'
- 'hostPath'
allowedHostPaths:
- pathPrefix: "{{ local_volume_provisioner_base_dir }}"
{% for class in local_volume_provisioner_storage_classes %}
- pathPrefix: "{{ class.host_dir }}"
readOnly: false
{% endfor %}
hostNetwork: false
hostIPC: false
hostPID: false

View File

@@ -1,7 +1,9 @@
{% for class in local_volume_provisioner_storage_classes %}
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ local_volume_provisioner_storage_class }}
name: {{ class.name }}
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
{% endfor %}