From 7a2cb5e41c66283c9876ac2bf40a9644350896a8 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Wed, 7 Feb 2018 17:01:19 +0100 Subject: [PATCH 1/6] local-provisioner:v1.0.1 still uses VOLUME_CONFIG_NAME env to read ConfigMap --- .../local_volume_provisioner/templates/daemonset.yml.j2 | 2 ++ 1 file changed, 2 insertions(+) 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..401bce4a5 100644 --- a/roles/kubernetes-apps/local_volume_provisioner/templates/daemonset.yml.j2 +++ b/roles/kubernetes-apps/local_volume_provisioner/templates/daemonset.yml.j2 @@ -32,6 +32,8 @@ spec: fieldRef: apiVersion: v1 fieldPath: metadata.namespace + - name: VOLUME_CONFIG_NAME + value: "local-volume-config" volumes: - name: discovery-vol hostPath: From 857784747b9b86ca7d1232b4220cb66411fa57a7 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Wed, 7 Feb 2018 17:47:05 +0100 Subject: [PATCH 2/6] local-provisioner:v1.0.1 still expects json configmap --- .../templates/configmap.yml.j2 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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..f2baa3dfa 100644 --- a/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 +++ b/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 @@ -5,9 +5,10 @@ kind: ConfigMap apiVersion: v1 metadata: name: local-volume-config - namespace: {{ system_namespace }} + namespace: {{ system_namespace }}a data: - storageClassMap: | - local-storage: - hostDir: "{{ local_volume_base_dir }}" - mountDir: "/mnt/local-storage/" + "local-storage": | + { + "hostDir": "{{ local_volume_base_dir }}", + "mountDir": "/mnt/local-storage/" + } From 44eb03f78a9b7ba796043680a5e0551bc258766c Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Wed, 7 Feb 2018 17:57:54 +0100 Subject: [PATCH 3/6] typo --- .../local_volume_provisioner/templates/configmap.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f2baa3dfa..fc6d829a8 100644 --- a/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 +++ b/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 @@ -5,7 +5,7 @@ kind: ConfigMap apiVersion: v1 metadata: name: local-volume-config - namespace: {{ system_namespace }}a + namespace: {{ system_namespace }} data: "local-storage": | { From abfb147292dfbe041386e33c92aec91a28d55452 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Wed, 7 Feb 2018 18:42:42 +0100 Subject: [PATCH 4/6] MountDir in configmap and daemonset must be the same --- .../local_volume_provisioner/templates/configmap.yml.j2 | 2 +- .../local_volume_provisioner/templates/daemonset.yml.j2 | 2 +- roles/kubespray-defaults/defaults/main.yaml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) 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 fc6d829a8..aa8476fd4 100644 --- a/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 +++ b/roles/kubernetes-apps/local_volume_provisioner/templates/configmap.yml.j2 @@ -10,5 +10,5 @@ data: "local-storage": | { "hostDir": "{{ local_volume_base_dir }}", - "mountDir": "/mnt/local-storage/" + "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 401bce4a5..d4f8b73ea 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: diff --git a/roles/kubespray-defaults/defaults/main.yaml b/roles/kubespray-defaults/defaults/main.yaml index fd13417eb..0f4cc90ce 100644 --- a/roles/kubespray-defaults/defaults/main.yaml +++ b/roles/kubespray-defaults/defaults/main.yaml @@ -169,6 +169,7 @@ persistent_volumes_enabled: false # Base path for local volume provisioner addon local_volume_base_dir: /mnt/disks +local_volume_mount_dir: /local-disks ## 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)" From e1aaef7d4da77e1c838da39291118a733913146f Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Thu, 8 Feb 2018 09:06:17 +0100 Subject: [PATCH 5/6] Removal of surnumerary slash --- .../local_volume_provisioner/templates/daemonset.yml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d4f8b73ea..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_volume_mount_dir }}" + mountPath: "{{ local_volume_mount_dir }}" - name: local-volume-config mountPath: /etc/provisioner/config/ env: From e9a676951bcaccaa3618ed540a4d2f1e1675b940 Mon Sep 17 00:00:00 2001 From: Erwan Miran Date: Fri, 9 Feb 2018 00:11:07 +0100 Subject: [PATCH 6/6] storageClass name template as suggested by @eyeofthefrog --- .../local_volume_provisioner/templates/configmap.yml.j2 | 2 +- roles/kubespray-defaults/defaults/main.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 aa8476fd4..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,7 @@ metadata: name: local-volume-config namespace: {{ system_namespace }} data: - "local-storage": | + "{{ local_volume_storage_class }}": | { "hostDir": "{{ local_volume_base_dir }}", "mountDir": "{{ local_volume_mount_dir }}" diff --git a/roles/kubespray-defaults/defaults/main.yaml b/roles/kubespray-defaults/defaults/main.yaml index 0f4cc90ce..63aaeb85a 100644 --- a/roles/kubespray-defaults/defaults/main.yaml +++ b/roles/kubespray-defaults/defaults/main.yaml @@ -170,6 +170,7 @@ 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)"