Merge pull request #2338 from southquist/template-openstack-storage-class
allow for configurable openstack storage classpull/2549/merge
commit
e06d02365e
|
@ -1,2 +1,7 @@
|
|||
---
|
||||
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
|
||||
template:
|
||||
src: "{{item.file}}"
|
||||
dest: "{{kube_config_dir}}/{{item.file}}"
|
||||
with_items:
|
||||
- {file: openstack-storage-class.yml, type: StorageClass, name: storage-class }
|
||||
src: "openstack-storage-class.yml.j2"
|
||||
dest: "{{kube_config_dir}}/openstack-storage-class.yml"
|
||||
register: manifests
|
||||
when:
|
||||
- inventory_hostname == groups['kube-master'][0]
|
||||
|
||||
- name: Kubernetes Persistent Volumes | Add OpenStack Cinder Storage Class
|
||||
kube:
|
||||
name: "{{item.item.name}}"
|
||||
name: storage-class
|
||||
kubectl: "{{bin_dir}}/kubectl"
|
||||
resource: "{{item.item.type}}"
|
||||
filename: "{{kube_config_dir}}/{{item.item.file}}"
|
||||
resource: StorageClass
|
||||
filename: "{{kube_config_dir}}/openstack-storage-class.yml"
|
||||
state: "latest"
|
||||
with_items: "{{ manifests.results }}"
|
||||
when:
|
||||
- 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) | ternary("true","false") }}"
|
||||
provisioner: kubernetes.io/cinder
|
||||
parameters:
|
||||
{% for key, value in (class.parameters | default({})).items() %}
|
||||
"{{ key }}": "{{ value }}"
|
||||
{% endfor %}
|
||||
{% endfor %}
|
Loading…
Reference in New Issue