allow for configurable openstack storage class
This commit is contained in:
parent
e2f083f885
commit
3f44a33738
4 changed files with 25 additions and 18 deletions
|
@ -1,2 +1,7 @@
|
||||||
---
|
---
|
||||||
persistent_volumes_enabled: false
|
persistent_volumes_enabled: false
|
||||||
|
storage_classes:
|
||||||
|
- name: standard
|
||||||
|
is_default: true
|
||||||
|
parameters:
|
||||||
|
availability: nova
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
---
|
---
|
||||||
- name: Kubernetes Persistent Volumes | Lay down OpenStack Cinder Storage Class template
|
- name: Kubernetes Persistent Volumes | Lay down OpenStack Cinder Storage Class template
|
||||||
template:
|
template:
|
||||||
src: "{{item.file}}"
|
src: "openstack-storage-class.yml.j2"
|
||||||
dest: "{{kube_config_dir}}/{{item.file}}"
|
dest: "{{kube_config_dir}}/openstack-storage-class.yml"
|
||||||
with_items:
|
|
||||||
- {file: openstack-storage-class.yml, type: StorageClass, name: storage-class }
|
|
||||||
register: manifests
|
register: manifests
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == groups['kube-master'][0]
|
- inventory_hostname == groups['kube-master'][0]
|
||||||
|
|
||||||
- name: Kubernetes Persistent Volumes | Add OpenStack Cinder Storage Class
|
- name: Kubernetes Persistent Volumes | Add OpenStack Cinder Storage Class
|
||||||
kube:
|
kube:
|
||||||
name: "{{item.item.name}}"
|
name: storage-class
|
||||||
kubectl: "{{bin_dir}}/kubectl"
|
kubectl: "{{bin_dir}}/kubectl"
|
||||||
resource: "{{item.item.type}}"
|
resource: StorageClass
|
||||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
filename: "{{kube_config_dir}}/openstack-storage-class.yml"
|
||||||
state: "latest"
|
state: "latest"
|
||||||
with_items: "{{ manifests.results }}"
|
|
||||||
when:
|
when:
|
||||||
- inventory_hostname == groups['kube-master'][0]
|
- inventory_hostname == groups['kube-master'][0]
|
||||||
|
- manifests.changed
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
kind: StorageClass
|
|
||||||
apiVersion: storage.k8s.io/v1
|
|
||||||
metadata:
|
|
||||||
name: standard
|
|
||||||
annotations:
|
|
||||||
storageclass.kubernetes.io/is-default-class: "true"
|
|
||||||
provisioner: kubernetes.io/cinder
|
|
||||||
parameters:
|
|
||||||
availability: nova
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
{% for class in storage_classes %}
|
||||||
|
---
|
||||||
|
kind: StorageClass
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: "{{ class.name }}"
|
||||||
|
annotations:
|
||||||
|
storageclass.kubernetes.io/is-default-class: "{{ class.is_default | default(false) }}"
|
||||||
|
provisioner: kubernetes.io/cinder
|
||||||
|
parameters:
|
||||||
|
{% for key, value in (class.parameters | default({})).items() %}
|
||||||
|
"{{ key }}": "{{ value }}"
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
Loading…
Reference in a new issue