Merge pull request #4009 from chadswen/lvp-fixup

Bugfixes for Local Volume Provisioner
This commit is contained in:
Chad Swenson 2019-01-09 11:22:28 -06:00 committed by GitHub
commit 1d5a9464e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 41 deletions

View file

@ -21,10 +21,10 @@ metrics_server_enabled: false
local_volume_provisioner_enabled: false local_volume_provisioner_enabled: false
# local_volume_provisioner_namespace: kube-system # local_volume_provisioner_namespace: kube-system
# local_volume_provisioner_storage_classes: # local_volume_provisioner_storage_classes:
# - local-storage: # local-storage:
# host_dir: /mnt/disks # host_dir: /mnt/disks
# mount_dir: /mnt/disks # mount_dir: /mnt/disks
# - fast-disks: # fast-disks:
# host_dir: /mnt/fast-disks # host_dir: /mnt/fast-disks
# mount_dir: /mnt/fast-disks # mount_dir: /mnt/fast-disks
# block_cleaner_command: # block_cleaner_command:

View file

@ -5,15 +5,15 @@ The [local storage provisioner](https://github.com/kubernetes-incubator/external
is NOT a dynamic storage provisioner as you would is NOT a dynamic storage provisioner as you would
expect from a cloud provider. Instead, it simply creates PersistentVolumes for expect from a cloud provider. Instead, it simply creates PersistentVolumes for
all mounts under the host_dir of the specified storage class. all mounts under the host_dir of the specified storage class.
These storage classes are specified in the `local_volume_provisioner_storage_classes` list. These storage classes are specified in the `local_volume_provisioner_storage_classes` nested dictionary.
An example this list: Example:
```yaml ```yaml
local_volume_provisioner_storage_classes: local_volume_provisioner_storage_classes:
- local-storage: local-storage:
host_dir: /mnt/disks host_dir: /mnt/disks
mount_dir: /mnt/disks mount_dir: /mnt/disks
- fast-disks: fast-disks:
host_dir: /mnt/fast-disks host_dir: /mnt/fast-disks
mount_dir: /mnt/fast-disks mount_dir: /mnt/fast-disks
block_cleaner_command: block_cleaner_command:
@ -23,8 +23,8 @@ local_volume_provisioner_storage_classes:
fs_type: ext4 fs_type: ext4
``` ```
For each dictionary in `local_volume_provisioner_storage_classes` a storageClass with the For each key in `local_volume_provisioner_storage_classes` a storageClass with the
same name is created. The keys of this dictionary are converted to camelCase and added same name is created. The subkeys of each storage class are converted to camelCase and added
as attributes to the storageClass. as attributes to the storageClass.
The result of the above example is: The result of the above example is:

View file

@ -10,7 +10,6 @@
with_nested: with_nested:
- "{{ groups['k8s-cluster'] }}" - "{{ groups['k8s-cluster'] }}"
- "{{ local_volume_provisioner_storage_classes.keys() }}" - "{{ local_volume_provisioner_storage_classes.keys() }}"
failed_when: false
- name: Local Volume Provisioner | Create addon dir - name: Local Volume Provisioner | Create addon dir
file: file:

View file

@ -1,7 +1,9 @@
--- ---
dependencies: dependencies:
- role: kubernetes-apps/external_provisioner/local_volume_provisioner - role: kubernetes-apps/external_provisioner/local_volume_provisioner
when: local_volume_provisioner_enabled when:
- local_volume_provisioner_enabled
- inventory_hostname == groups['kube-master'][0]
tags: tags:
- apps - apps
- local-volume-provisioner - local-volume-provisioner

View file

@ -47,14 +47,12 @@
- name: Create local volume provisioner directories - name: Create local volume provisioner directories
file: file:
path: "{{ local_volume_provisioner_storage_classes[item.1].host_dir }}" path: "{{ local_volume_provisioner_storage_classes[item].host_dir }}"
state: directory state: directory
owner: root owner: root
group: root group: root
mode: 0700 mode: 0700
with_nested: with_items: "{{ local_volume_provisioner_storage_classes.keys() }}"
- "{{ groups['k8s-cluster'] }}"
- "{{ local_volume_provisioner_storage_classes.keys() }}"
when: when:
- inventory_hostname in groups['k8s-cluster'] - inventory_hostname in groups['k8s-cluster']
- local_volume_provisioner_enabled - local_volume_provisioner_enabled