diff --git a/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 b/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 index e6d7595c8..fd8a7a637 100644 --- a/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 +++ b/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 @@ -7,7 +7,8 @@ metadata: name: local-volume-config namespace: {{ system_namespace }} data: - storageClassMap: | - local-storage: - hostDir: "{{ local_volume_base_dir }}" - mountDir: "/mnt/local-storage/" + "{{ local_volume_storage_class }}": | + { + "hostDir": "{{ local_volume_base_dir }}", + "mountDir": "{{ local_volume_mount_dir }}" + } diff --git a/roles/kubernetes-apps/local_volume_provisioner/templates/daemonset.yml.j2 b/roles/kubernetes-apps/local_volume_provisioner/templates/daemonset.yml.j2 index 03e387bb2..6ffe5e36b 100644 --- a/roles/kubernetes-apps/local_volume_provisioner/templates/daemonset.yml.j2 +++ b/roles/kubernetes-apps/local_volume_provisioner/templates/daemonset.yml.j2 @@ -18,7 +18,7 @@ spec: privileged: true volumeMounts: - name: discovery-vol - mountPath: "/local-disks" + mountPath: "{{ local_volume_mount_dir }}" - name: local-volume-config mountPath: /etc/provisioner/config/ env: @@ -32,6 +32,8 @@ spec: fieldRef: apiVersion: v1 fieldPath: metadata.namespace + - name: VOLUME_CONFIG_NAME + value: "local-volume-config" volumes: - name: discovery-vol hostPath: diff --git a/roles/kubespray-defaults/defaults/main.yaml b/roles/kubespray-defaults/defaults/main.yaml index b225f8c13..cdc61b91c 100644 --- a/roles/kubespray-defaults/defaults/main.yaml +++ b/roles/kubespray-defaults/defaults/main.yaml @@ -172,6 +172,8 @@ persistent_volumes_enabled: false # Base path for local volume provisioner addon local_volume_base_dir: /mnt/disks +local_volume_mount_dir: /local-disks +local_volume_storage_class: local-storage ## When OpenStack is used, Cinder version can be explicitly specified if autodetection fails (Fixed in 1.9: https://github.com/kubernetes/kubernetes/issues/50461) # openstack_blockstorage_version: "v1/v2/auto (default)"