Merge pull request #4009 from chadswen/lvp-fixup
Bugfixes for Local Volume Provisioner
This commit is contained in:
commit
1d5a9464e2
5 changed files with 40 additions and 41 deletions
|
@ -21,17 +21,17 @@ 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:
|
||||||
# - "/scripts/shred.sh"
|
# - "/scripts/shred.sh"
|
||||||
# - "2"
|
# - "2"
|
||||||
# volume_mode: Filesystem
|
# volume_mode: Filesystem
|
||||||
# fs_type: ext4
|
# fs_type: ext4
|
||||||
|
|
||||||
# CephFS provisioner deployment
|
# CephFS provisioner deployment
|
||||||
cephfs_provisioner_enabled: false
|
cephfs_provisioner_enabled: false
|
||||||
|
|
|
@ -5,26 +5,26 @@ 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:
|
||||||
- "/scripts/shred.sh"
|
- "/scripts/shred.sh"
|
||||||
- "2"
|
- "2"
|
||||||
volume_mode: Filesystem
|
volume_mode: Filesystem
|
||||||
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:
|
||||||
|
|
||||||
|
@ -32,16 +32,16 @@ The result of the above example is:
|
||||||
data:
|
data:
|
||||||
storageClassMap: |
|
storageClassMap: |
|
||||||
local-storage:
|
local-storage:
|
||||||
hostDir: /mnt/disks
|
hostDir: /mnt/disks
|
||||||
mountDir: /mnt/disks
|
mountDir: /mnt/disks
|
||||||
fast-disks:
|
fast-disks:
|
||||||
hostDir: /mnt/fast-disks
|
hostDir: /mnt/fast-disks
|
||||||
mountDir: /mnt/fast-disks
|
mountDir: /mnt/fast-disks
|
||||||
blockCleanerCommand:
|
blockCleanerCommand:
|
||||||
- "/scripts/shred.sh"
|
- "/scripts/shred.sh"
|
||||||
- "2"
|
- "2"
|
||||||
volumeMode: Filesystem
|
volumeMode: Filesystem
|
||||||
fsType: ext4
|
fsType: ext4
|
||||||
```
|
```
|
||||||
|
|
||||||
The default StorageClass is local-storage on /mnt/disks,
|
The default StorageClass is local-storage on /mnt/disks,
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue